I could use some help I have a Derma menu all set up but I want to be able to spawn entity when
a Derma button also I want the players to own the entity and be able to move it around with there phys-guns
Thanks for all you help
try something like this in it
[code]util.AddNetworkString("Spawn prop")
net.Receive("Spawn prop", function( len, ply )
local prop = ents.Create( "prop_physics" )
prop:SetModel( "models/props_phx/cannonball_solid.mdl" )
prop:SetPos( ply:GetEyeTrace().HitPos )
prop:Spawn()
end )[/code]
[QUOTE=tomis13lack2;47536210]try something like this in it
[code]util.AddNetworkString("Spawn prop")
net.Receive("Spawn prop", function( len, ply )
local prop = ents.Create( "prop_physics" )
prop:SetModel( "models/props_phx/cannonball_solid.mdl" )
prop:SetPos( ply:GetEyeTrace().HitPos )
prop:Spawn()
end )[/code][/QUOTE]
My bad I want to spawn things out of the entities tab not props
[QUOTE=LosttSpacee;47536415]My bad I want to spawn things out of the entities tab not props[/QUOTE]
You could easily modify that for entities.
Note the call to ents.Create().
Clientside, inside the button:
[CODE]net.Start("SpawnRequest")
net.WriteString("Soldier")
net.SendToServer()[/CODE]
Serverside:[CODE]
util.AddNetworkString( "SpawnRequest" )
net.Receive( "SpawnRequest", function( length, client )
local data = net.ReadString()
if data == "Soldier" then SpawnCombineS(client:GetEyeTraceNoCursor().HitPos+Vector(0,0,30)) end
end
function SpawnCombineS( pos )
NPC = ents.Create( "npc_combine_s" )
NPC:SetKeyValue("NumGrenades", "2")
NPC:SetPos( pos )
NPC:SetKeyValue( "ignoreunseenenemies", 0 )
NPC:SetKeyValue( "spawnflags", 512 )
NPC:Spawn()
end
[/CODE]
That's how I do it.
For the players to own the prop, you could set a variable or NWString in the prop that is the player's name, for example, and check it whenever you want to know the prop's owner.
[QUOTE=Eddlm;47539110]Clientside, inside the button:
[CODE]net.Start("SpawnRequest")
net.WriteString("Soldier")
net.SendToServer()[/CODE]
Serverside:[CODE]
util.AddNetworkString( "SpawnRequest" )
net.Receive( "SpawnRequest", function( length, client )
local data = net.ReadString()
if data == "Soldier" then SpawnCombineS(client:GetEyeTraceNoCursor().HitPos+Vector(0,0,30)) end
end
function SpawnCombineS( pos )
NPC = ents.Create( "npc_combine_s" )
NPC:SetKeyValue("NumGrenades", "2")
NPC:SetPos( pos )
NPC:SetKeyValue( "ignoreunseenenemies", 0 )
NPC:SetKeyValue( "spawnflags", 512 )
NPC:Spawn()
end
[/CODE]
That's how I do it.
For the players to own the prop, you could set a variable or NWString in the prop that is the player's name, for example, and check it whenever you want to know the prop's owner.[/QUOTE]
Thank you so much I was still having a bit of trouble but you helped a ton!
Sorry, you need to Log In to post a reply to this thread.