if SERVER then AddCSLuaFile( "shared.lua" ) resource.AddFile( "models/weapons/v_rif_44a1.mdl" ) resource.AddFile( "models/weapons/w_rif_44a1.mdl" ) resource.AddFile( "materials/models/weapons/w_models/mw3_xplor3r/M4A1/frame.vmt" ) resource.AddFile( "materials/models/weapons/w_models/mw3_xplor3r/M4A1/grip.vmt" ) resource.AddFile( "materials/models/weapons/w_models/mw3_xplor3r/M4A1/sight.vmt" ) resource.AddFile( "materials/models/weapons/w_models/mw3_xplor3r/M4A1/silencer.vmt" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/arm.vmt" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/arm.vtf" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/frame.vmt" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/frame_a.vtf" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/frame_b.vtf" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/frame_c.vtf" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/grip.vmt" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/grip_a.vtf" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/grip_b.vtf" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/grip_c.vtf" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/sight.vmt" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/sight_a.vtf" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/sight_b.vtf" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/sight_c.vtf" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/silencer.vmt" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/silencer_a.vtf" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/silencer_b.vtf" ) resource.AddFile( "materials/models/weapons/v_models/mw3_xplor3r/M4A1/silencer_c.vtf" ) end SWEP.HoldType = "ar2" if CLIENT then SWEP.PrintName = "M4A1" SWEP.Slot = 2 SWEP.Icon = "VGUI/ttt/icon_m16" end SWEP.Base = "weapon_tttbase" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.Kind = WEAPON_HEAVY SWEP.Primary.Delay = 0.12 SWEP.Primary.Recoil = 1.6 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "pistol" SWEP.Primary.Damage = 14 SWEP.Primary.Cone = 0.045 SWEP.Primary.ClipSize = 20 SWEP.Primary.ClipMax = 60 SWEP.Primary.DefaultClip = 20 SWEP.AutoSpawnable = true SWEP.AmmoEnt = "item_ammo_pistol_ttt" SWEP.UseHands = true SWEP.ViewModelFlip = true SWEP.ViewModelFOV = 64 SWEP.ViewModel = "models/weapons/v_rif_44a1.mdl" SWEP.WorldModel = "models/weapons/w_rif_44a1.mdl" SWEP.Primary.Sound = Sound("Weapon_m4a1.single") SWEP.IronSightsPos = Vector (2.281, -3.8832, 2.017) SWEP.IronSightsAng = Vector (2.8929, -0.2285, -0.1565) SWEP.HeadshotMultiplier = 1.5 function SWEP:SetZoom(state) if CLIENT then return end if not (IsValid(self.Owner) and self.Owner:IsPlayer()) then return end if state then self.Owner:SetFOV(35, 0.5) else self.Owner:SetFOV(0, 0.2) end end -- Add some zoom to ironsights for this gun function SWEP:SecondaryAttack() if not self.IronSightsPos then return end if self.Weapon:GetNextSecondaryFire() > CurTime() then return end bIronsights = not self:GetIronsights() self:SetIronsights( bIronsights ) if SERVER then self:SetZoom(bIronsights) end self.Weapon:SetNextSecondaryFire(CurTime() + 0.3) end function SWEP:PreDrop() self:SetZoom(false) self:SetIronsights(false) return self.BaseClass.PreDrop(self) end function SWEP:Reload() self.Weapon:DefaultReload( ACT_VM_RELOAD ); self:SetIronsights( false ) self:SetZoom(false) end function SWEP:Holster() self:SetIronsights(false) self:SetZoom(false) return true end