SA-MP Forums Archive
Question for arrays - 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: Question for arrays (/showthread.php?tid=579334)



Question for arrays - DusanInfinity - 26.06.2015

Do I have to annul all arrays when the player connects?
example:
I have added on top of the script: new AdminDuty[MAX_PLAYERS] = 0;
Do I have to write AdminDuty[playerid] = 0; in public OnPlayerConnect If I want each player has AdminDuty[playerid] = 0, when connect to the server?


Re: Question for arrays - Prokill911 - 26.06.2015

Depends if that player is not previously registered.

To be honest, You shouldn't declare ANY enums until that player has "Registered / Logged" into the server.

Once they FIRST register...
You should set all enums for that player

so "AdminDuty[playerid] = 0;"
would be set when they first register
Then
When they login, It should just call previously saved data.


Re: Question for arrays - DusanInfinity - 26.06.2015

Thank you!