Author Topic: I need help with a special sort of whitelist  (Read 4625 times)

0 Members and 3 Guests are viewing this topic.

Offline zeaga

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
I need help with a special sort of whitelist
« on: September 03, 2013, 05:45:52 PM »
Before I explain my problem, I'd like to apologize for any and all mistakes I may make.  I've been lurking on the forums for close to two years now, but I've never actually posted let alone ask for help before.
Anyway, I am trying to write a script built onto UGate that checks to see if the connecting player is friends with anyone in or inherited from a group (currently assigned the placeholder name of "greenlist") and, if so, add them to the whitelist.  In other words, assign them to the whitelist group if they're Steam friends with players belonging to the greenlist group.
The trouble is, I'm not sure how to go about checking if a player is friends with anyone in a group, because I don't know how to check for every player in a group without keeping a local table I need to constantly update whenever I "greenlist" a player.
I've searched the forums, checked the FAQs, and looked through the docs, but I am still lost.
If it matters, I need this because I run a Trouble in Terrorist Town server as well as a Prop Hunt server, but I don't like randoms joining the prop hunt server, and have no time to add every single member of my group of 150 some-odd members.
Any help is greatly appreciated.
Thanks!
« Last Edit: September 03, 2013, 05:47:44 PM by zeaga »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: I need help with a special sort of whitelist
« Reply #1 on: September 03, 2013, 06:34:11 PM »
There's no gmod built-in way to check the steam friends list (unless you do something with the web API), but I believe there's a module that would allow this. But then you'd need to have all your clients run the module.
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: I need help with a special sort of whitelist
« Reply #2 on: September 03, 2013, 07:15:29 PM »
Might wanna check out the new wiki.
http://wiki.garrysmod.com/page/Player/GetFriendStatus

Unfortunately, the example is crap.
Seems like it would be client side only? Ply:GetFriendStatus() implies I'm only running the command on ply on my client to see status of ply.
Workarounds could be used to work out server/clientside checks/commands/allowances, that also means it's more open to abuse/falsifying.
(the clientside anti-ulx-gag exploit can still be used in gmod 13, no?)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: I need help with a special sort of whitelist
« Reply #3 on: September 03, 2013, 07:48:05 PM »
Oh, cool. But yes, being only client side means that it could be exploited. 

Also this function would require that the new player be fully connected before you can see if they are a friend.

And no, we changed how gag functioned, it's all server-side now.
Experiencing God's grace one day at a time.

Offline zeaga

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: I need help with a special sort of whitelist
« Reply #4 on: September 03, 2013, 09:42:37 PM »
I've used the function before and found it very useful.  I wrote a mod that displays an icon next to a player if they are on your friends list that worked pretty well for the little it was meant to do.
Also, I don't mind requiring the player to be fully connected in order to use this function.  Actually, I am probably going to write my own whitelist module for ULX and instead of kicking the player right away giving them a notice as to why this is happening, so being connected isn't a problem at all.
Honestly, all I need to figure out is how to acquire a table of users in a specific group.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: I need help with a special sort of whitelist
« Reply #5 on: September 04, 2013, 05:04:50 AM »
I've used the function before and found it very useful.  I wrote a mod that displays an icon next to a player if they are on your friends list that worked pretty well for the little it was meant to do.
Also, I don't mind requiring the player to be fully connected in order to use this function.  Actually, I am probably going to write my own whitelist module for ULX and instead of kicking the player right away giving them a notice as to why this is happening, so being connected isn't a problem at all.
Honestly, all I need to figure out is how to acquire a table of users in a specific group.

There's no simple "get list of users in this group" function. Are you looking to do it for connected players only, or offline players as well?
Experiencing God's grace one day at a time.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: I need help with a special sort of whitelist
« Reply #6 on: September 04, 2013, 06:10:14 AM »
For his idea to work properly, it would need offline players as well. But, ever if it were to poll all players in the special group, there is no way to return their list of steam friends unless they were online, or unless you found a way to utilize the web API.

Offline zeaga

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: I need help with a special sort of whitelist
« Reply #7 on: September 04, 2013, 07:57:51 AM »
Yes, MrPresident is right, I need to get the offline players as well, which I haven't found a way to do.
I think I may just need to write a web API like you suggested, MrPresident.  Thanks for all the help, guys.  I really appreciate it.

Edit: Actually, I just realized I can easily keep a simple table of greenlisted members, so I won't actually need ULX for the greenlist part of this script.  Again, thanks for the help, guys, and please keep up the great work.  I can't live without Ulysses Mod.

I do have one more question, though.  How does XGUI get a list of players in a group?  I looked through the code, and maybe it's just a tad advanced for me, or I can't seem to find out.
« Last Edit: September 04, 2013, 08:15:20 AM by zeaga »

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: I need help with a special sort of whitelist
« Reply #8 on: September 04, 2013, 08:55:45 AM »
XGUI uses the serverside ULib.ucl.users table, then sends that data to users that have access to xgui_managegroups. That data is stored on the client in the xgui.data.users table.
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline zeaga

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: I need help with a special sort of whitelist
« Reply #9 on: September 04, 2013, 09:02:54 AM »
So I could access the xgui.data.users table on the client's side easily, then, yes?

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: I need help with a special sort of whitelist
« Reply #10 on: September 04, 2013, 12:39:08 PM »
I'm not sure how much this will help but you can do some thing like this...

http://steamcommunity.com/profiles/76561197960866737/friends/?xml=1

And get a persons friends list in the xml format.
---

I am sure there is a way to read those pages. Also it will only work if the profile is not private.
I cry every time I see that I am not a respected member of this community.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: I need help with a special sort of whitelist
« Reply #11 on: September 04, 2013, 02:02:33 PM »
So I could access the xgui.data.users table on the client's side easily, then, yes?
You 'could'.
That would then make your code a dependency of XGUI though.
Our team would recommend, if you're going to make anything dependent on any of our projects, you use ULib.
It wouldn't be overly difficult to perform the same transfer XGUI does from the servers ULib.ucl.users list and make you're own.
Though I've never seen it done, technically, XGUI could be removed and still have ULX work, if anyone ever wanted to do so.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline zeaga

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: I need help with a special sort of whitelist
« Reply #12 on: September 05, 2013, 08:58:27 AM »
I'm not sure how much this will help but you can do some thing like this...

http://steamcommunity.com/profiles/76561197960866737/friends/?xml=1

And get a persons friends list in the xml format.
---

I am sure there is a way to read those pages. Also it will only work if the profile is not private.

I actually never knew you could do that.  Thanks!  It actually helps a lot.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: I need help with a special sort of whitelist
« Reply #13 on: September 05, 2013, 01:45:38 PM »
Good starting point, that I'm sure would lead to tricks like the xml one.
http://steamcommunity.com/dev
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming