kill spree help
#1

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);
    }
Reply
#2

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.
Reply
#3

thanks but when someone gets a kill it does a blank text on chat
Reply
#4

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 );
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)