What are the necessary motions that you need to go through in order to simulate a player spawning a prop from the spawn menu?
Here is what I have so far;
local model = self.Owner:GetNWString( "spawn_selection" ) -- this is set at another point in the program if model ~= "" then local prop = ents.Create( "prop_physics" ) if not IsValid( prop ) then return end prop:SetModel( model ) prop:SetPos( self.Owner:EyePos() + (self.Owner:GetAimVector() * 48) ) prop:SetAngles( self.Owner:GetAimVector():Angle() ) prop:SetOwner( self.Owner ) prop:Spawn() end
It sort of spawns the prop, but players can’t interact with it and you can’t undo it. Also, if you couldn’t tell, this code is from a SWEP.
What lines do I need to add to make it spawn properly?