Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ShouldDropWeapon = true
- local function ToggleDropWeapon(ply)
- if ply:IsAdmin() then
- if ShouldDropWeapon then --Because ShouldDropWeapon is a bool, it'll be a true or false.
- --If true then
- ply:PrintMessage(HUD_PRINTNOTIFY, "Weapon drop disabled") --Tell us if it is enabled.
- ShouldDropWeapon = false
- else --Else do
- ply:PrintMessage(HUD_PRINTNOTIFY, "Weapon drop enabled")
- ShouldDropWeapon = true
- end
- end
- end
- concommand.Add( "player_dropweapon_toggle", ToggleDropWeapon) --Toggle usage of PlayerDropWeapon
- local function PlayerDropWeapon(ply)
- if ShouldDropWeapon and ply:GetActiveWeapon():IsValid()) then --If weapon dropping is enabled, and player's weapon is valid.
- ply:DropWeapon(ply:GetActiveWeapon()) --Drop active weapon
- end
- end
- hook.Add("DoPlayerDeath", "Player.DropWeapon", PlayerDropWeapon)
- concommand.Add( "player_dropweapon", PlayerDropWeapon) --Make user drop his weapon.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement