Advertisement
BuilderGaming

F2000

Jul 4th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.13 KB | None | 0 0
  1. if CLIENT then
  2.    SWEP.PrintName = "F2000"
  3.    SWEP.Slot      = 2
  4.  
  5.    SWEP.ViewModelFOV  = 72
  6.    SWEP.ViewModelFlip = true
  7. end
  8.  
  9. SWEP.Base       = "weapon_tttbase"
  10.  
  11. SWEP.HoldType     = "ar2"
  12.  
  13. SWEP.Primary.Delay       = 0.08
  14. SWEP.Primary.Recoil      = 1.6
  15. SWEP.Primary.Automatic   = true
  16. SWEP.Primary.Damage      = 25
  17. SWEP.Primary.Cone        = 0.025
  18. SWEP.Primary.Ammo        = "smg1"
  19. SWEP.Primary.ClipSize    = 30
  20. SWEP.Primary.ClipMax     = 60
  21. SWEP.Primary.DefaultClip = 30
  22. SWEP.Primary.Sound       = Sound( "Weapon_F2000.Single" )
  23. SWEP.Secondary.Sound = Sound("Default.Zoom")
  24.  
  25. SWEP.IronSightsPos = Vector(3.499, 0, -1.4)
  26. SWEP.IronSightsAng = Vector(0, 0, 0)
  27.  
  28. SWEP.ViewModel  = "models/weapons/f2000/v_tct_f2000.mdl"
  29. SWEP.WorldModel = "models/weapons/f2000/w_fn_f2000.mdl"
  30.  
  31. SWEP.Kind = WEAPON_HEAVY
  32. SWEP.AutoSpawnable = true
  33. SWEP.AmmoEnt = "item_ammo_smg1_ttt"
  34.  
  35. function SWEP:SetZoom(state)
  36.     if CLIENT then
  37.        return
  38.     elseif IsValid(self.Owner) and self.Owner:IsPlayer() then
  39.        if state then
  40.           self.Owner:SetFOV(20, 0.3)
  41.        else
  42.           self.Owner:SetFOV(0, 0.2)
  43.        end
  44.     end
  45. end
  46.  
  47. -- Add some zoom to ironsights for this gun
  48. function SWEP:SecondaryAttack()
  49.     if not self.IronSightsPos then return end
  50.     if self.Weapon:GetNextSecondaryFire() > CurTime() then return end
  51.    
  52.     bIronsights = not self:GetIronsights()
  53.    
  54.     self:SetIronsights( bIronsights )
  55.    
  56.     if SERVER then
  57.         self:SetZoom(bIronsights)
  58.      else
  59.         self:EmitSound(self.Secondary.Sound)
  60.     end
  61.    
  62.     self.Weapon:SetNextSecondaryFire( CurTime() + 0.3)
  63. end
  64.  
  65. function SWEP:PreDrop()
  66.     self:SetZoom(false)
  67.     self:SetIronsights(false)
  68.     return self.BaseClass.PreDrop(self)
  69. end
  70.  
  71. function SWEP:Reload()
  72.     self.Weapon:DefaultReload( ACT_VM_RELOAD );
  73.     self:SetIronsights( false )
  74.     self:SetZoom(false)
  75. end
  76.  
  77.  
  78. function SWEP:Holster()
  79.     self:SetIronsights(false)
  80.     self:SetZoom(false)
  81.     return true
  82. end
  83.  
  84. if CLIENT then
  85.    function SWEP:DrawHUD()
  86.       if self:GetIronsights() then
  87.          local iScreenWidth = surface.ScreenWidth()
  88.          local iScreenHeight = surface.ScreenHeight()
  89.  
  90.          self.ScopeTable = {}
  91.          self.ScopeTable.l = (iScreenHeight + 1)*0.5 -- I don't know why this works, but it does.
  92.  
  93.          self.QuadTable = {}
  94.          self.QuadTable.h1 = 0.5*iScreenHeight - self.ScopeTable.l
  95.          self.QuadTable.w3 = 0.5*iScreenWidth - self.ScopeTable.l
  96.  
  97.          self.LensTable = {}
  98.          self.LensTable.x = self.QuadTable.w3
  99.          self.LensTable.y = self.QuadTable.h1
  100.          self.LensTable.w = 2*self.ScopeTable.l
  101.          self.LensTable.h = 2*self.ScopeTable.l
  102.  
  103.          self.ReticleTable = {}
  104.          self.ReticleTable.wdivider = 3.125
  105.          self.ReticleTable.hdivider = 1.7579/0.5    -- Draws the texture at 512 when the resolution is 1600x900
  106.          self.ReticleTable.x = (iScreenWidth/2)-((iScreenHeight/self.ReticleTable.hdivider)/2)
  107.          self.ReticleTable.y = (iScreenHeight/2)-((iScreenHeight/self.ReticleTable.hdivider)/2)
  108.          self.ReticleTable.w = iScreenHeight/self.ReticleTable.hdivider
  109.          self.ReticleTable.h = iScreenHeight/self.ReticleTable.hdivider
  110.  
  111.  
  112.          surface.SetDrawColor(0, 0, 0, 255)
  113.          surface.SetTexture(surface.GetTextureID("scope/gdcw_acogcross"))
  114.          surface.DrawTexturedRect(self.ReticleTable.x, self.ReticleTable.y, self.ReticleTable.w, self.ReticleTable.h)
  115.  
  116.          -- Draw the CHEVRON
  117.          surface.SetDrawColor(0, 0, 0, 255)
  118.          surface.SetTexture(surface.GetTextureID("scope/gdcw_acogchevron"))
  119.          surface.DrawTexturedRect(self.ReticleTable.x, self.ReticleTable.y, self.ReticleTable.w, self.ReticleTable.h)
  120.  
  121.          -- Draw the SCOPE
  122.          surface.SetDrawColor(0, 0, 0, 255)
  123.          surface.SetTexture(surface.GetTextureID("scope/gdcw_closedsight"))
  124.          surface.DrawTexturedRect(self.LensTable.x, self.LensTable.y, self.LensTable.w, self.LensTable.h)
  125.       else
  126.          return self.BaseClass.DrawHUD(self)
  127.       end
  128.    end
  129.  
  130.    function SWEP:AdjustMouseSensitivity()
  131.       return (self:GetIronsights() and 0.1) or nil
  132.    end
  133. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement