Starting Timers with 1-second difference
#1

So I have four 1-second timers that start on OnGameModeInit. I'm trying to make them start 1 second apart from each other. How would I be able to pull this off?
Reply
#2

1000 equals one second. Hence start one at 1000, the next at 2000 and the other at 3000? That should be exactly what you're looking for
Reply
#3

How would I do that script-wise?

Edit: Is it safe to use this: https://sampwiki.blast.hk/wiki/Useful_Functions#Wait
Reply
#4

show me the lines that you have for your timers..
Reply
#5

Код:
myTimers[0] = SetTimer("serverLoops", 1000, true);
myTimers[1] = SetTimer("playerLoops", 1000, true);
myTimers[2] = SetTimer("dbLoops", 1000, true);
myTimers[3] = SetTimer("miscLoops", 1000, true);
Reply
#6

Код:
myTimers[0] = SetTimer("serverLoops", 1000, true);
myTimers[1] = SetTimer("playerLoops", 2000, true);
myTimers[2] = SetTimer("dbLoops", 3000, true);
myTimers[3] = SetTimer("miscLoops", 4000, true);
They will all start one second apart from each other now.
Reply
#7

You just changed the interval though, not the actual starting time.
Reply
#8

And what would be the use of that, just that they still overlap each second afterwards ?

Also the wait function hangs your whole server, so the timer wont proceed meanwhile
Reply
#9

Would 500-ms difference work better instead?
Reply
#10

Код:
SetTimer("serverLoops", 1000, true);

public serverLoops()
{
SetTimer("playerLoops", 1000, false);
}
and so on.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)