Author Topic: Doing a ULib query on a SteamID?  (Read 2198 times)

0 Members and 1 Guest are viewing this topic.

Offline monkstick

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
Doing a ULib query on a SteamID?
« on: December 22, 2014, 02:49:28 AM »
Been trying to write a reserved slots module that better suits our needs but I ran into a problem. 

I want to use http://wiki.garrysmod.com/page/GM/CheckPassword to pass the users SteamID (After a conversion ofcourse) to a query, but it only seems to accept an actual player entity.  I know you could used to query a steamID but im not sure if this changed.  Anyone got any ideas?

http://puu.sh/dESjJ/6aef854806.png  --  Showing the error and my code.

Offline monkstick

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
Re: Doing a ULib query on a SteamID?
« Reply #1 on: December 22, 2014, 03:38:18 AM »
Hang on, just noticed the error is on line 20.  My script only has 7 lines, so I'm going to restart the server to re-initiate my hook.  Will post results.

Offline monkstick

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
Re: Doing a ULib query on a SteamID?
« Reply #2 on: December 22, 2014, 04:04:37 AM »
Nope.  Im out of ideas.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Doing a ULib query on a SteamID?
« Reply #3 on: December 22, 2014, 07:07:16 AM »
99% of our commands for doing look ups seem to be made for after a player is connected and has a valid player object.
As you've guessed, you'll never be able to use <steam id>:query.

It's less cool and more pain to code, but I'd create a local to your script table of steamIDs that already has that access flag, then check at join.
Create the table at script startup, and update it when UCLChanged too.
To create it, cycle through the UCL table. (I forget exacts, something like ULib.ucl.users, then sub-tables within that would store the steam id, group they are in, and any individual access flags given for each user/steamID.
Do a print table or something to get more ideas of what to cycle/what to check.
While cycling through the table of course, if the reservedslots exists in the group they're a member of, or the players individual access flag, grab it and put it in a table.

I hope I've explained the thoughts in my head well enough. It seems like it should be reasonably simple to do, but difficult to explain.

Also, what are your needs? Block before even spawning if they aren't reserved _and_ know the password?
« Last Edit: December 22, 2014, 07:10:00 AM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline monkstick

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
Re: Doing a ULib query on a SteamID?
« Reply #4 on: December 23, 2014, 06:43:29 AM »
I started Duck Typing to get past 95% of the issues, but I couldn't trick it to accept my player as being authed.  In the end, I bought a script from Script fodder which does more or less what I needed for $2.  I had been working on this for hours and hours.  $2 to save me further hours of my time is fine. 

I did find out though that they did it more or less like you said, so I learnt something at least.

Offtopic,  have you guys made a XGUI documentation yet?  I read you were going to do it with the next major change.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Doing a ULib query on a SteamID?
« Reply #5 on: December 23, 2014, 03:40:40 PM »
I've not heard any recent news out of the team on that respect.
Doesn't mean it's not on horizon, just means I've not seen it.

* JamminR looks at Stickly, yeah Stickly, any XGUI documentation yet?
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Doing a ULib query on a SteamID?
« Reply #6 on: January 02, 2015, 11:45:05 AM »
Nope. :P Still haven't had the time to sit down and flesh it out. Feel free to send me a PM if you have specific questions or need a good starting point for something- I'd be happy to help anyone out.
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6