• Print

Author Topic: Can user target group?  (Read 5162 times)

0 Members and 1 Guest are viewing this topic.

Offline end360

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Can user target group?
« on: October 18, 2015, 04:17:20 pm »
Is there a built in function to see if a specific user can target a group? I actually need to see if they can't. I want to make it so say an operator can't mute an admin but the admin could mute the operator.

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Can user target group?
« Reply #1 on: October 18, 2015, 07:27:23 pm »
In the Manage groups portion of the groups tab, you need to set operator's target to !%admin
Once you get to know me, you'll find you'll have never met me at all.

Offline end360

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: Can user target group?
« Reply #2 on: October 18, 2015, 07:55:23 pm »
Yes i know that, but I need a way in lua to tell if the specific user can target a group. It's for a mute list in VGUI and I don't want a guest/member to be able to mute an admin but at the same time to allow the admin to mute them. (All clientside)

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Can user target group?
« Reply #3 on: October 18, 2015, 08:17:47 pm »
Use an if statement.

Code: Lua
  1. if ply:IsAdmin then
  2.      return
  3. else
  4.      (your mute function)
  5. end
Once you get to know me, you'll find you'll have never met me at all.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Can user target group?
« Reply #4 on: October 19, 2015, 07:41:24 pm »
Caustic Soda-sanpai, I really think they're wanting more specific than just if they are an admin.

End360, check out ULib docs.
ULib - getGroupCanTarget
Check out the docs for other functions.
We have functions that will return a players specific group, and we have commands that will return true if inheritance chain matches below.
« Last Edit: October 19, 2015, 07:43:09 pm by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Can user target group?
« Reply #5 on: October 19, 2015, 09:59:55 pm »
I just assumed he wanted an admin check since he asked

Quote
I don't want a guest/member to be able to mute an admin but at the same time to allow the admin to mute them.
Once you get to know me, you'll find you'll have never met me at all.

Offline end360

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: Can user target group?
« Reply #6 on: October 20, 2015, 07:58:20 pm »
I noticed the getGroupCanTarget, but it returns it as the !%admin and stuff, is there any way i can convert that into a list of ranks or should i just compare it against a table of ranks? The IsAdmin wont work because some of the groups dont inherit from an admin group.

Offline Professor_Smiley

  • Newbie
  • *
  • Posts: 45
  • Karma: -24
Re: Can user target group?
« Reply #7 on: October 21, 2015, 11:30:54 am »
Disable the mute command for guest/member/user. Just remove the permission
Keep the mute command permission for admin.

Now I believe that the user cannot mute anyone, only admins can.

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: Can user target group?
« Reply #8 on: October 21, 2015, 03:22:14 pm »
The best way to do this is just having the panel run a ULX command. This will handle all the targeting for you, so you don't have to copy ULib's code for same purpose.
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

  • Print