28.12.2014, 14:37
That creates a variable for every player that can join the server and connect it to the playerid.
The "new" creates the variable. ";" ends the line and defines the start of a new one.
With this you could for example do:
And no this has nothing to do with enums but it can also be done with a enum.
The current way the value will reset on server restart and needs to be de reset everytime a player disconnects or joins.
Enum example:
The "new" creates the variable. ";" ends the line and defines the start of a new one.
With this you could for example do:
Код:
public OnPlayerDeath(playerid, killerid, reason) { PlayerDeaths[playerid] ++; PlayerKills[killerid] ++; // ++ means add 1 to the current value. return 1; }
The current way the value will reset on server restart and needs to be de reset everytime a player disconnects or joins.
Код:
public OnPlayerConnect(playerid) { PlayerDeaths[playerid] = 0; PlayerKills[playerid] = 0; return 1; }
Код:
enum pInfo { pDeaths, pKills } new PlayerInfo[MAX_PLAYERS][pInfo]; public OnPlayerDeath(playerid, killerid, reason) { PlayerInfo[playerid][pDeaths] ++; PlayerInfo[killerid][pKills] ++; // ++ means add 1 to the current value. return 1; }