General > Developers Corner
Restricting ULX Access to DarkRP Job
roastchicken:
If you want to prevent them from doing any moderation, in effect making them a regular user, unless in a certain job then you could set up a loop that checks the jobs of the players and if they are in the correct job then it promotes them to admin. Otherwise they are demoted to a normal group. This would require a file with the names of your staff and what group you want them to be promoted to when in the correct job.
The 'checking function' would be put in it's own lua file in either an addon folder or directly in the lua/autorun/ folder. It could run every few seconds or on the Think hook. It reads the file and stores all the staff member's SteamIDs and ranks in a table. Going through all the players it checks their SteamID against the table. When it finds a match it promotes/demotes the player according to their job. It could check to see if the player is already in the staff rank/not so it wouldn't continuously set their group to the same thing.
JamminR:
Do NOT use a think hook, at least, not without a time/count buffer, say every 10th or higher frame.
Every think hook would be extremely inefficient, running a getall loop every think.
Wow that could lag.
Ulib includes some hooks that monitor for ULX (or any ULib based really) command callbacks.
During the callback, you can return false and prevent the command from running.
If you're going to stick with ULib, I'd use those.
Add a team check and you should be golden.
See;
ULibCommandCalled
Possibly;
ULibPostTranslatedCommand
Navigation
[0] Message Index
[*] Previous page
Go to full version