I have no idea how to spawn an entity. I am not talking through the q menu. I wan to click a button and a entity spawns. Yes you can spawn the entity I made through the q menu.
function MBspawnfunc( ply, tr, ClassName )
if ( !tr.Hit ) then return end
ClassName = "ent_mailbox"
local SpawnPos = tr.HitPos + tr.HitNormal * 16
local ent = ents.Create( ClassName )
ent:SetPos( SpawnPos )
ent:SetBallSize( math.random( 16, 48 ) )
ent:Spawn()
ent:Activate()
-- ply:SetNWInt("mailboxes", 1)
return ent
end
net.Receive( "spawn_mail_box", MBspawnfunc)
This is what I have so far, what is wrong with it?. Should I make a hook.
When player clicks on the button, he should send net message to the server, and then, on the server-side,server should get that message and then spawn an entity.
Sorry, you need to Log In to post a reply to this thread.