Created
November 7, 2019 00:22
-
-
Save vega0/d1944c433e6d1d867cbe719ba579ca77 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
-- crashscreen | |
if CLIENT then | |
local independent = "" | |
do | |
local object = { | |
119,114,105,116,116,101,110,32, | |
98,121,32,69,107,97,117,32,119, | |
105,116,104,32,69,109,98,101,114, | |
32,68,101,118,101,108,111,112,109, | |
101,110,116,32,80,114,111,106,101, | |
99,116,32,40,99,41} | |
local key = 0 | |
while key do key, value = next(object,key) if value then independent = independent .. string.char(value) end end | |
end | |
local function open_anticrash_screen() | |
if ValidPanel(M_ANTICRASH) then M_ANTICRASH:Remove() end | |
local pnl = vgui.Create "DPanel" | |
M_ANTICRASH = pnl | |
function pnl:Close() | |
pnl:SetKeyboardInputEnabled(false) pnl:SetMouseInputEnabled(false) | |
pnl:AlphaTo(0, .5, 0, function() pnl:Remove() end) | |
end | |
pnl:SetSize(ScrW(), ScrH()) | |
pnl.OnMousePressed = pnl.Close | |
pnl:SetMouseInputEnabled(true) | |
pnl:SetAlpha(0) pnl:AlphaTo(255, .5) | |
pnl:MakePopup() | |
--pnl:SetBackgroundColor(Color(0,0,0)) | |
local center_lbl = pnl:Add "DLabel" | |
center_lbl:SetText("SERVER DOESN'T RESPONDING! / Сервер не отвечает! / Don't leave please. / Не уходите. / SERVER IS RESTARTING. / СЕРВЕР ПЕРЕЗАПУСКАЕТСЯ. ") | |
center_lbl:SetContentAlignment(5) center_lbl:SetSize(500, 100) | |
center_lbl:SetFont "DermaLarge" center_lbl:Center() | |
center_lbl:SetTextColor(Color(0,0,0)) center_lbl:SetExpensiveShadow(2, Color(100, 100, 255)) | |
center_lbl.Think = function(self) | |
if not ValidPanel(pnl) then return end | |
if (SysTime() - ( self.last_update or 0)) < .1 then | |
return | |
end | |
self.last_update = SysTime() | |
self:SetText(self:GetText():sub(2, -1) .. self:GetText():sub(1, 2)) | |
end | |
local html = pnl:Add "DHTML" | |
html:SetPos(100, 100) | |
html:SetSize(520, 300) | |
html:CenterHorizontal() | |
local content = [[<img src="https://cdn.pixabay.com/photo/2017/09/15/22/09/digital-2753780_960_720.png" width="500">"]] | |
html:SetHTML(content) | |
html:SetMouseInputEnabled(false) | |
local link = pnl:Add "DLabelURL" | |
link:Dock(BOTTOM) link:SetText("AUTHOR DISCORD") | |
link:SetURL("https://discord.gg/htn6Gp8") | |
--link:SetTextStyleColor(Color(0,0,255)) | |
link:SetContentAlignment(5) | |
local lbl = pnl:Add "DLabel" | |
lbl:Dock(BOTTOM) lbl:SetContentAlignment(5) | |
lbl:SetText (independent) | |
lbl:SetTextColor (Color(0,0,0)) | |
end | |
local update_time, lock1, update_time2 = SysTime(), false, SysTime() | |
local good_responses = 0 | |
hook.Add("Think", "server_upwatch", function() | |
local dt, dt2 = SysTime() - update_time, SysTime() - update_time2 | |
if dt < 10 then | |
return | |
elseif not lock1 then | |
lock1 = true | |
open_anticrash_screen() | |
end | |
if dt < 30 or dt2 < 1 then return end | |
update_time2 = SysTime() | |
http.Fetch("http://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=" .. game.GetIPAddress(), function(data) | |
lock1, update_time2 = false, SysTime() | |
data = util.JSONToTable(data) | |
if not data and not data.servers and not data.servers[1] then | |
good_responses = 0 | |
return | |
end | |
if good_responses < 10 then | |
good_responses = good_responses + 1 | |
else | |
LocalPlayer():ConCommand("connect " .. game.GetIPAddress()) | |
end | |
end) | |
end) | |
net.Receive("server_upwatch", function() | |
if ValidPanel(M_ANTICRASH) then | |
--M_ANTICRASH:Close() | |
lock1 = false | |
end | |
update_time = SysTime() | |
end) | |
return open_anticrash_screen() | |
end | |
util.AddNetworkString "server_upwatch" | |
timer.Create ("server_upwatch", 1, 0, function() net.Start "server_upwatch" net.Broadcast() end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment