SA-MP Forums Archive
Small question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Small question (/showthread.php?tid=294343)



Small question - FireCat - 01.11.2011

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"!");



AW: Small question - Drebin - 01.11.2011

&& means AND
|| means OR

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


Re: Small question - Wesley221 - 01.11.2011

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


Re: AW: Small question - FireCat - 01.11.2011

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


Re: Small question - IstuntmanI - 01.11.2011

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 ).