Advertisement
Guest User

Untitled

a guest
Jun 5th, 2011
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. local ShouldDropWeapon = true
  2.  
  3. local function ToggleDropWeapon(ply)
  4. if ply:IsAdmin() then
  5. if ShouldDropWeapon then --Because ShouldDropWeapon is a bool, it'll be a true or false.
  6. --If true then
  7. ply:PrintMessage(HUD_PRINTNOTIFY, "Weapon drop disabled") --Tell us if it is enabled.
  8. ShouldDropWeapon = false
  9. else --Else do
  10. ply:PrintMessage(HUD_PRINTNOTIFY, "Weapon drop enabled")
  11. ShouldDropWeapon = true
  12. end
  13. end
  14. end
  15. concommand.Add( "player_dropweapon_toggle", ToggleDropWeapon) --Toggle usage of PlayerDropWeapon
  16.  
  17. local function PlayerDropWeapon(ply)
  18. if ShouldDropWeapon and ply:GetActiveWeapon():IsValid()) then --If weapon dropping is enabled, and player's weapon is valid.
  19. ply:DropWeapon(ply:GetActiveWeapon()) --Drop active weapon
  20. end
  21. end
  22. hook.Add("DoPlayerDeath", "Player.DropWeapon", PlayerDropWeapon)
  23. concommand.Add( "player_dropweapon", PlayerDropWeapon) --Make user drop his weapon.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement