SA-MP Forums Archive
difference between this - 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: difference between this (/showthread.php?tid=502247)



difference between this - M3rcurio - 23.03.2014

Hello what is the difference of this

pawn Код:
enum info
{
   Cash,
   Admin
};
new Player[MAX_PLAYERS][info];
and this

pawn Код:
enum info
{
    Cash,
    Admin
};
static Player[MAX_PLAYERS][info];
and what should i use?


Re: difference between this - Equuuuin0X - 23.03.2014

You should use the first one, I'm not sure about the second one.

Just use the first one, you'll be fine.

pawn Код:
enum info << this is the enums
{
   Cash, < this is the info
   Admin < same, info
};
new Player[MAX_PLAYERS][info]; < this to define ''Player'' is the enums of ''info'',
Exmaple usage:
if (Player[playerid][Cash] ==> 500)


Re: difference between this - blackeagle1122 - 23.03.2014

If u use static you can't use this variable on other scripts. Means if u use 'new' in any include you can use this variable in your gamemode but if you use static you can not use it in your gamemode.


Re: difference between this - MP2 - 23.03.2014

static has two uses.

If it is used on a global variable, it limits the scope of the variable to the current file.

If used on a local variable, it basically makes the local variable a global variable whose scope is what the scope of the local variable would be (i.e. it retains the value).