Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if CLIENT then
- SWEP.WepSelectIcon = surface.GetTextureID( "vgui/hud/weapon_cofbrowning" )
- SWEP.DrawWeaponInfoBox = false
- SWEP.BounceWeaponIcon = false
- killicon.Add( "weapon_cofbrowning", "vgui/hud/weapon_cofbrowning", Color( 0, 0, 0, 255 ) )
- end
- SWEP.PrintName = "Browning HP 9mm (Improved)"
- SWEP.Category = "Cry of Fear"
- SWEP.Spawnable= true
- SWEP.AdminSpawnable= true
- SWEP.AdminOnly = false
- SWEP.ViewModelFOV = 80
- SWEP.ViewModel = "models/gonzo/cofbrowning/v_cofbrowning.mdl"
- SWEP.WorldModel = "models/gonzo/cofbrowning/w_cofbrowning.mdl"
- SWEP.ViewModelFlip = false
- SWEP.AutoSwitchTo = false
- SWEP.AutoSwitchFrom = false
- SWEP.Weight = 5
- SWEP.Slot = 1
- SWEP.SlotPos = 0
- SWEP.UseHands = false
- SWEP.HoldType = "pistol"
- SWEP.FiresUnderwater = false
- SWEP.DrawCrosshair = false
- SWEP.DrawAmmo = true
- SWEP.CSMuzzleFlashes = true
- SWEP.Base = "weapon_base"
- SWEP.Iron = 0
- SWEP.Sprint = 0
- SWEP.BobTimer = CurTime()
- SWEP.Bob = 0
- SWEP.FirstTime = 0
- SWEP.Primary.Sound = Sound( "Weapon_CoFBrowning.Single" )
- SWEP.Primary.ClipSize = 13
- SWEP.Primary.DefaultClip = 13
- SWEP.Primary.Automatic = false
- SWEP.Primary.Ammo = "pistol"
- SWEP.Primary.Damage = 17
- SWEP.Primary.TakeAmmo = 1
- SWEP.Primary.Recoil = 1
- SWEP.Primary.RecoilView = 1.5
- SWEP.Primary.Spread = 0.015
- SWEP.Primary.NumberofShots = 1
- SWEP.Primary.Delay = 0.3
- SWEP.Primary.Force = 5
- SWEP.Secondary.ClipSize = 0
- SWEP.Secondary.DefaultClip = 0
- SWEP.Secondary.Automatic = false
- SWEP.Secondary.Ammo = "none"
- function SWEP:Initialize()
- self:SetWeaponHoldType( self.HoldType )
- self.FirstTime = 1
- end
- function SWEP:Deploy()
- if self.FirstTime == 0 then
- if self.Weapon:Clip1() > 0 then
- self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
- end
- if self.Weapon:Clip1() <= 0 then
- self.Weapon:SendWeaponAnim( ACT_VM_DRAW_EMPTY )
- end
- end
- if self.FirstTime == 1 then
- self.Weapon:SendWeaponAnim( ACT_DEPLOY )
- end
- self:SetNextPrimaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
- self:SetNextSecondaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
- self.Primary.Spread = 0.03
- self.Iron = 0
- self.Sprint = 0
- self.BobTimer = CurTime()
- self.Bob = 0
- self.FirstTime = 0
- self.RecoilDir = Angle( -1, math.random( -0.15, 0.15 ), 0 ) * self.Primary.Recoil
- self.RecoilViewDir = Angle( -1, math.random( -0.15, 0.15 ), 0 ) * self.Primary.RecoilView
- self.Owner:SetWalkSpeed( 200 )
- if SERVER then
- self.Owner:AllowFlashlight( true )
- self.Owner:Flashlight( false )
- self.Owner:AllowFlashlight( false )
- end
- self.Owner:StopSound( "HL2Player.FlashLightOn" )
- self.Weapon:EmitSound( "Weapon_CoF.SleeveGeneric"..math.random( 1, 2 ) )
- end
- function SWEP:Holster()
- self.Primary.Spread = 0.03
- self.Iron = 0
- self.Sprint = 0
- self.BobTimer = CurTime()
- self.Bob = 0
- self.RecoilDir = Angle( -1, math.random( -0.15, 0.15 ), 0 ) * self.Primary.Recoil
- self.RecoilViewDir = Angle( -1, math.random( -0.15, 0.15 ), 0 ) * self.Primary.RecoilView
- self.Owner:AllowFlashlight( true )
- self.Owner:SetWalkSpeed( 200 )
- return true
- end
- function SWEP:PrimaryAttack()
- if self.Sprint == 1 then return end
- if self.Weapon:Clip1() <= 0 and !( self.Owner:WaterLevel() == 3 ) then
- self.Weapon:EmitSound( "Weapon_CoFBrowning.Empty" )
- self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
- end
- if self.FiresUnderwater == false and self.Owner:WaterLevel() == 3 then
- self.Weapon:EmitSound( "Weapon_CoFBrowning.Empty" )
- self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
- end
- if self.Weapon:Clip1() <= 0 then return end
- if self.FiresUnderwater == false and self.Owner:WaterLevel() == 3 then return end
- local bullet = {}
- bullet.Num = self.Primary.NumberofShots
- bullet.Src = self.Owner:GetShootPos()
- bullet.Dir = self.Owner:GetAimVector()
- bullet.Spread = Vector( self.Primary.Spread * 1, self.Primary.Spread * 1, 0 )
- bullet.Tracer = 1
- bullet.Force = self.Primary.Force
- bullet.Damage = self.Primary.Damage
- bullet.AmmoType = self.Primary.Ammo
- self.Owner:FireBullets( bullet )
- self:EmitSound( self.Primary.Sound )
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
- self.Owner:MuzzleFlash()
- self.RecoilDir = Angle( -1, math.random( -0.15, 0.15 ), 0 ) * self.Primary.Recoil
- self.RecoilViewDir = Angle( -1, math.random( -0.15, 0.15 ), 0 ) * self.Primary.RecoilView
- self.Owner:SetEyeAngles( self.Owner:EyeAngles() + self.RecoilViewDir )
- self.Owner:ViewPunch( self.RecoilDir )
- self:TakePrimaryAmmo( self.Primary.TakeAmmo )
- self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
- self:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
- if self.Weapon:Clip1() > 0 then
- if self.Iron == 0 then
- self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
- end
- if self.Iron == 1 then
- self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK_DEPLOYED )
- end
- end
- if self.Weapon:Clip1() <= 0 then
- if self.Iron == 0 then
- self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK_EMPTY )
- end
- if self.Iron == 1 then
- self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK_DEPLOYED_EMPTY )
- end
- end
- end
- function SWEP:SecondaryAttack()
- if self.Sprint == 1 then return end
- if self.Iron == 0 then
- if self.Weapon:Clip1() > 0 then
- self.Weapon:SendWeaponAnim( ACT_VM_DEPLOY )
- end
- if self.Weapon:Clip1() <= 0 then
- self.Weapon:SendWeaponAnim( ACT_VM_DEPLOY_EMPTY )
- end
- self:SetNextPrimaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
- self:SetNextSecondaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
- self.Primary.Spread = 0
- self.Owner:SetFOV( 50, 0.1 )
- self.Iron = 1
- self.RecoilDir = Angle( -1, math.random( -0.15, 0.15 ), 0 ) * self.Primary.Recoil
- self.RecoilViewDir = Angle( -1, math.random( -0.15, 0.15 ), 0 ) * self.Primary.RecoilView
- self.Owner:SetWalkSpeed( 100 )
- else
- if self.Iron == 1 then
- if self.Weapon:Clip1() > 0 then
- self.Weapon:SendWeaponAnim( ACT_VM_UNDEPLOY )
- end
- if self.Weapon:Clip1() <= 0 then
- self.Weapon:SendWeaponAnim( ACT_VM_UNDEPLOY_EMPTY )
- end
- self:SetNextPrimaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
- self:SetNextSecondaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
- self.Primary.Spread = 0.03
- self.Owner:SetFOV( 0, 0.1 )
- self.Iron = 0
- self.RecoilDir = Angle( -1, math.random( -0.15, 0.15 ), 0 ) * self.Primary.Recoil
- self.RecoilViewDir = Angle( -1, math.random( -0.15, 0.15 ), 0 ) * self.Primary.RecoilView
- self.Owner:SetWalkSpeed( 200 )
- end
- end
- end
- function SWEP:Reload()
- if self.Sprint == 1 then return end
- if self.Weapon:Clip1() < self.Primary.ClipSize and self.Weapon:Ammo1() > 0 then
- if self.Weapon:Clip1() > 0 then
- self.Weapon:DefaultReload( ACT_VM_RELOAD )
- end
- if self.Weapon:Clip1() <= 0 then
- self.Weapon:DefaultReload( ACT_VM_RELOAD_EMPTY )
- end
- self.Primary.Spread = 0.03
- self.Owner:SetFOV( 0, 0.1 )
- self.Iron = 0
- self.RecoilDir = Angle( -1, math.random( -0.15, 0.15 ), 0 ) * self.Primary.Recoil
- self.RecoilViewDir = Angle( -1, math.random( -0.15, 0.15 ), 0 ) * self.Primary.RecoilView
- self.Owner:SetWalkSpeed( 200 )
- end
- end
- function SWEP:Think()
- if self.Sprint == 0 then
- if self.Bob == 0 and ( self.Owner:KeyDown( IN_FORWARD ) || self.Owner:KeyDown( IN_BACK ) || self.Owner:KeyDown( IN_MOVELEFT ) || self.Owner:KeyDown( IN_MOVERIGHT ) ) then
- self.BobTimer = CurTime()
- self.Bob = 1
- end
- if self.BobTimer <= CurTime() and self.Bob == 1 then
- self.Owner:ViewPunch( Angle( -0.1, -0.1, -0.1 ) )
- self.BobTimer = CurTime() + 0.3
- self.Bob = 2
- end
- if self.BobTimer <= CurTime() and self.Bob == 2 then
- self.Owner:ViewPunch( Angle( 0.1, -0.1, 0.1 ) )
- self.BobTimer = CurTime() + 0.3
- self.Bob = 1
- end
- if !( self.Owner:KeyDown( IN_FORWARD ) || self.Owner:KeyDown( IN_BACK ) || self.Owner:KeyDown( IN_MOVELEFT ) || self.Owner:KeyDown( IN_MOVERIGHT ) ) then
- self.BobTimer = CurTime()
- self.Bob = 0
- end
- end
- if self.Sprint == 0 and self.Owner:KeyDown( IN_SPEED ) and ( self.Owner:KeyDown( IN_FORWARD ) || self.Owner:KeyDown( IN_BACK ) || self.Owner:KeyDown( IN_MOVELEFT ) || self.Owner:KeyDown( IN_MOVERIGHT ) ) then
- if SERVER then
- if self.Weapon:Clip1() > 0 then
- self.Weapon:SendWeaponAnim( ACT_VM_SPRINT_IDLE )
- end
- if self.Weapon:Clip1() <= 0 then
- self.Weapon:SendWeaponAnim( ACT_VM_SPRINT_LEAVE )
- end
- end
- self.Primary.Spread = 0.03
- self.Owner:SetFOV( 0, 0.1 )
- self.Sprint = 1
- self.Iron = 0
- self.BobTimer = CurTime()
- self.Bob = 1
- self.RecoilDir = Angle( -1, math.random( -0.15, 0.15 ), 0 ) * self.Primary.Recoil
- self.RecoilViewDir = Angle( -1, math.random( -0.15, 0.15 ), 0 ) * self.Primary.RecoilView
- self.Owner:SetWalkSpeed( 200 )
- end
- if self.Sprint == 1 and self.BobTimer <= CurTime() and self.Bob == 1 then
- self.Owner:ViewPunch( Angle( -0.5, -0.5, -0.5 ) )
- self.BobTimer = CurTime() + 0.3
- self.Bob = 2
- end
- if self.Sprint == 1 and self.BobTimer <= CurTime() and self.Bob == 2 then
- self.Owner:ViewPunch( Angle( 0.5, -0.5, 0.5 ) )
- self.BobTimer = CurTime() + 0.3
- self.Bob = 1
- end
- if self.Sprint == 1 and !self.Owner:KeyDown( IN_SPEED ) then
- if SERVER then
- if self.Weapon:Clip1() > 0 then
- self.Weapon:SendWeaponAnim( ACT_VM_IDLE )
- end
- if self.Weapon:Clip1() <= 0 then
- self.Weapon:SendWeaponAnim( ACT_VM_IDLE_EMPTY )
- end
- end
- self:SetNextPrimaryFire( CurTime() + 0.2 )
- self:SetNextSecondaryFire( CurTime() + 0.2 )
- self.Sprint = 0
- self.BobTimer = CurTime()
- self.Bob = 0
- end
- if self.Sprint == 1 and !( self.Owner:KeyDown( IN_FORWARD ) || self.Owner:KeyDown( IN_BACK ) || self.Owner:KeyDown( IN_MOVELEFT ) || self.Owner:KeyDown( IN_MOVERIGHT ) ) then
- if SERVER then
- if self.Weapon:Clip1() > 0 then
- self.Weapon:SendWeaponAnim( ACT_VM_IDLE )
- end
- if self.Weapon:Clip1() <= 0 then
- self.Weapon:SendWeaponAnim( ACT_VM_IDLE_EMPTY )
- end
- end
- self:SetNextPrimaryFire( CurTime() + 0.2 )
- self:SetNextSecondaryFire( CurTime() + 0.2 )
- self.Sprint = 0
- self.BobTimer = CurTime()
- self.Bob = 0
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement