[HELP] Detecting most kills?
#4

Quote:
Originally Posted by Sky4D
Посмотреть сообщение
Exactly.

----Pawn Code--------
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.
Reply


Messages In This Thread
[HELP] Detecting most kills? - by RoCK'N'Rolla - 18.08.2010, 09:33
Re: [HELP] Detecting most kills? - by RoCK'N'Rolla - 18.08.2010, 09:46
Re: [HELP] Detecting most kills? - by Sky4D - 18.08.2010, 15:27
Re: [HELP] Detecting most kills? - by Dark_Kostas - 18.08.2010, 15:36
Re: [HELP] Detecting most kills? - by Sky4D - 18.08.2010, 15:38
Re: [HELP] Detecting most kills? - by Sky4D - 18.08.2010, 18:22
Re: [HELP] Detecting most kills? - by RoCK'N'Rolla - 19.08.2010, 10:44

Forum Jump:


Users browsing this thread: 1 Guest(s)