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)
+--- Thread: Enum (/showthread.php?tid=340353)



Enum - Mento - 06.05.2012

How do I create a enum like this:
pawn Код:
enum numbers
{
55,66,77
};
So that way when I refer to a command I can do if(numbers) something like that.


Re: Enum - Vince - 06.05.2012

Just create a regular array? I don't quite understand what you want to do.


Re: Enum - Mento - 06.05.2012

I've seen it done with coordinates, where they put like 10 coordinates and they refer back to it using a enum of some sort, how do I do that?


Re: Enum - FalconX - 07.05.2012

Quote:
Originally Posted by Mento
Посмотреть сообщение
I've seen it done with coordinates, where they put like 10 coordinates and they refer back to it using a enum of some sort, how do I do that?
You mean something like this?:-

pawn Код:
enum PLAYER_DATA
{
    iLogged,
    iAdminLevel,
    iVip,
    bIsRegged,
    iPocketCash,
    iKills,
    iDeaths
}

new gPlayerData[MAX_PLAYERS][PLAYER_DATA];
To learn more about enumerators you can click the following link:-


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


Re: Enum - Mento - 07.05.2012

I figured out I was mistaken I meant this:
pawn Код:
new Pos[2][3] = {
{15,15,15},
{105,15,35}
};



Re: Enum - newbienoob - 07.05.2012

new Float:Pos[2].....


Re: Enum - Mento - 07.05.2012

Right, but I wasn't using floats at the time, but you're right as I will probably use more advanced coordinates later on. Also for this thing, does it use a lot of memory, and should I avoid it? Or is it fine if I use it a lot in my script?