Spawning with Physicsgun/Toolgun/Camera

Can someone give me a hook or an addon or something that makes it so when players spawn, they don’t have the physics gun, toolgun, and camera.

What gamemode?
And isn’t it just like this, in init.lua?

(not exactly like this )
[lua]
if ply:Team == team1 then
ply:Give(“weapons here”)
[/lua]

You would probably be able to find that in any gmaemode.

With or Without?

The title says With.

-snip-
I read the post wrong.

Without.

And its just for sandbox.

I know enough lua to know where to edit if it was as simple as removing a ply:give code.
I just need the code for removing the weapons, I can’t get it to apply to every player as they spawn.

Would this work?

hook.Add( “PlayerSpawn”, “Remove”, function( ply )
ply:StripWeapon(“weapon_physgun”)
ply:StripWeapon(“gmod_tool”)
ply:StripWeapon(“gmod_camera”)
end )

for k, v in pairs( player.GetAll() ) do
v:StripWeapon(“weapon_physgun”)
v:StripWeapon(“gmod_tool”)
V:StripWeapon(“gmod_camera”)
end

Just a quick guess but there’s no harm in trying it. In theory it looks like it should work ^.^

Also this goes into the ‘shared’ file somewhere

Is that with the hook.Add( “PlayerSpawn”, “Remove”, function( ply )?

or just standalone

[lua]function GM:PlayerSpawn( ply )
ply:StripWeapons()
end

hook.Add( “PlayerSpawn”, “PlayerTakeWeapons”, playerRespawn )[/lua]

Untested. I might’ve messed up the hook.Add.

You already hook it by assigning it to the Gamemode table, no need to hook again.

Also the last argument of hook.Add is the function name, and I don’t know where you got playerRespawn from.

Well, Heres something that will get the job done anyway.



function NoToolsOnSpawn(ply)
timer.Simple(0.1, function() -- Lets call this a little later than default loadout, Just incase.
if ValidEntity(ply) then
ply:StripWeapon("weapon_physgun")
ply:StripWeapon("gmod_tool")
ply:StripWeapon("gmod_camera")
end
end)
end
hook.Add("PlayerSpawn","NoToolsSpawnHook",NoToolsOnSpawn)

Oh, I see. Thanks for the feedback.

Thanks. I have been looking for this for a long time, after a while I just decided to request it.

Glad i could help.