if (SERVER) then AddCSLuaFile( "shared.lua" ) SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false end if ( CLIENT ) then SWEP.DrawAmmo = true SWEP.DrawCrosshair = false SWEP.ViewModelFOV = 90 SWEP.ViewModelFlip = false CreateClientConVar( "kp_crosshair", 1 ) CreateClientConVar( "kp_jumpsound", 1 ) CreateClientConVar( "kp_hurtsounds", 1 ) CreateClientConVar( "kp_gibbing", 1 ) end SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "" SWEP.Category = "Kingpin" SWEP.Spawnable = false SWEP.AdminSpawnable = false //SWEP.Primary.Sound = Sound( "v_shotgunk/shotgload.wav" ) SWEP.Primary.Recoil = 1.5 SWEP.Primary.Damage = 40 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.02 SWEP.Primary.Delay = 0.15 SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "none" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.DrySound = "weapons/v_pipebar/noammo.wav" function SWEP:Initialize() if ( SERVER ) then self:SetNPCMinBurst( 30 ) self:SetNPCMaxBurst( 30 ) self:SetNPCFireRate( 0.01 ) end self:SetWeaponHoldType( self.HoldType ) util.PrecacheSound( self.Primary.Sound ) util.PrecacheSound( self.DrySound ) end function SWEP:Deploy() self.Weapon:SetNextPrimaryFire(CurTime() +.6) self.Weapon:SendWeaponAnim(ACT_VM_DRAW) self.idledelay = CurTime() +2 return true end function SWEP:SecondaryAttack() end function SWEP:Reload() end function SWEP:Think() self:Stuff() end function SWEP:Stuff() for _,ply in pairs(player.GetAll()) do ply:SetDSP( 0 ) end if GetConVarNumber( "kp_jumpsound" ) == 1 then if SERVER then if self.Owner:WaterLevel() > 1 then return end if !self.Owner.JumpDelay then self.Owner.JumpDelay = CurTime() end if self.Owner:KeyDown(IN_JUMP) and !self.Owner:IsOnGround() and self.Owner.JumpDelay and self.Owner.JumpDelay <= CurTime() and self.Owner:GetMoveType() == MOVETYPE_WALK then self.Owner:EmitSound("kp/male/jump"..math.random(1,3)..".wav") self.Owner.JumpDelay = CurTime() + 0.7 end end elseif GetConVarNumber( "kp_jumpsound" ) == 2 then if SERVER then if self.Owner:WaterLevel() > 1 then return end if !self.Owner.JumpDelay then self.Owner.JumpDelay = CurTime() end if self.Owner:KeyDown(IN_JUMP) and !self.Owner:IsOnGround() and self.Owner.JumpDelay and self.Owner.JumpDelay <= CurTime() and self.Owner:GetMoveType() == MOVETYPE_WALK then self.Owner:EmitSound("kp/female/jump"..math.random(1,3)..".wav") self.Owner.JumpDelay = CurTime() + 0.7 end end end end local function OnPlayerDeath(ply) if GetConVarNumber( "kp_hurtsounds" ) == 1 then ply:EmitSound("kp/male/death"..math.random(1,4)..".wav") elseif GetConVarNumber( "kp_hurtsounds" ) == 2 then ply:EmitSound("kp/female/death"..math.random(1,4)..".wav") end end local function PlayerDeathSound() return false end local function PlayerHurt(ply, healthRemaining) hook.Add("PlayerDeathSound","Penis",OnPlayerDeath if GetConVarNumber( "kp_hurtsounds" ) == 1 then if ply:Health() < 100 then ply:EmitSound("kp/male/pain100_"..math.random(1,2)..".wav") elseif ply:Health() < 75 then return false end if ply:Health() < 75 then ply:EmitSound("kp/male/pain75_"..math.random(1,2)..".wav") elseif ply:Health() < 50 then return false end if ply:Health() < 50 then ply:EmitSound("kp/male/pain50_"..math.random(1,2)..".wav") elseif ply:Health() < 25 then return false end if ply:Health() < 25 then ply:EmitSound("kp/male/pain25_"..math.random(1,2)..".wav") if ply:IsOnFire( ) then ply:EmitSound("kp/male/flamedeath"..math.random(1,3)..".wav") elseif GetConVarNumber( "kp_hurtsounds" ) == 2 then if ply:Health() < 100 then ply:EmitSound("kp/female/pain100_"..math.random(1,2)..".wav") elseif ply:Health() < 75 then ply:EmitSound("kp/male/pain75_"..math.random(1,2)..".wav") elseif ply:Health() < 50 then ply:EmitSound("kp/male/pain50_"..math.random(1,2)..".wav") elseif ply:Health() < 25 then ply:EmitSound("kp/male/pain25_"..math.random(1,2)..".wav") if ply:IsOnFire( ) then ply:EmitSound("kp/female/flamedeath"..math.random(1,3)..".wav") end end end end end end) if GetConVarNumber( "kp_gibbing" ) == 1 then hook.Add( "ScaleNPCDamage", "Blow up the head", function( npc, hitgroup, dmginfo ) if ( dmginfo:GetDamage()) > 100 then npc:Remove() npc:EmitSound("kp/jibs.wav", 100, math.random(95,105)) for i=0,math.random(5,7) do local bits = ents.Create ("kp_bits") bits:SetPos(npc:GetPos()) bits:Spawn() bits:Activate() local phys = bits:GetPhysicsObject() if IsValid(phys) then local ang = Angle() local vel = ang:Forward() *0 +ang:Up() *1000 phys:ApplyForceCenter(vel) end end end end) hook.Add( "ScalePlayerDamage", "Blow up the player", function( ply, hitgroup, dmginfo ) if ( dmginfo:GetDamage()) > 70 then ply:KillSilent() ply:EmitSound("kp/jibs.wav", 100, math.random(95,105)) for i=0,math.random(5,10) do local bits = ents.Create ("kp_bits") bits:SetPos(npc:GetPos()) bits:Spawn() bits:Activate() local phys = bits:GetPhysicsObject() if IsValid(phys) then local ang = Angle() local vel = ang:Forward() *0 +ang:Up() *1000 phys:ApplyForceCenter(vel) end end end end end) function SWEP:ShootBullet( dmg, recoil, numbul, cone ) numbul = numbul or 1 cone = cone or 0.01 local bullet = {} bullet.Num = numbul bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector( cone, cone, 0 ) bullet.Tracer = 4 bullet.Force = 30 bullet.Damage = dmg self.Owner:FireBullets( bullet ) self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) self.Owner:SetAnimation( PLAYER_ATTACK1 ) if ( self.Owner:IsNPC() ) then return end end function SWEP:CanPrimaryAttack() if !self.Owner:IsNPC() then if self.Weapon:Clip1() == 0 then self:SetNextPrimaryFire( CurTime() + 0.5 ) self.Weapon:EmitSound(self.DrySound) return false end end return true end --function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha ) --surface.SetDrawColor( 255, 255, 255, 245 ) --surface.SetTexture( self.WepSelectIcon ) --y = y + 10 --x = x + 50 --wide = wide - 100 --surface.DrawTexturedRect( x, y, wide, wide ) --end if CLIENT then local ch1 = surface.GetTextureID("sprites/kpsprites/ch1") local ch2 = surface.GetTextureID("sprites/kpsprites/ch2") local ch3 = surface.GetTextureID("sprites/kpsprites/ch3") function SWEP:DrawHUD() local x, y if ( self.Owner == LocalPlayer() && self.Owner:ShouldDrawLocalPlayer() ) then local tr = util.GetPlayerTrace( self.Owner ) local trace = util.TraceLine( tr ) local coords = trace.HitPos:ToScreen() x, y = coords.x, coords.y else x, y = ScrW() / 2.0, ScrH() / 2.0 end local scale = .2 local LastShootTime = self.Weapon:GetNetworkedFloat( "LastShootTime", 0 ) scale = scale * (2 - math.Clamp( (CurTime() - LastShootTime) * 5, 0.0, 1.0 )) if GetConVarNumber( "kp_crosshair" ) == 1 then surface.SetTexture( ch1 ) surface.SetDrawColor( 255, 255, 255, 255 ) surface.DrawTexturedRect(x - 25, y - 25, 50, 50) elseif GetConVarNumber( "kp_crosshair" ) == 2 then surface.SetTexture( ch2 ) surface.SetDrawColor( 255, 255, 255, 255 ) surface.DrawTexturedRect(x - 25, y - 25, 50, 50) elseif GetConVarNumber( "kp_crosshair" ) == 3 then surface.SetTexture( ch3 ) surface.SetDrawColor( 255, 255, 255, 255 ) surface.DrawTexturedRect(x - 25, y - 25, 50, 50) end end end function SWEP:OnRestore() self.NextSecondaryAttack = 0 end /*hook.Add("OnDamagedByExplosion", "PlayerDamage", function( pl, dmginfo ) for _,ply in pairs(player.GetAll()) do local dmginfo = DamageInfo() dmginfo:SetDamage( 0 ) dmginfo:SetAttacker( ply ) dmginfo:SetInflictor( ply ) ply:TakeDamageInfo( dmginfo ) end end)*/