08.07.2010, 13:58
I made killing spree system, 10 kills shows a message, 20, 30 = nuke, you name it. But when the player have 16 kills it already shows that he's got 20 kill streak. Here is my onplayerdeath
Correct?
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid,playerid,reason);
Killed[playerid] = killerid;
pInfo[playerid][pDeaths]++;
if(killerid == INVALID_PLAYER_ID) {
PlayerKills[playerid] = 0;
} else {
PlayerKills[killerid]++;
PlayerKills[playerid] = 0;
}
NC[playerid] = 0;
if(killerid != INVALID_PLAYER_ID)
{
pInfo[killerid][pKills]++;
if(gTeam[killerid] != gTeam[playerid])
{
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
GivePlayerMoney(killerid, 3000);
{
new kName[128], string[128];
GetPlayerName(killerid, kName, sizeof(kName));
PlayerKills[killerid] = PlayerKills[killerid] + 1;
PlayerKills[playerid] = 0;
if (PlayerKills[killerid] == 10)
{
format(string, sizeof(string), "%s is on a Killing Spree! [10 kills]", kName);
SendClientMessageToAll(COLOR_UFAC, string);
return 1;
}
if (PlayerKills[killerid] == 20)
{
format(string, sizeof(string), "%s is on a Killing Spree! [20 kills]", kName);
SendClientMessageToAll(COLOR_UFAC, string);
return 1;
}
if (PlayerKills[killerid] == 30)
{
SendClientMessage(killerid,COLOR_GREEN,"You have access to /nuke!");
SendClientMessage(killerid,COLOR_RED,"WARNING: Activating nuke will destroy the whole city!");
format(string, sizeof(string), "%s is on a Killing Spree! [30 kills]", kName);
SendClientMessageToAll(COLOR_UFAC, string);
return 1;
}
if (PlayerKills[killerid] == 40)
{
format(string, sizeof(string), "%s is on a Killing Spree! [40 kills]", kName);
SendClientMessageToAll(COLOR_UFAC, string);
return 1;
}
}
}
}
return 1;
}