Advertisement
SSN-ATomIC

Untitled

Oct 20th, 2014
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. AddCSLuaFile()
  2.  
  3. SWEP.HoldType = "ar2"
  4.  
  5. if CLIENT then
  6. SWEP.PrintName = "M16"
  7. SWEP.Slot = 2
  8.  
  9. SWEP.Icon = "vgui/ttt/icon_m16"
  10. end
  11.  
  12. SWEP.Base = "weapon_tttbase"
  13. SWEP.Spawnable = true
  14.  
  15. SWEP.Kind = WEAPON_HEAVY
  16. SWEP.WeaponID = AMMO_M16
  17.  
  18. SWEP.Primary.Delay = 0.19
  19. SWEP.Primary.Recoil = 1.6
  20. SWEP.Primary.Automatic = true
  21. SWEP.Primary.Ammo = "Pistol"
  22. SWEP.Primary.Damage = 23
  23. SWEP.Primary.Cone = 0.018
  24. SWEP.Primary.ClipSize = 20
  25. SWEP.Primary.ClipMax = 60
  26. SWEP.Primary.DefaultClip = 20
  27. SWEP.AutoSpawnable = true
  28. SWEP.AmmoEnt = "item_ammo_pistol_ttt"
  29.  
  30. SWEP.UseHands = true
  31. SWEP.ViewModelFlip = false
  32. SWEP.ViewModelFOV = 64
  33. SWEP.ViewModel = "models/weapons/cstrike/c_rif_m4a1.mdl"
  34. SWEP.WorldModel = "models/weapons/w_rif_m4a1.mdl"
  35.  
  36. SWEP.Primary.Sound = Sound( "Weapon_M4A1.Single" )
  37.  
  38. SWEP.IronSightsPos = Vector(-7.58, -9.2, 0.55)
  39. SWEP.IronSightsAng = Vector(2.599, -1.3, -3.6)
  40.  
  41.  
  42. function SWEP:SetZoom(state)
  43. if CLIENT then return end
  44. if not (IsValid(self.Owner) and self.Owner:IsPlayer()) then return end
  45. if state then
  46. self.Owner:SetFOV(35, 0.5)
  47. else
  48. self.Owner:SetFOV(0, 0.2)
  49. end
  50. end
  51.  
  52. -- Add some zoom to ironsights for this gun
  53. function SWEP:SecondaryAttack()
  54. if not self.IronSightsPos then return end
  55. if self:GetNextSecondaryFire() > CurTime() then return end
  56.  
  57. local bIronsights = not self:GetIronsights()
  58.  
  59. self:SetIronsights( bIronsights )
  60.  
  61. if SERVER then
  62. self:SetZoom( bIronsights )
  63. end
  64.  
  65. self:SetNextSecondaryFire( CurTime() + 0.3 )
  66. end
  67.  
  68. function SWEP:PreDrop()
  69. self:SetZoom(false)
  70. self:SetIronsights(false)
  71. return self.BaseClass.PreDrop(self)
  72. end
  73.  
  74. function SWEP:Reload()
  75. if (self:Clip1() == self.Primary.ClipSize or
  76. self.Owner:GetAmmoCount(self.Primary.Ammo) <= 0) then
  77. return
  78. end
  79. self:DefaultReload(ACT_VM_RELOAD)
  80. self:SetIronsights(false)
  81. self:SetZoom(false)
  82. end
  83.  
  84. function SWEP:Holster()
  85. self:SetIronsights(false)
  86. self:SetZoom(false)
  87. return true
  88. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement