01.10.2014, 19:14
Why sometimes it says that someone is the killer of the day while he has 0 kills (didn't kill anyone)?
pawn Код:
GetHighestKiller()
{
new m = 0, score = 0;
foreach(Player, i)
{
if(KillerScore[i] > score)
{
score = KillerScore[i];
m = i;
}
}
return m;
}
forward KillingScore();
public KillingScore()
{
new highestkiller = GetHighestKiller();
if(highestkiller != INVALID_PLAYER_ID)
{
new str[128], killername[MAX_PLAYER_NAME];
format(str, sizeof(str), "Congratulations! You Are The {FF0000}Killer {FFEE00}Of The Day, Reward: $10000 Cash And 10 Score!");
SendClientMessage(highestkiller, 0xFFEE00FF, str);
GivePlayerMoney(highestkiller, 10000);
SetPlayerScore(highestkiller, GetPlayerScore(highestkiller) + 10);
GameTextForPlayer(highestkiller, "~g~Killer Of The Day!~n~~p~Reward: ~g~$10000 ~p~And ~g~10 Scores!", 5000, 3);
GetPlayerName(highestkiller, killername, sizeof(killername));
format(str, sizeof(str), "{FFEE00}%s {00FFF2}Is The {FF0000}Killer {00FFF2}Of The Day, Congratulations! With: %d Kills Today!", killername, KillerScore[highestkiller]);
SendClientMessageToAll(0x00FFF2FF, str);
foreach(Player, i) KillerScore[i] = 0;
}
else SendClientMessageToAll(0xFF0000FF, "There Is No Killer Of The Day, As Nobody Was Killed.");
return 1;
}