SA-MP Forums Archive
Timers are not killing! - 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: Timers are not killing! (/showthread.php?tid=268263)



Timers are not killing! - cloudysky - 11.07.2011

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



Re: Timers are not killing! - Scenario - 11.07.2011

Is the "OnPlayerDeath" callback being called?


Re: Timers are not killing! - cloudysky - 11.07.2011

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


Re: Timers are not killing! - PotH3Ad - 11.07.2011

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.



Re: Timers are not killing! - cloudysky - 11.07.2011

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


Re: Timers are not killing! - PotH3Ad - 11.07.2011

No problem haha