ULX

Author Topic: How do I do make my groups target other groups like this?  (Read 8631 times)

0 Members and 1 Guest are viewing this topic.

Offline gamexplor

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
How do I do make my groups target other groups like this?
« on: December 16, 2016, 03:38:24 PM »
So these are my groups: owner, coowner, headadmin, superadmin, admin, dmoderator, moderator, dtrialmoderator, trialmoderator, donator, user

I want to make them be able to ONLY target other players that are the SAME or ranks BELOW their rank. I've been struggling with the can target ULX command but can't seem to get it to work, does anyone know possibly how I'd do this?

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 802
  • Karma: 58
Re: How do I do make my groups target other groups like this?
« Reply #1 on: December 16, 2016, 04:05:18 PM »
Set each group's 'can_target' to !%<group ONE higher than them>.

For example, "admin's" 'can_target' should be !%superadmin, which means they can target everything except superadmin and everything that inherits from it (I.E., 'admin' and below)



Say you had the following groups: superadmin, admin, operator, users
If you want each group to target their own group and any groups under them, you'd set their can_target to be this:





superadmin: *  (or leave blank)
admin: !%superadmin
operator: !%admin
user: !%operator
For more information: read this.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline gamexplor

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Re: How do I do make my groups target other groups like this?
« Reply #2 on: December 16, 2016, 05:43:32 PM »
Set each group's 'can_target' to !%<group ONE higher than them>.

For example, "admin's" 'can_target' should be !%superadmin, which means they can target everything except superadmin and everything that inherits from it (I.E., 'admin' and below)


For more information: read this.
Hey, thanks a lot for your reply. I managed to get it working, but my problem now is dmoderator and dtrialmoderators can target owners. My question is if I have a 4 different moderator groups, (dtrialmoderator, dmoderator, moderator, and trialmoderator) what would they all be?

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: How do I do make my groups target other groups like this?
« Reply #3 on: December 16, 2016, 06:08:02 PM »
Just set their can_targets to %<the group above them>. For example, I assume dtrialmoderator is under dmoderator so you would set dtrialmoderator's can_target to %dmoderator
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: How do I do make my groups target other groups like this?
« Reply #4 on: December 16, 2016, 08:01:12 PM »
Hey Roastchicken, he's wanting to not target groups above.
Sounds like he's got some split inheritance.

gamexplor, you need to make sure your groups inherit in a straight line from 'top' to 'bottom'.
Sounds like you have some moderator groups inheriting a group below it, but the groups higher than your moderator groups don't necessarily inherit linearly.
On a scale of 10 being highest group, and 1 being lowest, 10 should inherit 9 should inherit 8 should inherit 7 should inherit ... 1
and on the can_target, 1 !%2, 2 !%3, 3...

As iviscoity linked, please see and read the entire discussion at http://forums.ulyssesmod.net/index.php/topic,5346.0.html
Your questions have been asked an answered there already, i'm pretty sure.

"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline gamexplor

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Re: How do I do make my groups target other groups like this?
« Reply #5 on: December 18, 2016, 10:13:49 AM »
Hey Roastchicken, he's wanting to not target groups above.
Sounds like he's got some split inheritance.

gamexplor, you need to make sure your groups inherit in a straight line from 'top' to 'bottom'.
Sounds like you have some moderator groups inheriting a group below it, but the groups higher than your moderator groups don't necessarily inherit linearly.
On a scale of 10 being highest group, and 1 being lowest, 10 should inherit 9 should inherit 8 should inherit 7 should inherit ... 1
and on the can_target, 1 !%2, 2 !%3, 3...

As iviscoity linked, please see and read the entire discussion at http://forums.ulyssesmod.net/index.php/topic,5346.0.html
Your questions have been asked an answered there already, i'm pretty sure.

Sorry for the late replies, so for example.
Owner being the highest rank, would inherit off of co-owner (which is the next one down)?

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 802
  • Karma: 58
Re: How do I do make my groups target other groups like this?
« Reply #6 on: December 18, 2016, 10:15:11 AM »
Yes, that's how you would do it.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline gamexplor

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Re: How do I do make my groups target other groups like this?
« Reply #7 on: December 18, 2016, 10:38:05 AM »
Yes, that's how you would do it.
I've tried editing all the inheritance and everything and a dtrialmoderator can still pick up an owner. This is my setup:

User: can target !%operator
Noaccess: Inherits from user, can target: !%user
Operator: inherits from user, can target: !%donator
admin: inherits from operator, can target: !%superadmin
superadmin: inherits from admin, can target: !%headadmin
headadmin: inherits from superadmin, can target: !%coowner
coowner: inherits from headadmin, can target: !%owner
owner: inherits from coowner, can target: *
donator: inherits from user, can target: !%trialmoderator
trialmoderator: inherits from donator, can target: !%dtrialmoderator
dtrialmoderator: inherits from trialmoderator, can target: !%moderator
moderator: inherits from dtrialmoderator, can target: !%dmoderator
dmoderator: inherits from moderator, can target: !%admin

Any ideas?
« Last Edit: December 18, 2016, 11:57:13 AM by gamexplor »

Offline gamexplor

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Re: How do I do make my groups target other groups like this?
« Reply #8 on: December 19, 2016, 08:24:37 AM »
Bump, still wondering if anyone could let me know how to fix this. I know I've had some links to help me but they didn't do the job.

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: How do I do make my groups target other groups like this?
« Reply #9 on: December 19, 2016, 09:15:52 AM »
Again, you need to flatten your inheritance tree, or manually specify what groups can be targeted with the # tag. Example: admin should target user, donator, and moderator, so can_target would be #user,#donator,#moderator.
bw81@ulysses-forums ~ % whoami
Homepage

Offline gamexplor

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Re: How do I do make my groups target other groups like this?
« Reply #10 on: December 19, 2016, 09:19:19 AM »
Again, you need to flatten your inheritance tree, or manually specify what groups can be targeted with the # tag. Example: admin should target user, donator, and moderator, so can_target would be #user,#donator,#moderator.

I have all the inheritances setup though, it's just the dtrialmoderator and dmoderator I don't understand what to do with them, sorry...

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 802
  • Karma: 58
Re: How do I do make my groups target other groups like this?
« Reply #11 on: December 19, 2016, 09:40:19 AM »
You have Operator AND Donator inheriting from user, which means you have a split inheritance (or branching) tree. What they're suggesting is have it in a linear tree, where only one group inherits from another (like the default user < operator < admin < superadmin). The reason those groups can target higher groups like that is because they are not in the same branch, which means most of their inheritances and can_targets don't apply. You need to have it in a linear tree, like (user < donator < trialmoderator < dtrialmoderator < etc.)

In other words, make each group inherit only from the group directly below it, with that group inheriting from the one directly below it. Make sure no two groups inherit from the same group.

I hope that makes sense.

Edit: As a side note, not a great idea to have a group inherit from superadmin, as Garry's Mod recognises superadmin as having root access. Read more here: Groups vs. Teams - Why having an owner group is useless and stupid

Sent using Tapatalk. Owner of iViscosity Gaming.
« Last Edit: December 19, 2016, 09:47:18 AM by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: How do I do make my groups target other groups like this?
« Reply #12 on: December 19, 2016, 10:05:41 AM »
Here, let me help you visualize the issue:


This is what we mean when we say "inheritance branching"- all of your groups are not connected in a single line. The ULX targeting system does not work well with these kind of setups, unfortunately. It's a known limitation we plan on addressing in ULX 4.

The reason why this doesn't work is, well, let's focus on your can_target for 'dtrialmoderator'. Currently, you have it set to '!%moderator', which means that 'dtrailmoderators' can't target anyone in the group moderator, or any group that inherits from moderator (this is what !% does, the ! just inverts it). So in your terms, it's saying "dtrialmoderator can't target moderator and dmoderator". However, this says nothing about operator, noaccess, or any of your other groups.

Now, you would think you could just specify '!%moderator,!%admin' so that 'dtrialmoderator' can't target moderators or above AND admins and above, but the comma is a SET UNION operator (in terms of players you can target), and the end result is that they cancel each other out, and they'll be able to target anyone.


So, the first (less messy) solution would be to line up all of your groups so they inherit in a single line. This obviously puts some restrictions on which levels you give access to for certain commands (e.g., if you were trying to put operator between donator and trialmoderator, but you wanted operator to have a specific command that you don't want trialmoderator or higher to have, and you don't want operator to have all of the commands that trialmoderator has). But, you can work around that problem by using groupdeny: In my example, you would give operator the command you want, then groupdeny that command at the trialmoderator level.
EDIT: groupdeny only removes existing access to a group, not inherited. I should be slapped for forgetting that. This functionality exists on a per-user level though.

The other solution which allows you to keep this branching inheritance requires you to manually specify and maintain a list of groups each group can target. It's a bit tedious to set up, and even more tedious to maintain if you change your group structure, but it is fairly straightforward. Basically, for each group, you just keep a list of all of the groups you want to target using the # operator. To get you started:

Code: [Select]
user: ^
noaccess: ^
This will let user and noaccess (if you want) to only target themselves.

Code: [Select]
operator: #user
donator: #user
admin: #operator,#donator,#user
trialmoderator: #donator,#user
dtrialmoderator: #trialmoderator,#donator,#operator,#user
moderator: #dtrialmoderator,#trialmoderator,#donator,#operator,#user
dmoderator: #moderator,#dtrialmoderator,#trialmoderator,#donator,#operator,#user
admin: #dmoderator,#moderator,#dtrialmoderator,#trialmoderator,#donator,#operator,#user
... and so on.
« Last Edit: January 26, 2017, 06:30:09 PM by Stickly Man! »
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: How do I do make my groups target other groups like this?
« Reply #13 on: December 19, 2016, 12:33:27 PM »
Here, let me help you visualize the issue:

<offtopic>Huh, nice visualization.
I wonder how hard text-based graphing, especially in Lua, would be. Having a ULX command to draw the inheritance tree to console or something would be useful in visualizing branching inheritance trees like the above.</offtopic>
bw81@ulysses-forums ~ % whoami
Homepage

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 802
  • Karma: 58
Re: How do I do make my groups target other groups like this?
« Reply #14 on: December 19, 2016, 12:34:21 PM »
<offtopic>Huh, nice visualization.
I wonder how hard text-based graphing, especially in Lua, would be. Having a ULX command to draw the inheritance tree to console or something would be useful in visualizing branching inheritance trees like the above.</offtopic>
*cracks knuckles*

Sent using Tapatalk. Owner of iViscosity Gaming.

I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.