• Print

Author Topic: Player:CheckGroup()  (Read 7404 times)

0 Members and 1 Guest are viewing this topic.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Player:CheckGroup()
« on: July 23, 2014, 03:01:22 am »
So I was thinking of using this to verify if a player inherits from a group along the way.

Like, say I did:

Code: Lua
  1. ply:CheckGroup( "user" ) -- Assume ply is set to an actual player.

Say the player is a superadmin. Would they have membership in the group user?

And another question, what does this function return? I don't really understand what is being returned in the ULib documentation.

Quote
A boolean stating whether they have membership in the group or not.
Out of the Garry's Mod business.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Player:CheckGroup()
« Reply #1 on: July 23, 2014, 03:54:17 am »
"user" is basically the global group and if I remember right, all groups somehow inherit from "user".

Also, it returns either true or false. True if the player is part of the group (or a group that inherits directly/indirectly from the group), false if not at all.

As stated in the docs: It's basically IsUserGroup, but also checks for the inheritance tree.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Player:CheckGroup()
« Reply #2 on: July 24, 2014, 12:23:11 am »
What Decicus' says; phrased differently;
In Gmod, IsUserGroup("user") will be false if the player is superadmin.
With Ulib, CheckGroup("user") will be true if player is superadmin.

More Ulib inheritance functions/checking described here - http://ulyssesmod.net/docs/files/lua/ulib/shared/sh_ucl-lua.html

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

Offline Helix757

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Player:CheckGroup()
« Reply #3 on: August 05, 2014, 09:26:24 am »
So basically instead of doing
ply:IsUserGroup("user") or and keep continuing for all the groups, you want something that uses the inheritance tree? If so I agree. It would be quite useful. Although I don't know if you can do this with ulib.

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Player:CheckGroup()
« Reply #4 on: August 05, 2014, 12:10:24 pm »
So basically instead of doing
ply:IsUserGroup("user") or and keep continuing for all the groups, you want something that uses the inheritance tree? If so I agree. It would be quite useful. Although I don't know if you can do this with ulib.

You can, it's right here in the ULib documentation.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

  • Print