Ulysses Stuff > General Chat & Help and Support

Restricting ulx groups to join a server

(1/1)

Shu | Pexie:
Is there a way to restrict ulx groups to join a server? I'm pretty sure it's impossible doing with just ulx itself and probably it requires some code knowledge, but i was wondering how it could work...

I saw some servers asking the clients the moment they try to join for a password (not the server password), a special code to allow that specific user to join the server, otherwise it would appear to the same user something like "bad password", restricting to join. I searched on google and even here, but didn't find anything about it...

MrPresident:
The problem with doing it using ULX groups (or groups in gmod in general) is that to have it restrict players before they join you need to use the PlayerAuthed hook.

That's fine and all.. except this occurs before the player is authed by ULX. The only information you have with this hook is the player's steamid64.

Ohh.. come to think of it.. you could do this pretty easily. Below is pseudocode to get you started...


1. Catch the join event in the PLayerAuthed hook.
2. Convert the 64bit steam id to a normal steam id.
3. Iterate through the ULib.ucl.users table to see if that steam id has an entry.
4. If they do... compare their group (from their entry in the table) against a list of groups you want to allow into your server.


I'm nowhere near my main PC (and won't be for another week) or I'd write this for you, but I can't. :(

If you can't get this yourself, or no one else takes it on, I'll work it out when I get back. That sounds like a useful plugin to release to the ULX community.

JamminR:
MrPresident - Why couldn't he just use ULX reserved slots?

Shu | Pexie -
It's called reserved slots, and ulx has it. It's probably one of the first features we wrote into it, after straight admin commands like kick/ban.
They do indeed join server for a few moments if they don't have access, and that could be annoying, but it works. (They'd be kicked after join)

See the descriptions of rslots and rslotsmode here.
https://github.com/TeamUlysses/ulx/blob/b7adea4fed9d3b582dabc3db5d198cbda899b2a7/lua/ulx/data.lua#L125
It can all be controlled through XGUI, and console.

Basically, you'd want rslots set to number of max players, rslotsMode 2, and ensure "ulx reservedslots" permission is granted to any group below admin you want for access. (admin and inheritance above get by default)

We used to have password - but I'm pretty sure we got rid of it.

In theory, you could password protect your server and maintain a list of people to share with, but then you'd have to worry about bad actors sharing the password.

MrPresident:
He could, but the problem with allowing them to join is they get all the downloads first. This can be annoying for players and taxing on a server. The best way to do whitelisting is through the authed hook so it'll boot them before they join.

Shu | Pexie:
I was checking how i could make this code and then i saw the CheckPassword hook and i was wondering if using that would solve my problem too...

Also do you guys know the difference between the strings "svPassword" and "clPassword"?

Navigation

[0] Message Index

Go to full version