Restriction

How can I make some sort of function where the player can’t change weapons during some action?

example?

This
**[Player.SelectWeapon

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Player.SelectWeapon)**

Or this
**[Gamemode.PlayerBindPress

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.PlayerBindPress)**

No I mean to prevent him from switching, not to switch.

I suggest using it in the swep on Primary attack or something.

[lua]
local yourtime = 1.5
if tostring( self.Owner:HasWeapon(“weapon_yourwep”) ) and CurTime() < yourtime then
self.Owner:SelectWeapon( “weapon_yourwep” )
yourtime = CurTime() + 1
return false
else
–code to fire here when charged
return true
end
[/lua]

Or something like that anyway.

Which can very well be done with either of those.