rendered paste bodyif (SERVER) then AddCSLuaFile( "shared.lua" ) SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.HoldType = "ar2" SWEP.ZoomMode = 0endif ( CLIENT ) then SWEP.ZoomMode = 0 SWEP.ViewModelFOV = 75 SWEP.IconFont = "CSSelectIcons" SWEP.PrintName = "SD3 Sniper Rifle" SWEP.Slot = 0 SWEP.Slotpos = 0 SWEP.IconLetter = "i" killicon.AddFont( "weapon_sniper", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) )end/*--------------------------------------------------------- PRIMARY Semi Auto---------------------------------------------------------*/ SWEP.Base = "tv_base" SWEP.Spawnable = true; SWEP.AdminSpawnable = true; SWEP.ViewModel = "models/weapons/v_snip_sg550.mdl" SWEP.WorldModel = "models/weapons/w_snip_sg550.mdl" SWEP.SoundDelay = nil SWEP.Primary.Sound = Sound( "weapons/sg550/sg550-1.wav" ) SWEP.Primary.ZoomSound = Sound( "weapons/g3sg1/g3sg1_slide.wav" ) SWEP.Primary.BoltSound = Sound( "weapons/mac10/mac10_boltpull.wav" ) SWEP.Primary.Recoil = 4.5 SWEP.Primary.Damage = 5 //obsol33t? SWEP.Primary.VehDamageScale = .05 //obsol33t now SWEP.Primary.Cone = 0.3 SWEP.Primary.ClipSize = 5 SWEP.Primary.Delay = 2.1 SWEP.Primary.DefaultClip = 99999 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "SniperRound" SWEP.Secondary.Clipsize = -1; SWEP.Secondary.DefaultClip = -1; SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none"; SWEP.Secondary.Delay = 0function SWEP:Initialize() if SERVER then self:SetWeaponHoldType(self.HoldType) endendfunction SWEP:Reload() self.Weapon:DefaultReload(ACT_VM_RELOAD) if (SERVER) then self.Owner:SetFOV( 0, .25 ) self.ZoomMode = 0 self.Weapon:SetNetworkedInt("ZoomMode", 0 ) endendfunction SWEP:Deploy() self.Weapon:SendWeaponAnim(ACT_VM_DRAW) return trueend function SWEP:Holster() if (SERVER) then self.Owner:SetFOV( 0, .25 ) end self.ZoomMode = 0 self.Weapon:SetNetworkedInt("ZoomMode", 0 )return true endfunction SWEP:Think() if self.SoundDelay then if self.SoundDelay < CurTime() then self.SoundDelay = nil self.Weapon:EmitSound(self.Primary.BoltSound,100,math.random(95,105)) end endendfunction SWEP:PrimaryAttack() if ( self.Weapon:Clip1() <= 0 ) then self.Weapon:EmitSound(Sound("weapons/ar2/ar2_empty.wav"),100,math.random(90,110)) self.Weapon:DefaultReload(ACT_VM_RELOAD) self.ZoomMode = 0 self.Weapon:SetNetworkedInt("ZoomMode", 0 ) if (SERVER) then self.Owner:SetFOV( 0, .25 ) end return end self.SoundDelay = CurTime() + 1 self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) if !self:CanPrimaryAttack() then return end self.Owner:ViewPunch(Angle(math.Rand(-0.2,-0.1) * self.Primary.Recoil, math.Rand(-0.1,0.1) *self.Primary.Recoil, 0)) self.Weapon:EmitSound(self.Primary.Sound,100,math.random(115,125)) if (SERVER) then self:ShootDart( self.Primary.Damage, self.Primary.Cone) end endfunction SWEP:DrawHUD() local mode = self.Weapon:GetNetworkedInt("ZoomMode") local w = ScrW() local h = ScrH() if mode != 0 then surface.SetTexture(surface.GetTextureID("sprites/reticle2")) surface.SetDrawColor(0, 170, 60, 255) surface.DrawTexturedRect(w*.25, 0, w*.5, h) endendfunction SWEP:SecondaryAttack() if CLIENT then return end self.ZoomMode = self.ZoomMode + 1 if self.ZoomMode == 1 then self.Weapon:SetNetworkedInt("ZoomMode", self.ZoomMode ) self.Owner:SetFOV( 50, .5 ) self.Owner:EmitSound(self.Primary.ZoomSound,100,110) self.Primary.Cone = 0.05 elseif self.ZoomMode == 2 then self.Weapon:SetNetworkedInt("ZoomMode", self.ZoomMode ) self.Owner:SetFOV( 10, .4 ) self.Owner:EmitSound(self.Primary.ZoomSound,100,120) self.Primary.Cone = 0.025 elseif self.ZoomMode == 3 then self.ZoomMode = 0 self.Weapon:SetNetworkedInt("ZoomMode", self.ZoomMode ) self.Owner:SetFOV( 0, .25 ) self.Owner:EmitSound(self.Primary.ZoomSound,100,100) self.Primary.Cone = 0.9 endendfunction SWEP:ShootDart(dmg,cone) local rcone = Angle(math.Rand(-1 * cone,cone),math.Rand(-1 * cone,cone),0) self:TakePrimaryAmmo(1) self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) self.Owner:MuzzleFlash() self.Owner:SetAnimation( PLAYER_ATTACK1 ) local ent = ents.Create("sent_poisondart") ent:SetOwner( self.Owner ) local start = self.Owner:GetAimVector() * 25 local finish = self.Owner:GetAimVector() * 90000 local tracedata = {} tracedata.start = start tracedata.endpos = finish tracedata.filter = self.Owner local tr = util.TraceLine(tracedata) local traceLen if tr.Hit then traceLen = (tr.StartPos-tr.HitPos):Length() else traceLen = (tr.StartPos-self.Owner:GetAimVector() * 5000):Length() end local moveto = self:GetForward() * math.Clamp(traceLen * .65, 10, 90000) ent:SetPos(moveto) //ent:SetPos( self.Owner:GetShootPos() + self.Owner:GetAimVector() * 15 ) ent:SetAngles( self.Owner:GetAngles() + rcone ) ent:Activate() ent:Spawn() //ent:DelayedPos() end