-
Notifications
You must be signed in to change notification settings - Fork 23
Timers for plugins
Plugin timers provide a self contained timer system where you do not need to worry about removing timers when the plugin is disabled.
Note
Timers are not available in the prediction VM.
To create a normal plugin timer, use:
Plugin:CreateTimer( Name, Delay, Reps, Func )
where the arguments are the same as for Shine.Timer.Create
. Also, the name will be internally prefixed with the plugin's name, so you only need to keep names unique inside the plugin itself.
To create a simple timer, use:
Plugin:SimpleTimer( Delay, Func )
where the arguments are the same as for Shine.Timer.Simple
.
To destroy a timer, use:
Plugin:DestroyTimer( Name )
where Name
is the name you passed to Plugin:CreateTimer()
.
To pause/resume timers, use:
Plugin:PauseTimer( Name )
Plugin:ResumeTimer( Name )
Finally, to check for a timer's existence, use:
Plugin:TimerExists( Name )
The base class cleanup function is responsible for cleaning up timers when the plugin is disabled. If you want to destroy all timers yourself, use:
Plugin:DestroyAllTimers()
Note that this destroys both normal and simple timers.