General > Developers Corner

I need help with a special sort of whitelist

(1/3) > >>

zeaga:
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!

Megiddo:
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.

JamminR:
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?)

Megiddo:
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.

zeaga:
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.

Navigation

[0] Message Index

[#] Next page

Go to full version