Detecting if a player has a custom define
#1

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?
Reply
#2

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
Reply
#3

Why must it be pJob_1 1??
Reply
#4

You can read more about it here:
http://forum.sa-mp.com/showthread.ph...t=preprocessor
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)