[lua]if SERVER then
AddCSLuaFile("MOTDFrame.lua")
resource.AddFile("/MOTD/rules.txt")
resource.AddFile("/MOTD/credits.txt")
resource.AddFile("/MOTD/admins.txt")
else
hook.Add("InitPostEntity","UniqueIdntifier", function()
local MOTDFrame = vgui.Create( "DFrame" )
MOTDFrame:SetTitle( "Message of the Day" )
MOTDFrame:SetSize( ScrW() - 900, ScrH() - 50 )
MOTDFrame:Center()
MOTDFrame:ShowCloseButton( false )
MOTDFrame:SetBackgroundBlur( true )
MOTDFrame:SetDraggable( false )
MOTDFrame:SetVisible( true )
MOTDFrame:MakePopup()
local PropertySheet = vgui.Create( "DPropertySheet", MOTDFrame, pl )
PropertySheet:SetParent( MOTDFrame )
PropertySheet:SetPos( 20, 30 )
PropertySheet:SetSize( 400, 760 )
local SheetItemOne = vgui.Create( "HTML" )
SheetItemOne:SetSize( MOTDFrame:GetWide() - 50, MOTDFrame:GetTall() - 150)
SheetItemOne:SetHTML( file.Read( "/MOTD/rules.txt") )
local SheetItemTwo = vgui.Create( "HTML" )
SheetItemTwo:SetSize( MOTDFrame:GetWide() - 50, MOTDFrame:GetTall() - 150 )
SheetItemTwo:SetHTML( file.Read( "/MOTD/admins.txt") )
local SheetItemThree = vgui.Create( "HTML" )
SheetItemThree:SetSize( MOTDFrame:GetWide() - 50, MOTDFrame:GetTall() - 150 )
SheetItemThree:SetHTML( file.Read( "/MOTD/credits.txt") )
PropertySheet:AddSheet( "Rules", SheetItemOne, "gui/silkicons/exclamation", false, false, "Rules" )
PropertySheet:AddSheet( "Admins", SheetItemTwo, "gui/silkicons/group", false, false, "Admins" )
PropertySheet:AddSheet( "Credits", SheetItemThree, "gui/silkicons/wrench", false, false, "Credits" )
PropertySheet:SizeToContentWidth()
local MOTDButton = vgui.Create("DButton", MOTDFrame)
MOTDButton:SetText( "I Agree" )
MOTDButton:SetSize( 200, 40 )
MOTDButton:SetPos( (MOTDFrame:GetWide() - MOTDButton:GetWide() ) / 2, MOTDFrame:GetTall() - MOTDButton:GetTall() - 10 )
function MOTDButton:DoClick()
MOTDFrame:Close()
end
end )
end[/lua]
So, my problem is.. whenever, someone else that doesnt use the same screen resolution as I do. The MOTD is looking very different.. Infact, it's like very very tall, and not very wide.. However, when I run it in single player mode.. It pops up in a good size and all.. I wonder if there's a way to fit the size to all clients?