Ulysses
General => Developers Corner => Topic started by: zeaga 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 (http://forums.ulyssesmod.net/index.php/topic,6545.html#msg31473) 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!
-
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.
-
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?)
-
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.
-
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.
-
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?
-
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.
-
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.
-
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.
-
So I could access the xgui.data.users table on the client's side easily, then, yes?
-
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.
-
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.
-
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.
-
Good starting point, that I'm sure would lead to tricks like the xml one.
http://steamcommunity.com/dev