Quote:
Originally Posted by Dark_Kostas
Some edits about it
pawn Код:
new playerKills[MAX_PLAYERS];//at OnPlayerConnect you should set it at 0 "playerKills[playerid] = 0;"
public OnPlayerDeath(playerid, killerid, reason) { playerKills[killerid]++; //killer should get a plus, not the player that die return 1; }
COMMAND:yourcheck(playerid, params[]) { new mostkills = INVALID_PLAYER_ID; for(new i = 0; i < MAX_PLAYERS; i++) //you should be using foreach, but this works too. { if(playerKills[i] > playerKills[mostkills]) mostkills = i; } printf("The ID with most kills is: %d", mostkills"); return 1; }
This should work fine. btw i would prefer using PVars.
|
Thanks, I was kind of wondering how to go about that too, after I replied, I stared at my code for like 5 minutes going "Hm... is this even going to work?" :P