Gamemode.InitPostEntity

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameInitPostEntity
SyntaxGM:InitPostEntity( )
DescriptionSimilar to Gamemode.Initialize, but called after the gamemode and map load and start.
ReturnsNil
Lua StateNewerShared.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.InitPostEntity]Gamemode.InitPostEntity [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Example

DescriptionTriggers "logic_relay" entities named "logic_map_start" when the map loads.
Used onNewerShared.png
Code
local function Init_TriggerLogic()
	if SERVER then
		for _, ent in ipairs( ents.FindByName( "logic_map_start" ) ) do
			if ( ent:GetClass() == "logic_relay" ) then
				ent:Fire( "trigger", 0, 0 )
			end
		end
	end
end
hook.Add( "InitPostEntity", "MapStartTrigger", Init_TriggerLogic )
OutputN/A


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox