How to get a players total kills (On the server) -
stormchaser206 - 26.04.2012
How can you see how many kills the player has done on the server? This will count all the kills he has done since he started playing on the server.
Can someone create a stock and show the code or tell me how to? I really need this for my war server.
Re: How to get a players total kills (On the server) -
MP2 - 26.04.2012
Use a variable which you increase for killerid under OnPlayerDeath. Save this value when they disconnect. IMPORTANT: You MUST check that killerid is NOT INVALID_PLAYER_ID before you use an array with [killerid]. If it is suicide OnPlayerDeath will stop executing.
To increase an array's value:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != INVALID_PLAYER_ID)
{
pKills[killerid]++;
}
return 1;
}
Re: How to get a players total kills (On the server) -
stormchaser206 - 26.04.2012
I have never created an array, can you show me how?
Re: How to get a players total kills (On the server) -
MP2 - 26.04.2012
new pKills[MAX_PLAYERS];
Outside all callbacks/functions, which will make it 'global'.
Re: How to get a players total kills (On the server) -
stormchaser206 - 26.04.2012
But isn't there a
pawn Код:
pKills[MAX_PLAYERS]; = //Function here
Re: How to get a players total kills (On the server) -
MP2 - 26.04.2012
What..?
Re: How to get a players total kills (On the server) -
stormchaser206 - 26.04.2012
I mean that isn't that there?
Where says "Function here", thats where you put what pKills means.
And i also need to know how to save it when they disconnect.
EDIT: And also i am using this for rank system depending on how much kills they have total.
Re: How to get a players total kills (On the server) -
Kakioshe22 - 26.04.2012
If you want it to save when player quit then you gotta have register system...
Re: How to get a players total kills (On the server) -
stormchaser206 - 26.04.2012
I use LuxAdmin's register system.
Re: How to get a players total kills (On the server) -
stormchaser206 - 27.04.2012
Sorry for the bump,
But for array:
How would i use it to see how many total kills they have?
Is it like this:
pawn Код:
if(pKills >= 50 && <= 60)
{
SetPlayerHealth(playerid, 999999);
}