mirror of
https://github.com/CFC-Servers/cfc_spawn_protection.git
synced 2025-03-04 03:13:14 -05:00
Set physgun to default weapon
This commit is contained in:
parent
6519f837b4
commit
9be414493d
@ -172,6 +172,12 @@ local function setSpawnProtectionForPvpSpawn( ply )
|
||||
if not isValidPlayer( ply ) then return end
|
||||
if not playerIsInPvp( ply ) then return end
|
||||
|
||||
timer.Simple( 0.11, function()
|
||||
if not IsValid( ply ) then return end
|
||||
ply:Give( "weapon_physgun" )
|
||||
ply:SelectWeapon( "weapon_physgun" )
|
||||
end )
|
||||
|
||||
if playerSpawnedAtEnemySpawnPoint( ply ) then return end
|
||||
|
||||
setSpawnProtection( ply )
|
||||
@ -229,6 +235,14 @@ hook.Add( "PlayerExitPvP", "CFCremoveSpawnProtectionOnExitPvP", function( ply )
|
||||
instantRemoveSpawnProtection( ply, "You've left pvp mode and lost spawn protection." )
|
||||
end )
|
||||
|
||||
hook.Add( "PlayerSwitchWeapon", "CFCspawnProtectionSwitch", function( ply, _, wep )
|
||||
if not playerHasSpawnProtection( ply ) then return end
|
||||
|
||||
if not weaponIsAllowed( wep ) then
|
||||
instantRemoveSpawnProtection( ply, "You've switched weapons and lost spawn protection" )
|
||||
end
|
||||
end )
|
||||
|
||||
-- Remove spawn protection when player enters vehicle
|
||||
hook.Add( "PlayerEnteredVehicle", "CFCremoveSpawnProtectionOnEnterVehicle", function( ply )
|
||||
if not playerHasSpawnProtection( ply ) then return end
|
||||
@ -236,6 +250,12 @@ hook.Add( "PlayerEnteredVehicle", "CFCremoveSpawnProtectionOnEnterVehicle", func
|
||||
instantRemoveSpawnProtection( ply, "You've entered a vehicle and lost spawn protection." )
|
||||
end )
|
||||
|
||||
hook.Add( "CLoadoutOverridePreferredWeapon", "CFCSpawnProtection", function( ply, prefWeapon )
|
||||
if not playerHasSpawnProtection( ply ) then return end
|
||||
|
||||
return "weapon_physgun"
|
||||
end )
|
||||
|
||||
-- Physgun activity
|
||||
hook.Add( "OnPhysgunPickup", "CFCremoveSpawnProtectionOnPhysgunPickup", function( ply )
|
||||
if not playerHasSpawnProtection( ply ) then return end
|
||||
|
Loading…
Reference in New Issue
Block a user