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



enum-array - MerryDeer - 25.09.2016

Hi,

Simple variable

new Variable[ MAX_PLAYERS ];

is enum-array? or i need to create enum then that variable will by enum-array?


Re: enum-array - Maheerali - 25.09.2016

you need to create enum.
Example:
PHP код:
enum E_MY_ARRAY
{
    
E_MY_ARRAY_MONEY,
    
E_MY_ARRAY_AMMO,
    
E_MY_ARRAY_GUN
}
 
new
    
gPlayerData[MAX_PLAYERS][E_MY_ARRAY];
 
public 
OnPlayerConnect(playerid)
{
    
gPlayerData[playerid][E_MY_ARRAY_MONEY] = 0;
    
gPlayerData[playerid][E_MY_ARRAY_AMMO] = 100;
    
gPlayerData[playerid][E_MY_ARRAY_GUN] = 5;
}
//I prefer Enum array but you can create simple variable like
new money[MAX_PLAYERS];