new PlayerDeaths[MAX_PLAYERS] rep ++
#3

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:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
        PlayerDeaths[playerid] ++;
        PlayerKills[killerid] ++; // ++ means add 1 to the current value.
	return 1;
}
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.
Код:
public OnPlayerConnect(playerid)
{
     PlayerDeaths[playerid] = 0;
     PlayerKills[playerid] = 0;
     return 1;
}
Enum example:
Код:
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;
}
Reply


Messages In This Thread
new PlayerDeaths[MAX_PLAYERS] rep ++ - by NviDa - 28.12.2014, 14:32
Re: new PlayerDeaths[MAX_PLAYERS] rep ++ - by UltraScripter - 28.12.2014, 14:36
Re: new PlayerDeaths[MAX_PLAYERS] rep ++ - by Facerafter - 28.12.2014, 14:37
Re: new PlayerDeaths[MAX_PLAYERS] rep ++ - by NviDa - 28.12.2014, 14:45
Re: new PlayerDeaths[MAX_PLAYERS] rep ++ - by Facerafter - 28.12.2014, 14:50
Re: new PlayerDeaths[MAX_PLAYERS] rep ++ - by NviDa - 28.12.2014, 14:56
Re: new PlayerDeaths[MAX_PLAYERS] rep ++ - by UltraScripter - 28.12.2014, 15:00
Re: new PlayerDeaths[MAX_PLAYERS] rep ++ - by Facerafter - 28.12.2014, 15:02

Forum Jump:


Users browsing this thread: 1 Guest(s)