Advertisement
BuilderGaming

SCAR

Jul 5th, 2015
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.76 KB | None | 0 0
  1. if SERVER then
  2.    AddCSLuaFile()
  3. end
  4.  
  5. SWEP.HoldType        = "ar2"
  6.  
  7. if CLIENT then
  8.  
  9.    SWEP.PrintName       = "SCAR"          
  10.    SWEP.Slot               = 2
  11.  
  12.    SWEP.ViewModelFlip   = false
  13.    SWEP.ViewModelFOV    = 70
  14. end
  15.  
  16.  
  17. SWEP.Base            = "weapon_tttbase"
  18. SWEP.Kind            = WEAPON_HEAVY
  19.  
  20. SWEP.Primary.Delay         = 0.092
  21. SWEP.Primary.Recoil        = 0.32
  22. SWEP.Primary.Automatic     = true
  23. SWEP.Primary.Ammo          = "smg1"
  24. SWEP.Primary.Damage        = 20
  25. SWEP.Primary.Cone          = 0.03
  26. SWEP.Primary.ClipSize      = 30
  27. SWEP.Primary.ClipMax         = 60
  28. SWEP.Primary.DefaultClip   = 30
  29. SWEP.AutoSpawnable         = false
  30. SWEP.AmmoEnt               = "item_ammo_smg1_ttt"
  31.  
  32. SWEP.HeadshotMultiplier = 3
  33.  
  34. SWEP.ViewModel       = "models/weapons/scar/v_fnscarh.mdl"
  35. SWEP.WorldModel         = "models/weapons/scar/w_fn_scar_h.mdl"
  36.  
  37. SWEP.Primary.Sound = Sound( "Wep_fnscarh.Single" )
  38.  
  39. SWEP.IronSightsPos = Vector(-2.652, 0.187, -0.003)
  40. SWEP.IronSightsAng = Vector(2.565, 0.034, 0)
  41.  
  42. SWEP.VElements = {
  43.    ["rect"] = { type = "Model", model = "models/hunter/plates/plate1x1.mdl", bone = "gun_root", rel = "", pos = Vector(0, -0.461, 3.479), angle = Angle(0, 0, 90), size = Vector(0.009, 0.009, 0.009), color = Color(255, 255, 255, 255), surpresslightning = false, material = "models/wystan/attachments/eotech/rect", skin = 0, bodygroup = {} }
  44. }
  45.  
  46. function SWEP:SetZoom(state)
  47.    if CLIENT then return end
  48.    if not (IsValid(self.Owner) and self.Owner:IsPlayer()) then return end
  49.    if state then
  50.       self.Owner:SetFOV(55, 0.3)
  51.    else
  52.       self.Owner:SetFOV(0, 0.2)
  53.    end
  54. end
  55.  
  56. -- Add some zoom to ironsights for this gun
  57. function SWEP:SecondaryAttack()
  58.    if not self.IronSightsPos then return end
  59.    if self.Weapon:GetNextSecondaryFire() > CurTime() then return end
  60.  
  61.    bIronsights = not self:GetIronsights()
  62.  
  63.    self:SetIronsights( bIronsights )
  64.  
  65.    if SERVER then
  66.       self:SetZoom(bIronsights)
  67.    end
  68.  
  69.    self.Weapon:SetNextSecondaryFire(CurTime() + 0.3)
  70. end
  71.  
  72. function SWEP:PreDrop()
  73.    self:SetZoom(false)
  74.    self:SetIronsights(false)
  75.    return self.BaseClass.PreDrop(self)
  76. end
  77.  
  78. function SWEP:Reload()
  79.    self.Weapon: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
  89.  
  90. -- We were bought as special equipment, and we have an extra to give
  91. function SWEP:WasBought(buyer)
  92.    if IsValid(buyer) then -- probably already self.Owner
  93.       buyer:GiveAmmo( 30, "smg1" )
  94.    end
  95. end
  96.  
  97. if CLIENT then
  98.    function SWEP:DrawHUD()
  99.       if not self:GetIronsights() or GetConVar("ttt_ironsights_lowered"):GetBool() then
  100.         return self.BaseClass.DrawHUD(self)
  101.       end
  102.    end
  103. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement