Is this an array? How does this work? - 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: Is this an array? How does this work? (
/showthread.php?tid=615169)
Is this an array? How does this work? -
EtayJ - 18.08.2016
https://sampforum.blast.hk/showthread.php?tid=581336
On the first code that he wrote, he created an enum and a PlayerInfo object, is it a multi dimensional array? How does this even work? I am having an hard time understanding the part with the enum and the PlayerInfo, the rest is clear.
Re: Is this an array? How does this work? -
Vince - 18.08.2016
Yes. An enumeration defines a set of constants. It is actually very similar to doing:
PHP код:
#define pName 0 // start at index 0 and reserve another 23 indices
#define pPassword 24 // start at slot 24 and reserve another 64 indices
#define pSalt 88 // start at index 88 and reserve another 10 indices
#define pInfo 98 // total number of indices + 1
new PlayerInfo[MAX_PLAYERS][pInfo];
Although the enumeration is obviously much easier to construct since you don't have to perform any calculations yourself.
Re: Is this an array? How does this work? -
EtayJ - 18.08.2016
EDIT: Nevermind, I think I got it.