Problem with my kill streak system > says 5 kills in a row while 2 - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with my kill streak system > says 5 kills in a row while 2 (
/showthread.php?tid=158013)
Problem with my kill streak system > says 5 kills in a row while 2 -
Andy_McKinley - 08.07.2010
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
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;
}
Correct?
Re: Problem with my kill streak system > says 5 kills in a row while 2 -
CAR - 08.07.2010
Got it (I think)
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;
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));
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;
}
}
}
NC[playerid] = 0;
return 1;
}