Ulysses
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Search
Login
Register
Ulysses
»
General
»
Developers Corner
»
Restricting ULX Access to DarkRP Job
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: Restricting ULX Access to DarkRP Job (Read 4784 times)
0 Members and 2 Guests are viewing this topic.
Wolfy_
Newbie
Posts: 2
Karma: 0
Restricting ULX Access to DarkRP Job
«
on:
August 28, 2015, 06:30:01 AM »
Hello,
I am just wondering whether it is at all possible to restrict ULX access, for my mods & admins, by jobs.
For example, an admin cannot use any of his administrative commands unless he is the job, 'TEAM_ADMIN'
Thank you very much for your help!
Logged
JamminR
Ulysses Team Member
Hero Member
Posts: 8096
Karma: 390
Sertafide Ulysses Jenius
Re: Restricting ULX Access to DarkRP Job
«
Reply #1 on:
August 28, 2015, 06:45:13 AM »
ULX has no way to stop admin commands based on teams/jobs/roles/, only groups.
You can prevent RP commands based on jobss -Per DarkRP wiki
http://wiki.darkrp.com/index.php/Donator_Job_configuration#Restrict_certain_jobs_to_donator.2Fvip.2Fwhatever_usergroup
Logged
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming
Caustic Soda-Senpai
Sr. Member
Posts: 469
Karma: 54
<Insert something clever here>
Re: Restricting ULX Access to DarkRP Job
«
Reply #2 on:
August 29, 2015, 03:06:47 AM »
Well technically, in theory, you could run an if statement to determine if the calling player is in a specific DarkRP Team.
Logged
Once you get to know me, you'll find you'll have never met me at all.
Wolfy_
Newbie
Posts: 2
Karma: 0
Re: Restricting ULX Access to DarkRP Job
«
Reply #3 on:
August 29, 2015, 03:31:28 AM »
Definitely, but where would be the best place to put this if statement, after each command? Or is there a more efficient way of doing it?
Logged
Caustic Soda-Senpai
Sr. Member
Posts: 469
Karma: 54
<Insert something clever here>
Re: Restricting ULX Access to DarkRP Job
«
Reply #4 on:
August 29, 2015, 04:53:17 AM »
It would have to be in each command you want to lock to the jobs.
Logged
Once you get to know me, you'll find you'll have never met me at all.
roastchicken
Respected Community Member
Sr. Member
Posts: 476
Karma: 84
I write code
Re: Restricting ULX Access to DarkRP Job
«
Reply #5 on:
August 29, 2015, 08:08:23 AM »
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.
Logged
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.
JamminR
Ulysses Team Member
Hero Member
Posts: 8096
Karma: 390
Sertafide Ulysses Jenius
Re: Restricting ULX Access to DarkRP Job
«
Reply #6 on:
August 29, 2015, 04:21:34 PM »
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
«
Last Edit: August 29, 2015, 04:27:12 PM by JamminR
»
Logged
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming
Print
Pages: [
1
]
Go Up
« previous
next »
Ulysses
»
General
»
Developers Corner
»
Restricting ULX Access to DarkRP Job