Advertisement
CapsAdmin

Untitled

Mar 24th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.98 KB | None | 0 0
  1. easylua.StartWeapon("weapon_barcrow")
  2.  
  3. SWEP.Base = "weapon_base"
  4. SWEP.PrintName = "BARCROW"
  5.  
  6. SWEP.Slot = 0
  7. SWEP.SlotPos = 0
  8.  
  9. SWEP.DrawWeaponInfoBox = false
  10. SWEP.ViewModel = "models/weapons/v_crowbar.mdl"
  11. SWEP.WorldModel = "models/weapons/w_crowbar.mdl"
  12. SWEP.ViewModelFOV = 54
  13.  
  14. SWEP.Primary.ClipSize = -1
  15. SWEP.Primary.DefaultClip = -1
  16. SWEP.Primary.Automatic = true
  17. SWEP.Primary.Ammo = "none"
  18.  
  19. SWEP.Secondary.ClipSize = -1
  20. SWEP.Secondary.DefaultClip = -1
  21. SWEP.Secondary.Automatic = false
  22. SWEP.Secondary.Ammo = "none"
  23.  
  24. SWEP.SwingSound = "Weapon_Crowbar.Single"
  25. SWEP.HitSound = "Weapon_Crowbar.Melee_Hit"
  26.  
  27. SWEP.HoldType = "melee"
  28.  
  29. SWEP.Delay = 0.4
  30. SWEP.Range = 75
  31. SWEP.Damage = 25
  32.  
  33. SWEP.ActivityTranslateAI =
  34. {
  35.     [ACT_STAND] = ACT_IDLE_MELEE,
  36.     [ACT_IDLE_ANGRY] = ACT_IDLE_ANGRY_MELEE,
  37.     [ACT_MP_RUN] = ACT_HL2MP_RUN_MELEE,
  38.     [ACT_MP_CROUCHWALK] = ACT_HL2MP_WALK_CROUCH_MELEE,
  39.     [ACT_MELEE_ATTACK1] = ACT_MELEE_ATTACK1,
  40.     [ACT_RELOAD] = ACT_RELOAD,
  41. }
  42.  
  43. function SWEP:Initialize()
  44.     self:SetWeaponHoldType(self.HoldType)
  45. end
  46.  
  47. function SWEP:PrimaryAttack()
  48.  
  49.     local owner = self.Owner
  50.     local forward = owner:GetAimVector()
  51.        
  52.     local trace = {}
  53.         trace.start = owner:EyePos()
  54.         trace.endpos = owner:EyePos() + (forward * self.Range)
  55.         trace.filter = {owner}
  56.        
  57.         trace.mins = Vector(1, 1, 1) * -8
  58.         trace.maxs = Vector(1, 1, 1) * 8   
  59.     trace = util.TraceHull(trace)
  60.    
  61.     local ent = trace.Entity
  62.    
  63.     if SERVER and ent:IsValid() and ent:IsPlayer() and ent:GetInfo("cl_dmg_mode") ~= "3" then
  64.         self:SetNextPrimaryFire(CurTime() + self.Delay)
  65.         return false
  66.     end
  67.        
  68.     if trace.Hit then      
  69.         if SERVER and not trace.HitWorld and ent:IsValid() then
  70.        
  71.             local params = DamageInfo()
  72.                 params:SetAttacker(owner)
  73.                 params:SetInflictor(self)
  74.                 params:SetDamage(self.Damage)
  75.                 params:SetDamageForce(forward * self.Damage * 700)
  76.                 params:SetDamagePosition(trace.HitPos)
  77.                 params:SetDamageType(DMG_SLASH)
  78.             ent:TakeDamageInfo(params)
  79.            
  80.             if ent:GetPhysicsObject():IsValid() then
  81.                 ent:SetPhysicsAttacker(self.Owner)
  82.             end
  83.         end
  84.        
  85.         self:SendWeaponAnim(ACT_VM_HITCENTER)
  86.         self:EmitSound(self.HitSound)
  87.     else
  88.         self:SendWeaponAnim(ACT_VM_MISSCENTER)
  89.         self:EmitSound(self.SwingSound)
  90.     end    
  91.    
  92.     self:SetNextPrimaryFire(CurTime() + self.Delay)
  93.     self.Owner:SetAnimation(PLAYER_ATTACK1)
  94. end
  95.  
  96. function SWEP:SecondaryAttack()
  97.     return false
  98. end
  99.  
  100. function SWEP:DrawWeaponSelection(x,y,w,t,a)
  101.     draw.SimpleText("c", "TitleFont2", x + w / 2, y, Color(255, 255, 255, a), TEXT_ALIGN_CENTER)
  102. end
  103.  
  104. function SWEP:DrawWeaponSelection(x, y, wide, tall, alpha)
  105.     surface.SetDrawColor( color_transparent )
  106.     surface.SetTextColor( 255, 220, 0, alpha )
  107.     surface.SetFont( "TitleFont2" )
  108.     local w, h = surface.GetTextSize( "c" )
  109.  
  110.     surface.SetTextPos( x + ( wide / 2 ) - ( w / 2 ), y + ( tall / 2 ) - ( h / 2 ) )
  111.     surface.DrawText( "c" )
  112. end
  113.  
  114. function SWEP:GetCapabilities()
  115.     return bit.bor(CAP_WEAPON_MELEE_ATTACK1 , CAP_INNATE_MELEE_ATTACK1)
  116. end
  117.  
  118. easylua.EndWeapon(true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement