[code]
weapon=ents.Create("weapon_physgun")
weapon:SetPos(Vector(805.244568,1765.582520,159.906982))
weapon:Spawn()
[/code]
So I put this in my gamemode's init file, the server just wont load.
I put it in lua/autorun/server same thing.
Is there a certain way I should put this?
Wait so the server won't load? Like it won't even start up? I highly doubt that's caused by that code if that's what you did. Are you saying it works if you take that code out?
[QUOTE=Chimpanzee;45723590]Wait so the server won't load? Like it won't even start up? I highly doubt that's caused by that code if that's what you did. Are you saying it works if you take that code out?[/QUOTE]
I put it in, server wont load. I take it out, server loads. I covered this.
[QUOTE=Frozendairy;45723845]I put it in, server wont load. I take it out, server loads. I covered this.[/QUOTE]
You never said if you actually tried to take it out or not. You'd be surprised how many people don't.
Either way, you could try something like this
[lua]
hook.Add( "InitPostEntity", "SpawnPhysgun", function ()
local ent = ents.Create("weapon_physgun")
ent:SetPos( Vector(805.244568, 1765.582520, 159.906982) )
ent:SetAngles( Angle(0, 0, 0) ) -- probably not needed
ent:Spawn()
ent:DropToFloor()
end
[/lua]
[QUOTE=Chimpanzee;45723937]You never said if you actually tried to take it out or not. You'd be surprised how many people don't.
Either way, you could try something like this
[lua]
hook.Add( "InitPostEntity", "SpawnPhysgun", function ()
local ent = ents.Create("weapon_physgun")
ent:SetPos( Vector(805.244568, 1765.582520, 159.906982) )
ent:SetAngles( Angle(0, 0, 0) ) -- probably not needed
ent:Spawn()
ent:DropToFloor()
end
[/lua][/QUOTE]
The "InitPostEntity" hook, does this work on the client code as well? When the client itself loaded everything?
[code]
[ERROR] lua/autorun/ents.lua:7: ')' expected (to close '(' at line 1) near '<eof>'
1. unknown - lua/autorun/ents.lua:0
[/code]
This is what I got, and just copy and pasted what you said.
[QUOTE=Frozendairy;45743355][code]
[ERROR] lua/autorun/ents.lua:7: ')' expected (to close '(' at line 1) near '<eof>'
1. unknown - lua/autorun/ents.lua:0
[/code]
This is what I got, and just copy and pasted what you said.[/QUOTE]Your getting that error because he forgot a closing parentheses in his code on the last line. This should work, I just added the missing bracket:
[CODE]
hook.Add( "InitPostEntity", "SpawnPhysgun", function ()
local ent = ents.Create("weapon_physgun")
ent:SetPos( Vector(805.244568, 1765.582520, 159.906982) )
ent:SetAngles( Angle(0, 0, 0) ) -- probably not needed
ent:Spawn()
ent:DropToFloor()
end )
[/CODE]
Sorry, you need to Log In to post a reply to this thread.