Author Topic: Anyway to get ALL players by their rank inheritance?  (Read 460 times)

0 Members and 1 Guest are viewing this topic.

Offline lRoberth

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Anyway to get ALL players by their rank inheritance?
« on: October 07, 2018, 05:23:12 PM »
I made a 3D2D screen where all users that are part of the staff team, are being shown there, but my problem, is that they're being shown by their user ID, when i want it to show by rank inheritance, and i can't find a way to do it that way.

here's what's happening:


i want it to appear like:
Fitz Simmons (Owner)
Bot01(Mod)
Hellfire377 (Trial-Mod)

any idea how i can do this?
« Last Edit: October 07, 2018, 05:29:01 PM by lRoberth »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 7922
  • Karma: 372
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Anyway to get ALL players by their rank inheritance?
« Reply #1 on: October 07, 2018, 06:09:09 PM »
You might be able to use groupInheritsFrom as a check each group - any returning another group, check it again until it returns false, that would then become the 'top' group. This would rely on you NOT having any tree 'branches' though. Once it checked a branch that wasn't inherited, it would be listed as top group again.

maybe also be able to use getInheritanceTree
I'm unsure from the example if it lists "top" to "bottom" though.
The price one pays for pursuing any profession or calling is an intimate knowledge of its ugly side. - James Baldwin

Offline lRoberth

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Anyway to get ALL players by their rank inheritance?
« Reply #2 on: October 07, 2018, 06:13:16 PM »
just fixed this about 2 minutes ago, i did it this way:

get all online players
check if they're administrators or nah
if they're administrators:
create a table
check the K value from the table that specifies what ranks are administrators
return that K value
insert that K value into the table and also the player entity
draw by SortedPairs() from lower to higher value

done



might not be the better way, but definitely works without any problem

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 7922
  • Karma: 372
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Anyway to get ALL players by their rank inheritance?
« Reply #3 on: October 07, 2018, 06:22:41 PM »
Good job.
One way may not be 'better' than another - you're doing with less complexity what my general idea was doing.
:)
The price one pays for pursuing any profession or calling is an intimate knowledge of its ugly side. - James Baldwin

Offline monkeymacman

  • Newbie
  • *
  • Posts: 44
  • Karma: 12
Re: Anyway to get ALL players by their rank inheritance?
« Reply #4 on: October 17, 2018, 06:58:36 PM »
Worth noting that another way to do it is with ply:CheckGroup(ply2:GetUserGroup()), which essentially does the same as running groupInheritsFrom() but in a smaller chunk of code. This is normally what I use in situations like this.