Bitl

Bitl's Garry's Mod SWEP Base - Melee Weapons

Aug 6th, 2013
543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.63 KB | None | 0 0
  1. --BITL'S SWEP BASE 2013: Melee Weapons
  2.  
  3. SWEP.Category               = "Bitl's SWEPS"
  4. SWEP.PrintName              = "A SWEP"         
  5. SWEP.Author                 = Bitl"
  6. SWEP.Instructions           = ""
  7. SWEP.Spawnable              = true
  8. SWEP.AdminOnly              = false
  9. SWEP.Primary.ClipSize       = -1
  10. SWEP.Primary.DefaultClip    = -1
  11. SWEP.Primary.Automatic      = true
  12. SWEP.Primary.Ammo           = "None"
  13. SWEP.Secondary.ClipSize     = -1
  14. SWEP.Secondary.DefaultClip  = -1
  15. SWEP.Secondary.Automatic    = false
  16. SWEP.Secondary.Ammo         = "None"
  17. SWEP.Weight                 = 3
  18. SWEP.AutoSwitchTo           = false
  19. SWEP.AutoSwitchFrom         = false
  20. SWEP.Slot                   = 0
  21. SWEP.SlotPos                = 4
  22. SWEP.DrawAmmo               = false
  23. SWEP.DrawCrosshair          = true
  24. SWEP.ViewModel              = "models/weapons/v_crowbar.mdl"
  25. SWEP.WorldModel             = "models/weapons/w_crowbar.mdl"
  26.  
  27. function SWEP:Initialize()
  28.  
  29.     self:SetWeaponHoldType( "melee" )
  30.  
  31. end
  32.  
  33. function SWEP:PrimaryAttack()
  34.    
  35.     self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
  36.    
  37.     local trace = self.Owner:GetEyeTrace();
  38.     if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 75 then
  39.             self.Owner:SetAnimation( PLAYER_ATTACK1 );
  40.             self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER );
  41.                 bullet = {}
  42.                 bullet.Num    = 1
  43.                 bullet.Src    = self.Owner:GetShootPos()
  44.                 bullet.Dir    = self.Owner:GetAimVector()
  45.                 bullet.Spread = Vector(0, 0, 0)
  46.                 bullet.Tracer = 0
  47.                 bullet.Force  = 1
  48.                 bullet.Damage = 25
  49.             self.Owner:FireBullets(bullet)
  50.             self.Weapon:EmitSound("Weapon_Crowbar.Melee_Hit")          
  51.     else
  52.         self.Owner:SetAnimation( PLAYER_ATTACK1 );
  53.         self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER );
  54.         self.Weapon:EmitSound("Weapon_Crowbar.Single")
  55.     end
  56.    
  57.     self.Weapon:SetNextPrimaryFire( CurTime() + 0.43 )
  58. end
Advertisement
Add Comment
Please, Sign In to add comment