SA-MP Forums Archive
"or if" - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: "or if" (/showthread.php?tid=227726)



"or if" - oliverrud - 18.02.2011

Is there some way to describe "or if" in a sense, what I'm looking to do is a if statement for example,
pawn Код:
if(x or if y or if z == 1)
{
 do something
}

Described Version Below:
if(x/*or if*/y/*or if*/z/*if one of them equals 1 then do the thing, doesn't have to be them all*/ == 1)



Re: "or if" - Krx17 - 18.02.2011

||

pawn Код:
if(x == 1 || y == 1) //turns to be if x = 1 or y = 1



Re: "or if" - MrDeath537 - 18.02.2011

Maybe it will make things easier for you :

pawn Код:
// Top of your script
#define OR ||
#define AND &&

Example of usage:

pawn Код:
if (IsPlayerConnected(playerid) AND !IsPlayerNPC(playerid))
pawn Код:
if (MyVariable == 1 OR MyVariable == 2)