Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local soundData = {
- name = "Weapon_Cssg08.Draw" ,
- channel = CHAN_WEAPON,
- volume = 0.25,
- soundlevel = 80,
- pitchstart = 100,
- pitchend = 100,
- sound = "newage_csgo/csgo/ssg08/ssg08_draw.wav"
- }
- sound.Add(soundData)
- local soundData = {
- name = "Weapon_Cssg08.BoltBack" ,
- channel = CHAN_WEAPON,
- volume = 0.25,
- soundlevel = 80,
- pitchstart = 100,
- pitchend = 100,
- sound = "newage_csgo/csgo/ssg08/ssg08_boltback.wav"
- }
- sound.Add(soundData)
- local soundData = {
- name = "Weapon_Cssg08.BoltForward" ,
- channel = CHAN_WEAPON,
- volume = 0.25,
- soundlevel = 80,
- pitchstart = 100,
- pitchend = 100,
- sound = "newage_csgo/csgo/ssg08/ssg08_boltforward.wav"
- }
- sound.Add(soundData)
- local soundData = {
- name = "Weapon_Cssg08.Clipout" ,
- channel = CHAN_WEAPON,
- volume = 0.25,
- soundlevel = 80,
- pitchstart = 100,
- pitchend = 100,
- sound = "newage_csgo/csgo/ssg08/ssg08_clipout.wav"
- }
- sound.Add(soundData)
- local soundData = {
- name = "Weapon_Cssg08.Clipin" ,
- channel = CHAN_WEAPON,
- volume = 0.25,
- soundlevel = 80,
- pitchstart = 100,
- pitchend = 100,
- sound = "newage_csgo/csgo/ssg08/ssg08_clipin.wav"
- }
- sound.Add(soundData)
- local soundData = {
- name = "Weapon_Cssg08.Cliphit" ,
- channel = CHAN_WEAPON,
- volume = 0.25,
- soundlevel = 80,
- pitchstart = 100,
- pitchend = 100,
- sound = "newage_csgo/csgo/ssg08/ssg08_cliphit.wav"
- }
- sound.Add(soundData)
- if ( SERVER ) then
- AddCSLuaFile( "shared.lua" )
- end
- SWEP.PrintName = "SSG 08"
- SWEP.Slot = 2
- SWEP.SlotPos = 1
- SWEP.HoldType = "ar2"
- SWEP.ViewModelFlip = false
- SWEP.ViewModel = "models/weapons/c_csgo_ssg08.mdl"
- SWEP.WorldModel = "models/weapons/csgo_world/w_snip_ssg08.mdl"
- SWEP.UseHands = true
- SWEP.ViewModelFOV = 45
- SWEP.DrawCrosshair = false -- set false if you want no crosshair
- SWEP.Weight = 5
- SWEP.AutoSwitchTo = false
- SWEP.AutoSwitchFrom = false
- -- TTT settings
- SWEP.Spawnable = true
- SWEP.AdminSpawnable = true
- SWEP.AutoSpawnable = true
- SWEP.Kind = WEAPON_HEAVY
- SWEP.AmmoEnt = "item_ammo_357_ttt"
- SWEP.IsSilent = false
- SWEP.NoSights = false
- SWEP.Base = "weapon_tttbase"
- SWEP.AllowDrop = true
- -- TTT
- SWEP.Primary.Sound = Sound("csgo/ssg08/ssg08-1.wav")
- SWEP.Secondary.Sound = Sound("Default.Zoom")
- SWEP.Primary.Recoil = 5
- SWEP.Primary.Damage = 50
- SWEP.Primary.NumShots = 1
- SWEP.HeadshotMultiplier = 5
- SWEP.Primary.KickUp = 0.15
- SWEP.Primary.KickDown = 0.12
- SWEP.Primary.KickHorizontal = 0.13
- SWEP.Primary.Cone = 0.0001
- SWEP.Primary.ClipSize = 10
- SWEP.Primary.Delay = 1.3
- SWEP.Primary.DefaultClip = 10
- SWEP.Primary.ClipMax = 20
- SWEP.Primary.Automatic = false
- SWEP.Primary.Ammo = "357"
- SWEP.IronSightsPos = Vector(0, 0, 0)
- SWEP.IronSightsAng = Vector(0.145, 2.634, 0)
- -- Accuracy
- -- Accuracy
- SWEP.CrouchCone = 0.01 -- Accuracy when we're crouching
- SWEP.CrouchWalkCone = 0.02 -- Accuracy when we're crouching and walking
- SWEP.WalkCone = 0.025 -- Accuracy when we're walking
- SWEP.AirCone = 0.1 -- Accuracy when we're in air
- SWEP.StandCone = 0.015 -- Accuracy when we're standing still
- SWEP.Delay = 0.275
- SWEP.Recoil = 0
- SWEP.RecoilZoom = 0
- if CLIENT then
- SWEP.Icon = "vgui/ttt/ssg08_newage"
- local scope = surface.GetTextureID("sprites/scope")
- function SWEP:DrawHUD()
- if self:GetIronsights() then
- surface.SetDrawColor( 0, 0, 0, 255 )
- local x = ScrW() / 2.0
- local y = ScrH() / 2.0
- local scope_size = ScrH()
- -- crosshair
- local gap = 80
- local length = scope_size
- surface.DrawLine( x - length, y, x - gap, y )
- surface.DrawLine( x + length, y, x + gap, y )
- surface.DrawLine( x, y - length, x, y - gap )
- surface.DrawLine( x, y + length, x, y + gap )
- gap = 0
- length = 50
- surface.DrawLine( x - length, y, x - gap, y )
- surface.DrawLine( x + length, y, x + gap, y )
- surface.DrawLine( x, y - length, x, y - gap )
- surface.DrawLine( x, y + length, x, y + gap )
- -- cover edges
- local sh = scope_size / 2
- local w = (x - sh) + 2
- surface.DrawRect(0, 0, w, scope_size)
- surface.DrawRect(x + sh - 2, 0, w, scope_size)
- surface.SetDrawColor(255, 0, 0, 255)
- surface.DrawLine(x, y, x + 1, y + 1)
- -- scope
- surface.SetTexture(scope)
- surface.SetDrawColor(255, 255, 255, 255)
- surface.DrawTexturedRectRotated(x, y, scope_size, scope_size, 0)
- else
- return self.BaseClass.DrawHUD(self)
- end
- end
- function SWEP:AdjustMouseSensitivity()
- return (self:GetIronsights() and 0.2) or nil
- end
- end
- function SWEP:IronSight()
- if !self.Owner:KeyDown(IN_USE) then
- -- If the key E (Use Key) is not pressed, then
- if self.Owner:KeyPressed(IN_ATTACK2) then
- -- When the right click is pressed, then
- self:SetIronsights(true, self.Owner)
- if CLIENT then return end
- end
- end
- if !self.Owner:KeyDown(IN_ATTACK2) then
- -- If the right click is released, then
- self:SetIronsights(false, self.Owner)
- if CLIENT then return end
- end
- end
- local IRONSIGHT_TIME = 0.15 -- How long it takes to raise our rifle
- function SWEP:SetIronsights(b, player)
- if CLIENT then return end
- -- Send the ironsight state to the client, so it can adjust the player's FOV/Viewmodel pos accordingly
- self.Weapon:SetNetworkedBool("Ironsights", b)
- if self.UseScope then -- If we have a scope, use that instead of ironsights
- if b then
- --Activate the scope after we raise the rifle
- timer.Simple(IRONSIGHT_TIME, function() self:SetScope(true, player) end)
- else
- self:SetScope(false, player)
- end
- end
- end
- function SWEP:SetZoom(state)
- if CLIENT then
- return
- else
- if state then
- self.Owner:SetFOV(20, 0.3)
- else
- self.Owner:SetFOV(0, 0.2)
- end
- end
- end
- 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)
- else
- self:EmitSound(self.Secondary.Sound)
- 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:Holster()
- self:SetIronsights(false)
- self:SetZoom(false)
- return true
- end
- SWEP.Offset = {
- Pos = {
- Up = 0,
- Right = 1,
- Forward = -3,
- },
- Ang = {
- Up = 0,
- Right = 0,
- Forward = 0,
- }
- }
- function SWEP:Think()
- self:DrawWorldModel( )
- end
- function SWEP:RenderOverride()
- self:DrawWorldModel()
- end
- function SWEP:OnDrop()
- self.Owner = nil
- end
- function SWEP:Reload()
- self.Weapon:DefaultReload( ACT_VM_RELOAD );
- self:SetIronsights( false )
- self:SetZoom(false)
- end
- function SWEP:DrawWorldModel( )
- local hand, offset, rotate
- if not IsValid( self.Owner ) then
- self:SetRenderOrigin(self.Pos)
- self:SetRenderAngles(self.Ang)
- self:DrawModel( )
- return
- end
- if not self.Hand then
- self.Hand = self.Owner:LookupAttachment( "anim_attachment_rh" )
- end
- hand = self.Owner:GetAttachment( self.Hand )
- if not hand then
- --self:SetRenderOrigin(self:GetNetworkOrigin())
- --self:SetRenderAngles(self:GetNetworkAngles())
- self:SetRenderOrigin(self.Pos)
- self:SetRenderAngles(self.Ang)
- self:DrawModel( )
- return
- end
- offset = hand.Ang:Right( ) * self.Offset.Pos.Right + hand.Ang:Forward( ) * self.Offset.Pos.Forward + hand.Ang:Up( ) * self.Offset.Pos.Up
- hand.Ang:RotateAroundAxis( hand.Ang:Right( ), self.Offset.Ang.Right )
- hand.Ang:RotateAroundAxis( hand.Ang:Forward( ), self.Offset.Ang.Forward )
- hand.Ang:RotateAroundAxis( hand.Ang:Up( ), self.Offset.Ang.Up )
- if self.SetRenderOrigin == nil or self.SetRenderAngles == nil then return end
- self:SetRenderOrigin( hand.Pos + offset )
- self:SetRenderAngles( hand.Ang + Angle(-10, 0, 0) )
- self:DrawModel( )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement