timer.Start

From GMod Wiki

Jump to: navigation, search
Function
Syntax timer.Start( String Name )
Where is this used?
Description:
(Re)starts a timer by Name. Returns false if the given timer didn't exist, true otherwise.
Returns: Boolean
Part of Library: Timer
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Timer.Start]Timer.Start [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionCreates a timer, stops then restarts it again.
Used onNewerShared.png
Code
 
timer.Create("MyTimer", 1, 1, Msg, "Hello World")
 
timer.Stop("MyTimer") //returns true and timer is now stopped
timer.Stop("MyTimer") //returns false because timer is already stopped
 
timer.Start("MyTimer") //returns true and timer is restarted.
 
OutputN/A


DescriptionCreates a timer, lets it die naturally and then starts it again.
Used onNewerShared.png
Code
 
timer.Create("MyTimer", 1, 1, Msg, "Timer has expired!")
timer.Simple(2,timer.Start,"MyTimer")
 
Output
Timer has expired!
Timer has expired!

Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox