Ulysses

General => Developers Corner => Topic started by: ? Rainn ? on October 18, 2017, 05:44:15 PM

Title: ULX User Group Ranks in a Loading Screen?
Post by: ? Rainn ? on October 18, 2017, 05:44:15 PM
Hello! I am developing a loading screen and I was wondering is there any way you can implement ULX ranks in a loading screen? My guess is that it would have to include PHP or JavaScript. If you guys have a piece of code you are willing to give or can point me in the right direction that would be great! If you have any questions please ask away! Thanks.
Title: Re: ULX User Group Ranks in a Loading Screen?
Post by: Timmy on October 22, 2017, 05:24:01 AM
There are many ways to implement ULX ranks in a loading screen.

Here's how I would approach this:
1. Create a PHP script that can receive and save data.
2. Create a Lua script that generates a hash table that maps SteamID -> group, serialize it, and send it off to the web server every time a group-related change occurs.
3. Create a PHP script that reads the saved data, deserialize it, and use it to look up the group by SteamID.

The following should get you something to play around with:

Create the following files on your web server:
* index.php (https://pastebin.com/45yhauQ4)
* update.php (https://pastebin.com/wgrEbQRi)

Create the following file on your game server:
* lua/autorun/server/loadingscreen.lua (https://pastebin.com/tj2LE79f)

Instructions:
- Set the url variable in loadingscreen.lua equal to the location of the update.php script.
Code: [Select]
local url = "https://example.org/update.php"- Set your sv_loadingurl equal to the location of the index.php script. Append "?steamid=%s" to tell the script about the user's SteamID.
Code: [Select]
sv_loadingurl "https://example.org/index.php?steamid=%s"- Add a user to a group, remove a user from a group or change the name of a group to send data to the web server.
Code: [Select]
ulx adduserid STEAM_0:0:57225082 superadmin