Small question
#1

Like I want to do this (in my words):
if player team is different from DRIVER or PILOT send a message.
But if he's a DRIVER and a not a PILOT or vice versa it still sends it,
I can't understand the difference between && and ||. They always confuse me
pawn Код:
if(team[playerid] != DRIVER || team[playerid] != PILOT) return SendClientMessage(playerid,Red,"ERROR: "lgrey"You aren't a "lyellow"driver/pilot"lgrey"!");
Reply
#2

&& means AND
|| means OR

https://sampwiki.blast.hk/wiki/Control_Structures#if for more info
Reply
#3

So if youre a driver OR an pilot, it shouldnt be sending the message?
Reply
#4

Quote:
Originally Posted by Drebin
Посмотреть сообщение
&& means AND
|| means OR
I know, but try and figure it out for my code up there.
Reply
#5

Change
Код:
if(team[playerid] != DRIVER || team[playerid] != PILOT)
( if playerid's team is not driver OR is not Pilot ( he must to be both, so it's impossible ), send the message )
to
Код:
if(team[playerid] != DRIVER && team[playerid] != PILOT)
( if playerid's team is not driver and is not pilot, send the message ).
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)