if check not working

  • JTP
  • JTP's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
6 days 22 hours ago #8069 by JTP
JTP created the topic: if check not working
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 ?
  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
6 days 19 hours ago #8070 by thomas
thomas replied the topic: if check not working
    if (!IS_NPC(ch) && (!AFF_FLAGGED(ch, AFF_SWIM) || !AFF_FLAGGED(ch, AFF_FLYING))) {
Your logic is slightly off there.
    if (!IS_NPC(ch) && !(AFF_FLAGGED(ch, AFF_SWIM) || AFF_FLAGGED(ch, AFF_FLYING))) {
or
    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.927 seconds