[HELP] Detecting most kills?
#5

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
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: 3 Guest(s)