• MOTD Help
    2 replies, posted
I'm trying to create an MOTD as a first script, but it seems to not pop up when I put it on my gameserver. On the listen server it works fine. [PHP] if CLIENT then local ply = LocalPlayer() local MOTDFrame local MOTDButton local MOTDHTMLFrame function OpenMOTD() MOTDFrame = vgui.Create( "DFrame") MOTDFrame:SetTitle( "Message of The Day" ) MOTDFrame:SetSize( ScrW() - 100, ScrH() - 100) MOTDFrame:Center() MOTDFrame:ShowCloseButton( true ) MOTDFrame:SetBackgroundBlur( true ) MOTDFrame:SetDraggable( false ) MOTDFrame:SetVisible( true ) MOTDFrame:MakePopup() MOTDButton = vgui.Create("DButton", MOTDFrame) MOTDButton:SetText( "Agreed" ) MOTDButton:SetSize( 200, 40 ) MOTDButton:SetPos( (MOTDFrame:GetWide() - MOTDButton:GetWide()) / 3, MOTDFrame:GetTall() - MOTDButton:GetTall() - 10 ) function MOTDButton:DoClick() MOTDFrame:Close() end MOTDHTMLFrame = vgui.Create( "HTML", MOTDFrame ) MOTDHTMLFrame:SetPos( 25, 50 ) MOTDHTMLFrame:SetSize( MOTDFrame:GetWide() - 50, MOTDFrame:GetTall() - 150 ) MOTDHTMLFrame:SetHTML( file.Read( "../data/motd.txt") ) end concommand.Add("motd", OpenMOTD) function OpenMOTDOnSpawn(pl) pl:ConCommand("motd") end hook.Add("PlayerInitialSpawn","MOTDSPawnHook",OpenMOTDOnSpawn) end --end of client block if SERVER then AddCSLuaFile("motdscript.lua") resource.AddFile("../data/motd.txt") end--end of server block [/PHP]
That fixed it thanks. But now it pops up with this error in the console. This is probably why it doesn't pop-up on spawn Unhandled usermessage '' EDIT: NVM I found the problem. The hook is supposed to be under SERVER not CLIENT =D Thanks for all your help
Sorry, you need to Log In to post a reply to this thread.