SA-MP Forums Archive
about #definings - 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: about #definings (/showthread.php?tid=536245)



about #definings - PawnoQ - 08.09.2014

hi,

can i define integers for matching later like this? :

pawn Код:
//definings
#define MODE_TDM    0,3,6

//later i want to compare them:
if(X==MODE_TDM)
Is it possible like that, would it work? (or would it just check the "0" in the if statement and wouldnt mind the other values?)


thanks


Re: about #definings - IceCube! - 08.09.2014

No it wouldn't work like that, you will simple be asking if:

X = 0,3,6.

Use an array:

pawn Код:
new TDModes[]
{
     0, 3, 6
};
Then do the check like:

pawn Код:
for(new i = 0; i < sizeof(TDModes); i++)
{
     if(x==TDMode[I])
}



Re: about #definings - dusk - 08.09.2014

Defining that is the same as doing
pawn Код:
if(X == 0,3,6)
Which is not valid.

EDIT: too slow