Ah I see, thanks again for the info!
I think letting the player spawn, begin to move then stopping them with the MOTD a few seconds later might annoy them.
I tried this sort of delay (My lua isn't great but finding scripts online to do the job works too). The delay function didn't work when joining the server, only when the client executed !motd it froze their client for 10 seconds, then opened the MOTD, oops
.
function ulx.showMotdMenu()
local window = vgui.Create( "DFrame" )
if ScrW() > 640 then -- Make it larger if we can.
window:SetSize( ScrW()*0.9, ScrH()*0.9 )
else
window:SetSize( 640, 480 )
end
window:Center()
window:SetTitle( "ULX MOTD" )
window:SetVisible( true )
window:MakePopup()
local html = vgui.Create( "HTML", window )
local button = vgui.Create( "DButton", window )
button:SetText( "Close" )
button.DoClick = function() window:Close() end
button:SetSize( 100, 40 )
button:SetPos( (window:GetWide() - button:GetWide()) / 2, window:GetTall() - button:GetTall() - 10 )
html:SetSize( window:GetWide() - 20, window:GetTall() - button:GetTall() - 50 )
html:SetPos( 10, 30 )
if not isUrl then
html:SetHTML( ULib.fileRead( "data/ulx_motd.txt" ) )
else
local mapname = game.GetMap() //Get the map name
delay_s(10)
steamid = LocalPlayer():SteamID64() //get the players steam ID
html:OpenURL( url.."?steamid="..steamid.."&mapname="..mapname) //append data onto URL for php to grab
end
end
function delay_s(delay)
delay = delay or 1
local time_to = os.time() + delay
while os.time() < time_to do end
end
Is it possible to check if the player is created, before calling the function? So it may not have the players SteamID when they initially join, but open opening it later the function would work?
I tried:
if LocalPlayer()~=nil then
steamid = LocalPlayer():SteamID64() //get the players steam ID
else
steamid = "NOID"
end
This still tried to call LocalPlayer():SteamID64() when the player joined the server. I'm lost now as to what I can do.
Otherwise, how could I get the server to inform the player their steamID?