Killingspree system
#1

Hello guys , i've got a killing spree system
I created it using a stock function
But the problem is when i add the killing spree under OnPlayerDeath
It stops anycode below it , means onplayerdeath responds untill this part

pawn Код:
// Code here responds
KillingSpree(killerid); // my killing spree stock
// Code her and all under it doesn't work
How to let the code under killing spree work then?
Reply
#2

Does your stock return the function?

pawn Код:
return 1;
Reply
#3

yes it had return1; and didn't work
Removed the return1; and still doesn't respond.
Reply
#4

You didn't have to remove the return 1; it would still continue if the stock returns a value.

Show your stock codes!
Reply
#5

oke
pawn Код:
stock KillingSpree(killerid)
{
    new p_Name[24],str[128],Float:kHealth;
    new kHP=GetPlayerHealth(killerid,kHealth);
    GetPlayerName(killerid,p_Name,24);
    KillingSpreeCount[killerid]++;
    switch(KillingSpreeCount[killerid])
    {
        case 2:
        {
            if(kHP >=91 && kHP<=100)
            {
                GivePlayerMoney(killerid,200);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 200$");
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is on a double kill!(2 Kills)",p_Name);
                SendClientMessageToAll(COLOR_GREEN,str);
            }
            else
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is on a double kill!(2 Kills)",p_Name);
                SetPlayerHealth(killerid,kHP+10);
                GivePlayerMoney(killerid,200);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : +10 HP ");
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : +200$ Bonus");
                SendClientMessageToAll(COLOR_GREEN,str);
            }
        }
        case 3:
        {
            if(kHP >=91 && kHP<=100)
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is on a triple kill!(3 Kills)",p_Name);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 400$ Bonus!");
                SendClientMessageToAll(COLOR_GREEN,str);
                GivePlayerMoney(killerid,400);
                SetPlayerHealth(killerid,kHP+10);
            }
            else
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is on a triple kill!(3 Kills)",p_Name);
                SetPlayerHealth(killerid,kHP+10);
                GivePlayerMoney(killerid,400);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : +10 HP Bonus!");
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 400$ Bonus!");
                SendClientMessageToAll(COLOR_GREEN,str);
            }
        }
        case 4:
        {
            if(kHP >=91 && kHP<=100)
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is Dominating!(4 Kills)",p_Name);
                GivePlayerMoney(killerid,600);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 600$ Bonus!");
                SendClientMessageToAll(COLOR_GREEN,str);
            }
            else
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is Dominating!(4 Kills)",p_Name);
                SetPlayerHealth(killerid,kHP+10);
                GivePlayerMoney(killerid,600);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : +10 HP Bonus!");
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 600$ Bonus!");
                SendClientMessageToAll(COLOR_GREEN,str);
            }
        }
        case 5:
        {
            if(kHP >=91 && kHP<=100)
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is UnStoppable!(5 Kills)",p_Name);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 1000$ Bonus!");
                SendClientMessageToAll(COLOR_GREEN,str);
                GivePlayerMoney(killerid,1000);
            }
            else
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is UnStoppable!(5 Kills)",p_Name);
                SetPlayerHealth(killerid,kHP+15);
                GivePlayerMoney(killerid,1000);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : +15 HP Bonus!");
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 1000$ Bonus!");
                SendClientMessageToAll(COLOR_GREEN,str);
            }
        }
        case 6:
        {
            if(kHP >=86 && kHP<=100)
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is UnBeatable!(6 Kills)",p_Name);
                GivePlayerMoney(killerid,1200);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 1200$ Bonus!");
                SendClientMessageToAll(COLOR_GREEN,str);
            }
            else
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is UnBeatable!(6 Kills)",p_Name);
                GivePlayerMoney(killerid,1200);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : +15 HP Bonus!");
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 1200$ Bonus!");
                SendClientMessageToAll(COLOR_GREEN,str);
            }
        }
        case 7:
        {
            if(kHP >=81 && kHP<=100)
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is UnBeatable!(7 Kills)",p_Name);
                GivePlayerMoney(killerid,1400);
            }
            format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is UnBeatable!(7 Kills)",p_Name);
            GivePlayerMoney(killerid,1400);
            SetPlayerHealth(killerid,kHP+20);
            SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : +20 HP Bonus!");
            SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 1400$ Bonus!");
            SendClientMessageToAll(COLOR_GREEN,str);
        }
        case 8:
        {
            if(kHP >=81 && kHP<=100)
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is Owning!(8 Kills)",p_Name);
                GivePlayerMoney(killerid,1400);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 1400$ Bonus!");
                SendClientMessageToAll(COLOR_GREEN,str);
            }
            else
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is Owning!(8 Kills)",p_Name);
                GivePlayerMoney(killerid,1400);
                SetPlayerHealth(killerid,kHP+20);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : +20 HP Bonus!");
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 1400$ Bonus!");
                SendClientMessageToAll(COLOR_GREEN,str);
            }
        }
        case 9:
        {
            if(kHP >=76 && kHP<=100)
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is Invincible !(9 Kills)",p_Name);
                GivePlayerMoney(killerid,1800);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 1800$ Bonus!");
                SendClientMessageToAll(COLOR_GREEN,str);
            }
            else
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is Invincible !(9 Kills)",p_Name);
                GivePlayerMoney(killerid,1800);
                SetPlayerHealth(killerid,kHP+25);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : +25 HP Bonus!");
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 1800$ Bonus!");
                SendClientMessageToAll(COLOR_GREEN,str);
            }
        }
        case 10:
        {
            if(kHP >=76 && kHP<=100)
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is a God of war !(10 Kills)",p_Name);
                GivePlayerMoney(killerid,2000);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 2000$ Bonus!");
                SendClientMessageToAll(COLOR_GREEN,str);
            }
            else
            {
                format(str,sizeof(str),"Killing Spree : "#COL_RED"%s is a God of war !(10 Kills)",p_Name);
                GivePlayerMoney(killerid,2000);
                SetPlayerHealth(killerid,kHP+25);
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : +25 HP Bonus!");
                SendClientMessage(killerid,COLOR_YELLOW,"Killing Spree : + 2000$ Bonus!");
                SendClientMessageToAll(COLOR_GREEN,str);
            }
        }
    }
    return 1;
}
Reply
#6

Hmm can I ask how did you know the codes below it doesn't get executed? Did you test it alone? Or were there someone testing it with you (Who killed you or you probably killed them)?

Because if you have it under OnPlayerDeath like this:

pawn Код:
KillingSpree(killerid);
while killerid is not connected (INVALID_PLAYER_ID) it would never execute the code after the killing spree function.

If what I said is true, then you can add this before doing any checks in your stock to get rid of this issue

pawn Код:
stock KillingSpree(killerid)
{
    if(!IsPlayerConnected(killerid)) // add this
        return 1; // and this
    // Your stock codes here
Reply
#7

Because there should a game text for player called after it but it didn't get called.

But thanks i'll try
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)