Created
October 2, 2015 15:41
-
-
Save SwadicalRag/4156fe17db52907053d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local spawnProtectionNetchannel = "meme_protect_spawn" | |
if(SERVER) then | |
util.AddNetworkString(spawnProtectionNetchannel) | |
hook.Add("PlayerSpawn","meme_protect_spawn",function(ply) | |
ply:GodEnable() | |
timer.Simple(5,function() | |
if not IsValid(ply) then return end | |
ply:GodDisable() | |
net.Start(spawnProtectionNetchannel) | |
net.WriteBool(false) | |
net.Send(ply) | |
end) | |
net.Start(spawnProtectionNetchannel) | |
net.WriteBool(true) | |
net.Send(ply) | |
end) | |
elseif(CLIENT) then | |
local defaultColorModify = {} | |
defaultColorModify["$pp_colour_addr"] = 0 | |
defaultColorModify["$pp_colour_addg"] = 0 | |
defaultColorModify["$pp_colour_addb"] = 0 | |
defaultColorModify["$pp_colour_brightness"] = 0 | |
defaultColorModify["$pp_colour_contrast"] = 1 | |
defaultColorModify["$pp_colour_colour"] = 1 | |
defaultColorModify["$pp_colour_mulr"] = 0 | |
defaultColorModify["$pp_colour_mulg"] = 0 | |
defaultColorModify["$pp_colour_mulb"] = 0 | |
local function doSpectreView(fraction) | |
defaultColorModify["$pp_colour_colour"] = 1.3489 * math.min(math.max(fraction,0),1) | |
DrawColorModify(defaultColorModify) | |
end | |
surface.CreateFont("SpawnprotectNotifyFont",{ | |
font = "Roboto", | |
size = 32, | |
weight = 500, | |
blursize = 0.5, | |
scanlines = 0, | |
antialias = true, | |
underline = false, | |
italic = false, | |
strikeout = false, | |
symbol = false, | |
rotary = false, | |
shadow = false, | |
additive = false, | |
outline = false | |
}) | |
local isBeingProtected = false | |
net.Receive(spawnProtectionNetchannel,function(_) | |
isBeingProtected = net.ReadBool() | |
end) | |
local currentScreenFraction = 1 | |
local box_w,box_h = 530,40 | |
hook.Add("RenderScreenspaceEffects","meme_protect_spawn",function() | |
if(isBeingProtected) then | |
currentScreenFraction = currentScreenFraction + (0 - currentScreenFraction) * FrameTime() * 3 | |
else | |
currentScreenFraction = currentScreenFraction + (1 - currentScreenFraction) * FrameTime() * 3 | |
end | |
draw.RoundedBox(0,ScrW()/2-box_w/2,ScrH()*3/4-box_h/2,box_w,box_h,Color(255,255,255,TimedSin(1.5,115,145,0) * (1-currentScreenFraction))) | |
draw.SimpleText("You are currently immune to all damage","SpawnprotectNotifyFont",ScrW()/2,ScrH()*3/4,Color(5,5,5,200 - 200 * currentScreenFraction),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) | |
doSpectreView(currentScreenFraction) | |
end) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment