Detecting who has the most kills
#2

pawn Код:
stock GetHighestKills()
{
    new kills, player = INVALID_PLAYER_ID;
    for (new i, j = GetMaxPlayers(); i < j; i++)
    {
        if (IsPlayerConnected(i))
        {
            if (GetPVarInt(i, "Kills") > kills)
            {
                player = i;
                kills = GetPVarInt(i, "Kills");
            }
        }
    }
    return player;
}
pawn Код:
new bestkiller = GetHighestKills();

if (bestkiller != INVALID_PLAYER_ID)
{
    // Do something
}
Reply


Messages In This Thread
Detecting who has the most kills - by new121 - 16.03.2012, 18:30
Re: Detecting who has the most kills - by Psymetrix - 16.03.2012, 19:34
Re: Detecting who has the most kills - by new121 - 16.03.2012, 19:46
Re: Detecting who has the most kills - by coole210 - 16.03.2012, 19:47
Re: Detecting who has the most kills - by Psymetrix - 16.03.2012, 19:49
Re: Detecting who has the most kills - by new121 - 16.03.2012, 19:52

Forum Jump:


Users browsing this thread: 2 Guest(s)