How can I use gui.OpenURL as MOTD?

I’d like the MOTD to be interactive and already logged into Steamcommunity, the purpose of this is the MOTD (when people load in ulx will show MOTD which directs to my Steam Group, where they can manually join without having to login to Steam again.

I thought of the structure of the rules being in !rules and the loading screen, and motd asking people to join, is it possible for gui.OpenURL to render the motd page from ulx_motd.txt, any other methods that won’t make people relogin will be appeciated.

[del]You’d have to know the full path of where ulx_motd.txt is, which afaik is not possible without a module.[/del]

util.RelativePathToFull

Also, you can’t save HTML files on Gmod for download/write by clients, so opening the file won’t allow HTML to parse as the browser will read it as just a text file.

There are advanced ways of doing it that require a web server however, but it’s just not worth it.

5 Seconds in google: http://forums.ulyssesmod.net/index.php?topic=5494.0

That’s not what he’s asking for.

It was a response to you saying that it is not impossible to get the full path of ulx_motd.txt

:snip: crap thread

You can’t use .txt files as HTML in browsers.

Just make an MOTD a HTML panel or an actual website and read the thread.

I hate to bump this thread but BillyOnWiiU has absolutely no idea what he’s saying.

Yes, in Garrysmod you can have .txt files that contain HTML code and have them saved serverside (and clientside if you want clients to get any sensitive information) in the data folder which can then be sent to the client and set on an HTML vgui element. You can do what you’re asking but you’d need some HTML knowledge.

I did it on an MOTD that I released for free.

:what: Of course you can add it on a HTML panel. Again, read the thread.

He asks for how to do it with gui.OpenURL. If you actually read on it, it tells you it opens the Steam browser. This means if they are logged in on the Steam browser, they can keep their cookies for logins throughout their game session.

And as I previously stated, there’s no way of you accessing and editing the Steam browser with Lua (other than opening it) and there is no way of parsing a .txt file as HTML with the Steam browser, as I show in the screenshot below.

This thread is really bad. Please stop.

EDIT:

To expand futher, you cannot use file:/// with gui.OpenURL. The URL has to start with http:// or https://, meaning trying to open the local file would not work anyway.

Uhm… why don’t we just disable the ulx chat command for motd, and instead make our own chat command that opens whatever gui.OpenURL you want? I feel like this is being over complicated…

I don’t mind disabling ULX’s Motd if I can get instructions on how to make gui.OpenURL open up a page as soon as people join the server rather than having to type a command for it. (In this case, my group’s steam community page).

client



concommand.Add("openmotd", function(ply)
    gui.OpenURL("page link")
end)


server



hook.Add("PlayerInitialSpawn", "OpenMOTDOnSpawn", function(ply)
    ply:ConCommand("openmotd")
end)


Untested, but should work unless I made some silly mistake.

This worked, thanks.