kill spree help - 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: kill spree help (
/showthread.php?tid=273915)
kill spree help -
tanush - 03.08.2011
im trying to make a killing spree it shows on chat but it wont show for some reason. i put this onplayerdeath
pawn Код:
new name[MAX_PLAYER_NAME],str[128];
GetPlayerName(killerid,name,sizeof(name));
if(spree[killerid] == 0)
{
spree[killerid] = 1;
}
else if(spree[killerid] == 1)
{
spree[killerid] = 2;
}
else if(spree[killerid] == 2)
{
spree[killerid] = 3;
}
else if(spree[killerid] == 3)
{
spree[killerid] = 4;
}
else if(spree[killerid] == 4)
{
spree[killerid] = 5;
format(str,sizeof(str),"%s is in a 5 Kill Spree!!!!",name);
}
else if(spree[killerid] == 5)
{
spree[killerid] = 6;
}
else if(spree[killerid] == 6)
{
spree[killerid] = 7;
}
else if(spree[killerid] == 7)
{
spree[killerid] = 8;
}
else if(spree[killerid] == 8)
{
spree[killerid] = 9;
}
else if(spree[killerid] == 9)
{
spree[killerid] = 10;
format(str,sizeof(str),"%s is in a 10 Kill Spree!!!!",name);
}
Re: kill spree help -
Mean - 03.08.2011
This code is very inefficient, you only need:
pawn Код:
new name[MAX_PLAYER_NAME],str[128];
GetPlayerName(killerid,name,sizeof(name));
spree[ killerid ] ++;
switch( spree[ killerid ] ) {
case 5: format(str,sizeof(str),"%s is in a 5 Kill Spree!!!!",name);
case 10: format(str,sizeof(str),"%s is in a 10 Kill Spree!!!!",name);
}
SendClientMessageToAll( -1, str );
Also, you might want to add this somewhere in OnPlayerDeath:
pawn Код:
if( playerid != INVALID_PLAYER_ID )
spree[ playerid ] = 0;
To reset your killing spree when you die.
Re: kill spree help -
tanush - 04.08.2011
thanks but when someone gets a kill it does a blank text on chat
Re: kill spree help -
MadeMan - 04.08.2011
pawn Код:
switch(spree[killerid])
{
case 5:
{
format(str,sizeof(str),"%s is in a 5 Kill Spree!!!!",name);
SendClientMessageToAll( -1, str );
}
case 10:
{
format(str,sizeof(str),"%s is in a 10 Kill Spree!!!!",name);
SendClientMessageToAll( -1, str );
}
}