Gamemode.Think

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameThink
SyntaxGM:Think( )
DescriptionCalled every frame
ReturnsNil
Lua StateNewerShared.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.Think]Gamemode.Think [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Example

DescriptionPrints a line of text every second.
Used onNewerShared.png
Code
 
local NextPrintTime = 0
function SecondPrint()
    if (CurTime() >= NextPrintTime) then
        Msg("This is printed every second\n")
        NextPrintTime = CurTime() + 1
    end
end
hook.Add("Think", "SecondPrint", SecondPrint)
 
OutputN/A


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox