Detecting if a player has a custom define - 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: Detecting if a player has a custom define (
/showthread.php?tid=310263)
Detecting if a player has a custom define -
milanosie - 11.01.2012
Hey there! I am making a script but I need somehelp on defining something
I have
new pJob[MAX_PLAYERS];
And the defines are:
#define pJob_1
#define pJob_2
Now this all works.
I also setted someones job to job 1 with a command.
Now I need:
if(*player job is pJob_1*)
How to make that last part?
Re: Detecting if a player has a custom define -
Norck - 11.01.2012
It will be like:
pawn Код:
if(pJob[playerid] == pJob_1)
{
// ...
}
But make sure that you have defined your jobs with a values like:
pawn Код:
#define pJob_1 1 // pJob_1 = 1
#define pJob_2 2 // pJob_2 = 2
But not like:
pawn Код:
#define pJob_1
#define pJob_2
Re: Detecting if a player has a custom define -
milanosie - 11.01.2012
Why must it be pJob_1 1??
Re: Detecting if a player has a custom define -
Norck - 11.01.2012
You can read more about it here:
http://forum.sa-mp.com/showthread.ph...t=preprocessor