Author Topic: Pass the user's SteamID to the MOTD  (Read 2885 times)

0 Members and 3 Guests are viewing this topic.

Offline saintwubbles

  • Newbie
  • *
  • Posts: 15
  • Karma: 3
Pass the user's SteamID to the MOTD
« on: January 30, 2013, 10:59:42 PM »
Hello, would it be possible to make the MOTD append the viewing user's SteamID to the MOTD's URL.

So that the URL being accessed would be like "http://serverswebsite.com/motd/?steamid=STEAM_0:X:XXXXXXXXX"

You would have to do a simple check if there is already a query string to determine how to append it (? or &).

This would allow people to use it to automatically log users into the site, show relevant information and make the MOTD much more useful.

Thanks.

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Pass the user's SteamID to the MOTD
« Reply #1 on: January 31, 2013, 10:37:29 PM »
I haven't tested it, but I believe you can accomplish this by editing \ulx\lua\ulx\modules\sh\menus.lua, change line 16 from:
Code: [Select]
ULib.clientRPC( ply, "ulx.rcvMotd", true, showMotd )to:
Code: [Select]
ULib.clientRPC( ply, "ulx.rcvMotd", true, showMotd .. ply:SteamID() )
Then just make sure ulx_showmotd is set to "http://serverswebsite.com/motd/?steamid="

Hope that helps!
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: Pass the user's SteamID to the MOTD
« Reply #2 on: January 31, 2013, 11:42:23 PM »
I haven't tested it, but I believe you can accomplish this by editing \ulx\lua\ulx\modules\sh\menus.lua, change line 16 from:
Code: [Select]
ULib.clientRPC( ply, "ulx.rcvMotd", true, showMotd )to:
Code: [Select]
ULib.clientRPC( ply, "ulx.rcvMotd", true, showMotd .. ply:SteamID() )
Then just make sure ulx_showmotd is set to "http://serverswebsite.com/motd/?steamid="

Hope that helps!

But what if your not using ULib or making your own MOTD from scratch?
I cry every time I see that I am not a respected member of this community.

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Pass the user's SteamID to the MOTD
« Reply #3 on: February 01, 2013, 08:15:14 AM »
But what if your not using ULib or making your own MOTD from scratch?

My fix above would be for the ULX MOTD only, but essentially the concept would be the same:

Take your existing MOTD code, find where it sends the URL to the specific player who will be shown the MOTD, then append the players SteamID to the URL (since you should have the player entity available).

If the MOTD code is clientside only, then you should be able to append LocalPlayer():SteamID() to the URL, thus it will get the client's SteamID without going through serverside code.
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline saintwubbles

  • Newbie
  • *
  • Posts: 15
  • Karma: 3
Re: Pass the user's SteamID to the MOTD
« Reply #4 on: February 02, 2013, 01:53:40 PM »
Thanks for the help.