Nuke for 30 kill streak - 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: Nuke for 30 kill streak (
/showthread.php?tid=157308)
Nuke for 30 kill streak -
Andy_McKinley - 06.07.2010
I wanted to make something for players with 30 kill streak. Well, I thought it was going to work, so I tried it but nothing happened when I typed /nuke. Then I removed the 30 kill part and suddenly it worked. How can I make it for 30 kills in a row only, I know how to but not without bugs...
Here is my code:
pawn Код:
public Nuke()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(i,X,Y,Z);
CreateExplosion(X,Y,Z,6,1000000);
CreateExplosion(X,Y,Z,6,1000000);
SetTimer("Nend",5000,0);
SendClientMessageToAll(COLOR_RED,"The nuclear bomb has been exploded!");
return 1;
}
return 1;
}
return 1;
}
pawn Код:
if (PlayerKills[killerid] == 30)
{
SendClientMessage(killerid,COLOR_RED,"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;
}
}
}
}
return 1;
}
pawn Код:
dcmd_nuke(playerid,params[])
{
#pragma unused params
SetTimer("Nuke",10000,0);
SendClientMessageToAll(COLOR_RED,"Nuclear Bomb has been activated!");
SendClientMessageToAll(COLOR_RED,"The bomb goes off in 10 seconds!");
NC[playerid] = 0;
return 1;
}
Re: Nuke for 30 kill streak -
CAR - 06.07.2010
I think this will work
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerKills[killerid]++;
if (PlayerKills[killerid] == 30)
{
SendClientMessage(killerid,COLOR_RED,"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;
}
return 1;
}
pawn Код:
dcmd_nuke(playerid,params[])
{
#pragma unused params
if(PlayerKills[playerid] >= 30) // if kills is 30 or more
{
SetTimer("Nuke",10000,0);
SendClientMessageToAll(COLOR_RED,"Nuclear Bomb has been activated!");
SendClientMessageToAll(COLOR_RED,"The bomb goes off in 10 seconds!");
NC[playerid] = 0;
}
return 1;
}
Re: Nuke for 30 kill streak -
Andy_McKinley - 06.07.2010
@ the 2nd one, that's no kill streak I think, is it.
Re: Nuke for 30 kill streak -
Vince - 06.07.2010
That'll do, but you'll have to reset the variable (PlayerKills) to 0 when the player himself dies.
Re: Nuke for 30 kill streak -
DJBluefader - 06.07.2010
pawn Код:
if(killerid == INVALID_PLAYER_ID) {
PlayerKills[playerid] = 0;
} else {
PlayerKills[killerid]++;
PlayerKills[playerid] = 0;
}