Most kills for a round?
#10

This is what i wrote up in notepad, i havent tested it - i cba to really right now.
Give it a try and tell me if it works.
pawn Код:
/*
* Gets the most kills and deaths in the Info array.
* Accepts 4 variables by reference, k (variable to store most Kills), kID (variable to store the playerid of the player * with most kills)
* d (variable to store most deaths), dID (variable to store the playerid of the player with most deaths)
* Not tested, should work though */


stock GetHighestKD(&k, &kID, &d, &dID)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(Info[playerid][Deaths] > d)
        {
            d = Info[i][Deaths];
            dID = i;           
        }
        if(Info[playerid][Kills] > k)
        {
            k = Info[i][Kills];
            kID = i;   
        }
    }
    return 1;
}


/*
* Just a little function to get players name
*/

stock getName(playerid)
{
    new str[MAX_PLAYER_NAME];
    GetPlayerName(playerid, str, sizeof(str));
    return str;
}

Public OnRoundEnd()
{
    new mKills, mKillsPlayerID, mDeaths, mDeathsPlayerID;
    GetHighestKD(mKills, mKillsPlayerID, mDeaths, mDeathsPlayerID);
    format(str, sizeof(str), "%s had most kills for this round! (Kills: %d)", getName(mKillsPlayerID), mKills);
    SendClientMessageToAll(red, str);
    format(str, sizeof(str), "%s had most deaths for this round! (Deaths: %d)", getName(mDeathsPlayerID), mDeaths);
    SendClientMessageToAll(red, str);
}
forums destroyed indentation, sorry.
Reply


Messages In This Thread
Most kills for a round? - by bajskorv123 - 05.03.2010, 15:20
Re: Most kills for a round? - by bajskorv123 - 06.03.2010, 15:43
Re: Most kills for a round? - by bajskorv123 - 07.03.2010, 12:13
Re: Most kills for a round? - by bajskorv123 - 09.03.2010, 14:15
Re: Most kills for a round? - by bajskorv123 - 10.03.2010, 17:31
Re: Most kills for a round? - by bajskorv123 - 11.03.2010, 15:19
Re: Most kills for a round? - by Jeffry - 11.03.2010, 15:49
Re: Most kills for a round? - by bajskorv123 - 11.03.2010, 16:08
Re: Most kills for a round? - by Jeffry - 11.03.2010, 16:12
Re: Most kills for a round? - by iLinx - 11.03.2010, 17:02

Forum Jump:


Users browsing this thread: 2 Guest(s)