#1

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

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

Or you check this out:

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

Reply
#4

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;
??
Reply
#5

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;
Reply
#6

Okay thanks
Reply
#7

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

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

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 .
Reply
#10

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;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)