Skip to content

Instantly share code, notes, and snippets.

@samuelmaddock
Created April 19, 2014 04:26
Show Gist options
  • Save samuelmaddock/11074109 to your computer and use it in GitHub Desktop.
Save samuelmaddock/11074109 to your computer and use it in GitHub Desktop.
GMod Lua virus notice
--
-- Garry's Mod Lua virus fix instructions
--
-- Save under lua/autorun to alert clients that they're infected.
-- This will open an HTML window directing them how to clean their
-- files.
--
if SERVER then
AddCSLuaFile()
return
end
local WebpageURL = "http://pixeltailgames.github.io/infected.html"
local HookName = "InfectedCheck"
local InfectedFiles = {
{ "download/engine_win32.dll", "MOD" },
-- { "bin/game_shader_generic_engine.dll", "MOD" },
{ "materials/cooltexture.vtf", "MOD" },
{ "autorun/server/default.lua", "LUA" }
}
local function IsInfected()
local infected = false
for _, fileinfo in pairs(InfectedFiles) do
if file.Exists(fileinfo[1], fileinfo[2]) then
infected = true
break
end
end
return infected
end
local function ShowInfectedMessage()
local frame = vgui.Create( "DFrame" )
frame:SetSize( math.min( 1280, ScrW() ), math.min( 720, ScrH() ) )
frame:Center()
frame:SetTitle( "You are infected with a Garry's Mod Lua virus, follow these steps to clean it." )
frame.OnClose = function()
LocalPlayer():ChatPrint( "To reopen the virus instructions window, type 'infected' into the console." )
end
local html = vgui.Create( "DHTML", frame )
html:Dock( FILL )
html:OpenURL( WebpageURL )
frame:MakePopup()
SetClipboardText( WebpageURL )
end
hook.Add( "CalcView", HookName, function()
-- Client is now fully loaded
hook.Remove( "CalcView", HookName )
if not IsInfected() then return end
ShowInfectedMessage()
end )
concommand.Add( "infected", ShowInfectedMessage )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment