Why we use var for enums? - 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: Why we use var for enums? (
/showthread.php?tid=560967)
Why we use var for enums? -
Arxalan - 31.01.2015
Hello , i want to know why we need to use variables for enums . For example
PHP код:
enum Pinfo
{
Playermoney,
Playeradmin
}
new Playerinfo[MAX_PLAYERS][Pinfo] // Why we need this?
Re: Why we use var for enums? -
CalvinC - 31.01.2015
We create that with "MAX_PLAYERS", which means we can use it for "playerid".
If not, you couldn't use these variables with players correctly, but you don't need that variable if you're not using it for playerid or something like that.
Re: Why we use var for enums? -
Vince - 31.01.2015
An enum is as its name suggest nothing more than an enumeration. It is not an array. It is in fact very similar to doing this:
pawn Код:
#define Playermoney (0)
#define Playeradmin (1)
Although obviously much clearer and much easier to maintain.