Stopping a timer before it ends
#1

Ok, so i have a timer for voting, i want it so that if that the vote has been favored before the timer actually comes to it's end that it ends and calls the function.

what i basically got

Код:
new timer;
The thing is i don't see a way i can just kill the timer and have it call the correct function straight after. This is because i have one timer that can call multiple functions.
example:
Код:
timer = SetTimer("vote1",20000,false);
timer = SetTimer("vote2",20000,false);
So anyone have an idea on how i could kill the timer but still call the function, just sooner?
Reply
#2

Uhm, you could just add KillTimer at the top of your timer function, and just call it whenever you want. Or even better, use y_timers
Reply
#3

yeah i wish it were that simple, The timer calls multiple functions.
Lets say a player /votes, in the command for the player voting i check to see if more than half the online players have voted yes or no on the options. If more than half have id kill the timer 'timer'. then what am i supposed to do, i can't call the function that the timer was going to call because i don't know how to detect what timer a function was going to call.

Im basically asking if you know of a way to end a timer early but without killing it so that it still has an effect
Reply
#4

I don't really get what you mean - can you provide all the relevant code?

To call timerfunctions instantly just use CallLocalFunction or simply type it out (e.g. " vote1(); ")
Reply
#5

vote1 is the function i want to be called by the timer. If the timer can call multiple functions how do i clarify what function i want it to call if i kill it?

Anyways fixed. Thanks for trying to help
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
For reference, you can't have a single variable store the handles for multiple timers like in the first post.
It's a vote variable. Only one vote can be called at once so it only handles one timer at a time and works perfectly
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)