mirror of
https://github.com/CFC-Servers/cfc_spawn_protection.git
synced 2025-03-04 03:13:14 -05:00
parent
216f95a4f2
commit
1db5ab5c23
21
lua/autorun/client/cl_spawn_protection.lua
Normal file
21
lua/autorun/client/cl_spawn_protection.lua
Normal file
@ -0,0 +1,21 @@
|
||||
local textColor = Color( 0, 100, 255 )
|
||||
local outlineColor = color_black
|
||||
local TEXT_ALIGN_CENTER = TEXT_ALIGN_CENTER
|
||||
|
||||
local scrw = ScrW()
|
||||
local scrh = ScrH()
|
||||
|
||||
surface.CreateFont( "SpawnProtection", {
|
||||
font = "Roboto",
|
||||
size = ScreenScale( 15 ),
|
||||
weight = 600,
|
||||
} )
|
||||
|
||||
local function drawNotice()
|
||||
local active = LocalPlayer():GetNWBool( "HasSpawnProtection", false )
|
||||
if not active then return end
|
||||
|
||||
draw.SimpleTextOutlined( "Spawn protection enabled", "SpawnProtection", scrw * 0.5, scrh * 0.9, textColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, outlineColor )
|
||||
end
|
||||
|
||||
hook.Add( "HUDPaint", "DrawSpawnProtection", drawNotice )
|
@ -74,7 +74,7 @@ end
|
||||
|
||||
-- Set Spawn Protection
|
||||
local function setSpawnProtection( ply )
|
||||
ply.hasSpawnProtection = true
|
||||
ply:SetNWBool( "HasSpawnProtection", true )
|
||||
end
|
||||
|
||||
-- Remove Decay Timer
|
||||
@ -100,7 +100,7 @@ local function removeSpawnProtection( ply, printMessage )
|
||||
if not isValidPlayer( ply ) then return end
|
||||
|
||||
ply:ChatPrint( printMessage )
|
||||
ply.hasSpawnProtection = false
|
||||
ply:SetNWBool( "HasSpawnProtection", false )
|
||||
end
|
||||
|
||||
-- Creates a decay timer which will expire after spawnProtectionDecayTime
|
||||
@ -149,7 +149,7 @@ local function playerIsInPvp( ply )
|
||||
end
|
||||
|
||||
local function playerHasSpawnProtection( ply )
|
||||
return ply.hasSpawnProtection
|
||||
return ply:GetNWBool( "HasSpawnProtection", false )
|
||||
end
|
||||
|
||||
local function playerIsDisablingSpawnProtection( ply )
|
||||
|
Loading…
Reference in New Issue
Block a user