11.03.2010, 17:02
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.
forums destroyed indentation, sorry.
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);
}