if check not working

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
4 months 1 week ago #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 ?
  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
4 months 1 week ago #8070 by thomas
Replied by thomas on 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.902 seconds