01.05.2016, 23:20
PHP Code:
enum TPlayerData
{
UserID,
Name[25],
Password[130],
IP[16],
GPCI[130],
PasswordAttempts,
bool:LoggedIn,
bool:InClassSelection,
// Player data
Money,
Score,
AdminLevel,
Speed
}
new APlayerData[MAX_PLAYERS][TPlayerData];
Most people do this when clearing all data in a player's account when a player disconnects or connects (to be sure the new player won't get data from the previous player):
PHP Code:
APlayerData[playerid][UserID] = 0;
APlayerData[playerid][Name][0] = 0;
APlayerData[playerid][Password][0] = 0;
APlayerData[playerid][IP][0] = 0;
APlayerData[playerid][GPCI][0] = 0;
APlayerData[playerid][PasswordAttempts] = 0;
APlayerData[playerid][LoggedIn] = false;
APlayerData[playerid][InClassSelection] = false;
APlayerData[playerid][Money] = 0;
APlayerData[playerid][Score] = 0;
APlayerData[playerid][AdminLevel] = 0;
APlayerData[playerid][Speed] = 0;
PHP Code:
new temp[TPlayerData];
APlayerData[playerid] = temp;
Just reset them all at once.
I have no idea if it's faster and if it is, how much faster.
I never tested the speed of it, but it surely is less code and less risk to clear all your vars.