--Thanks SteveUK for the scope tutorial. if ( SERVER ) then AddCSLuaFile( "shared.lua" ) SWEP.HoldType = "ar2" end if ( CLIENT ) then SWEP.PrintName = "LR300" SWEP.Author = "Sanuska" SWEP.Slot = 3 SWEP.SlotPos = 1 SWEP.DrawCrosshair = true SWEP.IconLetter = "e" killicon.AddFont( "weapon_aug", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ) end SWEP.Base = "weapon_cs_base" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_rif_lr3.mdl" SWEP.WorldModel = "models/weapons/w_rif_lr3.mdl" SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.Primary.Sound = Sound( "Weapon_Aug.Single" ) SWEP.Primary.Recoil = 1 SWEP.Primary.Damage = 15 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.01 SWEP.Primary.ClipSize = 30 SWEP.Primary.Delay = 0.1 SWEP.Primary.DefaultClip = 50 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "smg1" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" ScopeLevel = 0 /*--------------------------------------------------------- PrimaryAttack ---------------------------------------------------------/* function SWEP:PrimaryAttack() if ( ScopeLevel == 0 ) then self.Primary.Recoil = 1 self.Primary.Cone = 0.1 self.Primary.Delay = 0.1 else self.Primary.Automatic = false self.Primary.Recoil = 0.0 self.Primary.Cone = 0.0001 self.Primary.Delay = 0.9 end self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) if ( !self:CanPrimaryAttack() ) then return end // Play shoot sound self.Weapon:EmitSound( self.Primary.Sound ) // Shoot the bullet self:CSShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone ) // Remove 1 bullet from our clip self:TakePrimaryAmmo( 1 ) // Punch the player's view self.Owner:ViewPunch( Angle( math.Rand(-0.2,-0.1) * self.Primary.Recoil, math.Rand(-0.1,0.1) *self.Primary.Recoil, 0 ) ) end /*--------------------------------------------------------- SecondaryAttack ---------------------------------------------------------*/ function SWEP:SecondaryAttack() if(ScopeLevel == 0) then if (SERVER) then self.Owner:SetFOV( 45, 0 ) end ScopeLevel = 1 else if (ScopeLevel == 1) then if (SERVER) then self.Owner:SetFOV( 25, 0 ) end ScopeLevel = 2 else if (SERVER) then self.Owner:SetFOV( 0, 0 ) end ScopeLevel = 0 end end /*--------------------------------------------------------- Holster ---------------------------------------------------------*/ function SWEP:Holster() self.Owner:SetFOV( 0, 0 ) ScopeLevel = 0 return true end