Stopping timer and starting timer with the same duration
#1

I can't think of using SetTimerEx & SetTimer as stopping a timer and starting it again with the same duration as I stopped. How do I do that, or if someone gives me an idea on how to do it?
Reply
#2

Well just a small idea came up to my mind not sure if it's good or not, create a variable then start every one second increase it (when the timer starts) (+1) when the timer stops, stop increasing when you wanna start another timer.
SetTimer("timer",var*1000,false/true);
Reply
#3

I'm not quite sure what your goal is but it seems like you want to stop a timer and restart it:

pawn Код:
new tHandle = SetTimerEx(...);

// Restarting

KillTimer(tHandle);
tHandle = SetTimerEx(...);
Reply
#4

1. Upon SetTimerEx, store GetTickCount() in a variable, e.g. initTime
2. Upon KillTimer, set initTime to GetTickCount()-initTime
3. Upon the next SetTimerEx, just use SetTimerEx(x, interval-initTime, ...);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)