local fade, fade_dur = true, 1
local start = SysTime()
local function DrawSpawnProt()
	local scrw, scrh = ScrW() / 2, ScrH() - 150
	local color = Color(255, 255, 50, 255)
	local bg_color = Color(0, 0, 0, 255)
	if fade then
		fade_dur = math.Approach(fade_dur, 0, (SysTime() - start) * 4)
		start = SysTime()
		color.a = fade_dur * 255
		bg_color.a = fade_dur * 255
		if color.a <= 0 then
			hook.Remove("HUDPaint", "SpawnProtection_Active")
		end
	end
	draw.SimpleTextOutlined("Du hast Spawnschutz und kannst keinen Schaden austeilen oder einstecken.", "mg_instructions", scrw, scrh, color, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, bg_color)
end

net.Receive("SpawnProtection_Active", function()
	local active = net.ReadBool()
	if active then
		fade = false
		hook.Add("HUDPaint", "SpawnProtection_Active", DrawSpawnProt)
	elseif !fade then
		fade = true
		fade_dur = 1
		start = SysTime()
	end
end)