I created a relatively simple entity spawning script but, it's having issues with spawning since addons are loaded after this script is ran.
I put this in the [B]autorun/server[/B] directory of lua
[CODE]
hook.Add( "PostGamemodeLoaded", "SpawnPiano", function()
local ent = ents.Create( [[gmt_instrument_piano]] )
ent:GetPhysicsObject():EnableMotion( false )
ent:SetAngles( Angle(0, 140, 0) )
ent:SetPos( Vector( -154, 100, 17.5 ) )
ent:Spawn()
end)
[/CODE]
Is there anything else called after PostGamemodeLoaded?
Call it plainly in an addon file without a hook after the entity has been created
Use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/InitPostEntity]GM/InitPostEntity[/url] for entity spawning
And don't use the square brackets for a string, just use "double quotes" or 'single quotes'.
[QUOTE=figglesticks;47598408]And don't use the square brackets for a string, just use "double quotes" or 'single quotes'.[/QUOTE]
There's nothing wrong with using square brackets.
Sorry, you need to Log In to post a reply to this thread.