Timers are not killing!
#1

You do not know how annoyed I am at this. I've tried everything to sort this out and nothing has worked.

basically when the player dies the timer is not stopping. Please check the code and tell me how to fix this!

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    GameTextForPlayer(playerid,"~w~Wasted",3000,2);
    SendDeathMessage(killerid, playerid, reason);
    PlayerInfo[playerid][Dead] = 1;
    KillTimer(killwepdep);
    KillTimer(killbank);
    KillTimer(killhospital);
    return 1;
}
And the timers that are defined

pawn Код:
killwepdep = SetTimerEx("WepDep", 300000, false,"i",playerid);//It's the same for the other 2
Reply
#2

Is the "OnPlayerDeath" callback being called?
Reply
#3

How do you mean, I thought it automatically called when you died?
Reply
#4

You need to store the timer into an array. The way it is now, it's storing the timer for every player in one variable so that's the reason for your problems.

pawn Код:
new killwepdep[MAX_PLAYERS]; //Top of script

KillTimer(killwepdep[playerid]); //Kill only the player's timer

killwepdep[playerid] = SetTimerEx("WepDep", 300000, false,"i",playerid);//Store the player's timer in the array.
Reply
#5

Thank you so much! I wish I could give you 1000 Rep :L. Thanks again!
Reply
#6

No problem haha
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)