SA-MP Forums Archive
enum - 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: enum (/showthread.php?tid=147669)



enum - Jonni8 - 13.05.2010

Hey Guys,

I read a lot enum (functions ?) in scripts.

but i couldnt find any syntax or use of it.

please can u tell me how and for what i use enums?


Re: enum - ViruZZzZ_ChiLLL - 13.05.2010

A good of example of it is this
http://forum.sa-mp.com/index.php?topic=126584.0
DINI ^^


Re: enum - juice.j - 13.05.2010

Or you check this out:

https://sampwiki.blast.hk/wiki/Keywords:Initialisers#enum




Re: enum - Jonni8 - 13.05.2010

Ok, so if i understand that right, its like this:

Код:
enum TEST_ARRAY
{
  TEST_ARRAY_1 = 1,
  TEST_ARRAY_2 = 2
}
is the same thing as
Код:
new gTEST_ARRAY_1 = 1;
new gTEST_ARRAY_2 = 2;
??



Re: enum - Killa_ - 13.05.2010

Quote:
Originally Posted by Jonni8
Ok, so if i understand that right, its like this:

Код:
enum TEST_ARRAY
{
  TEST_ARRAY_1 = 1,
  TEST_ARRAY_2 = 2
}
is the same thing as
Код:
new gTEST_ARRAY_1 = 1;
new gTEST_ARRAY_2 = 2;
??
No.

This is
pawn Код:
enum pInfo
{
  Text1 = 1,
  Text2 = 2
}
new Player[MAX_PLAYERS][pInfo];
Same as this
pawn Код:
new Text1[MAX_PLAYERS] = 1;
new Text2[MAX_PLAYERS] = 2;



Re: enum - Jonni8 - 13.05.2010

Okay thanks


Re: enum - cAMo - 13.05.2010

Is there a limit to how many arrays you can have in an enum?


Re: enum - Jonni8 - 13.05.2010

Thanks SouthClaw(sorry if i wrote it wrong, but i couldnt read it very easy :P)

that helped me very much.

@cAMo: i think thers no limit on how many arrays are in there


Re: enum - juice.j - 13.05.2010

Just a little additional information. If you're scripting from scratch and want to use enums for anything connected to a player (playerid), use PVars (https://sampwiki.blast.hk/wiki/Per-player_variable_system) instead.

Faster, ressource-friendlier and not less than as easy to use .


Re: enum - cAMo - 13.05.2010

Wow, didn't realize you could do that! Cool

For a login script, would you assign SetPVarInt "LoggedIn" or would you do something like LoggedIn[playerid] = true;