Nooby question about if
#1

Hey, I've havent scripted with onplayerdeath for a while and now i forgot.
Didnt find it on the wiki.

How to check for the opposite of
pawn Код:
if(killerid == INVALID_PLAYER_ID)
Instead of doing
pawn Код:
if(killerid == INVALID_PLAYER_ID)
{
}
else
{
//...
}
Reply
#2

pawn Код:
if((killerid == INVALID_PLAYER_ID) == false) {}
if(!(killerid == INVALID_PLAYER_ID)) {}
Reply
#3

Will
pawn Код:
if(!killerid == INVALID_PLAYER_ID)
Work too?
Reply
#4

pawn Код:
if(killerid != INVALID_PLAYER_ID)
Reply
#5

Quote:
Originally Posted by [NWA
Hannes ]
Will
pawn Код:
if(!killerid == INVALID_PLAYER_ID)
Work too?
No that would be something different

Quote:
Originally Posted by biltong
pawn Код:
if(killerid != INVALID_PLAYER_ID)
That works, too
Reply
#6

Quote:
Originally Posted by [NWA
Hannes ]
Will
pawn Код:
if(!killerid == INVALID_PLAYER_ID)
Work too?
When you say !<variable>, or !<function>, you are basically checking if your variable or function returns zero, so in this case, you are checking if 0 == INVALID_PLAYER_ID
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)