Welcome to the Builder Academy

Question if check not working

More
13 May 2018 11:50 #8069 by JTP
if check not working was created by JTP
Ok i made this if check, if swimming its ok. If flying i get the message. If neither swimming or flying i ofc get the message.
But how come im stopped when flying ?
Code:
if ((SECT(was_in) == SECT_WATER_SWIM) || (SECT(going_to) == SECT_WATER_SWIM)) { if (!IS_NPC(ch) && (!AFF_FLAGGED(ch, AFF_SWIM) || !AFF_FLAGGED(ch, AFF_FLYING))) { send_to_char(ch, "You can't swim right now.\r\n"); return (0); } }

Please Log in or Create an account to join the conversation.

More
13 May 2018 14:20 #8070 by thomas
Replied by thomas on topic if check not working
Code:
if (!IS_NPC(ch) && (!AFF_FLAGGED(ch, AFF_SWIM) || !AFF_FLAGGED(ch, AFF_FLYING))) {
Your logic is slightly off there.
Code:
if (!IS_NPC(ch) && !(AFF_FLAGGED(ch, AFF_SWIM) || AFF_FLAGGED(ch, AFF_FLYING))) {
or
Code:
if (!IS_NPC(ch) && (!AFF_FLAGGED(ch, AFF_SWIM) && !AFF_FLAGGED(ch, AFF_FLYING))) {
both works better,

Please Log in or Create an account to join the conversation.

Time to create page: 0.167 seconds