• Spawning Entity on Server Start
    1 replies, posted
So say I have an entity that works fine if you spawn it from the Entities tab in Spawnmenu, how would I go about making it spawn correctly whenever the server its on starts? The entity is in addon format and the angles and positions are all set in the entity files itself, I just need to know how to spawn the entity at server start. I've tried putting a file in lua/autorun of the addon folder: [lua] function SpawnScoreboard() local ent = ents.Create( "LuaScoreboard" ) ent:SetNWString("Owner", "World") ent:Spawn() end hook.Add("InitPostEntity", "SpawnScoreboard", SpawnScoreboard) [/lua] But no success. All it does is spawn me the entity in the wrong place at the wrong angles, and I get errors from deep within the draw functions. This should be very simple but somehow I'm not getting it, your help is appreciated :3
[lua] local function SpawnScoreboard() local ent = ents.Create( "LuaScoreboard" ) ent:SetPos(Vector(0,0,100)) // Use "getpos" in console to find a position ent:SetAngles(Angle(0,0,0)) ent:SetNWString("Owner", "World") ent:Spawn() ent:Activate() end hook.Add("InitPostEntity", "SpawnScoreboard", SpawnScoreboard) [/lua] You'll need to add in the rest
Sorry, you need to Log In to post a reply to this thread.