• Any way of making this work again? (if it did)
    3 replies, posted
I found this laying around in my gmod folder, and wondering if there is a way to make it work again. [B]Client:[/B] [I]webmotd.lua[/I] [lua] local HTMLMOTD = {} vgui.Register( "HTMLMOTD", HTMLMOTD, "HTML" ) function CreateMOTD(player,commandName,args) local contents = file.Read("../motd.html") HTMLMOTD = vgui.Create( "HTMLMOTD" ) HTMLMOTD:MakePopup() HTMLMOTD:SetSize( ScrW(), ScrH()) HTMLMOTD:SetPos( 0, 0 ) HTMLMOTD:SetHTML( contents ) end function HTMLMOTD:OpeningURL( url, target ) local command = url:gsub( "lua://MOTD/", "" ) if ( command == "Close" ) then HTMLMOTD:Remove() return true; end if ( command == "No" ) then RunConsoleCommand("Dissconect") return true; end end [/lua] [B]Server:[/B] [I]webmotd.lua[/I] [lua] AddCSLuaFile("autorun/client/webmotd.lua") resource.AddFile("motd.html") CreateConVar( "simplemotd_show", "1", true, false ) function ShowMOTD(ply) if (GetConVarNumber("simplemotd_show") == 1) then ply:SendLua("CreateMOTD();") end end hook.Add("PlayerInitialSpawn", "webmotd", ShowMOTD) [/lua] [B]Html:[/B] [I]motd.html[/I] [code] <a href="lua://MOTD/Close">I agree, spawn me!</a> <br> <a href="lua://MOTD/No">I Dont agree!!!</a> [/code] I Tried it myself, but it does not appear to be printing any errors.
Bump because i think this is important.
If you want a motd, you could just use ASSMod, instead of going through all this trouble trying to fix this.
I made my own motd THAT WORKS if ya need it? its only like 30 lines of code but only takes .txt files even though its filled with HTML code. Or else i could make it read of a website?
Sorry, you need to Log In to post a reply to this thread.