About timers - 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)
+--- Thread: About timers (
/showthread.php?tid=418663)
About timers -
Colossus874 - 25.02.2013
Hello, I was just wondering if anyone of you could explain if I should use SetTimer or SetTimerEx and why? I am making a death system and later on a level system but I want the method that gives the least lag.. And under which callback should I put it or should it exist in the timers callback?
Re: About timers -
Misiur - 25.02.2013
It depends on your situation. Usually you use timers to check something periodically, but you don't want to put it in OnPlayerUpdate, or to delay some action.
Re: About timers -
Colossus874 - 25.02.2013
Well my death system works like this: When the player dies the position is saved and a variable named pDeath is set to 1. Then OnPlayerSpawn the player will spawn on the death place if pDeath is 1. Then I want a timer to count down to 0 so that the player respawns. Should the timer be started when the player dies or should it always be going, checking if any players pDeath is 1?
Re: About timers -
Colossus874 - 25.02.2013
Quote:
Originally Posted by ******
They are exactly the same in terms of use - just the latter one has more parameters. As for "lag", you can't possibly be concerned that the code is slow because you haven't even written it yet!
|
I don't want you to write the whole script for me, but could you breifly explain how you would do this? I mean, so that I can learn right form the beginning.