06.12.2010, 18:39
Top of the script (under #include <a_samp>):
OnPlayerCommandText:
OnPlayerDeath:
Bottom of script, or not in another callback:
Код:
new Kills[MAX_PLAYERS], KillsOn;
Код:
if(strcmp("/startkillcount", cmdtext, true) == 0)
{
if(IsPlayerAdmin(playerid) == 0) return 0;
KillsOn = 1;
return 1;
}
if(strcmp("/endkillcount", cmdtext, true) == 0)
{
if(IsPlayerAdmin(playerid) == 0) return 0;
KillsOf = 0;
GetMaxKills();
return 1;
}
OnPlayerDeath:
Код:
if(KillsOn = 1)
{
Kills[playerid]++;
}
Код:
[GetMaxKills()
{
new killerid;
for(new a = 0; a < MAX_PLAYERS; a++)
{
for(new b = 0; b < MAX_PLAYERS; b++)
{
if(Kills[a] > Kills[b])
{
killerid = a;
}
}
}
new string[128];
format(string, sizeof(string), "ID %d was the winner", killerid);
SendClientMessageToAll(0xFFFFFFFF, string);
}

