ULX

Author Topic: see if someone is in a group inside a script  (Read 2863 times)

0 Members and 1 Guest are viewing this topic.

Offline xXshadowXx

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
see if someone is in a group inside a script
« on: September 13, 2009, 10:27:51 PM »
If I want to do something in a script based on whether or not someone is in a particular Ulib usergroup, how would I go about doing it?

ie

Code: [Select]

function GiveTool (Ply)
    if (USER IS IN GROUP "poweruser") then
        Msg("he is a poweruser!")
        Ply:Give("gmod_tool")
    else
        Msg("he's in some other group... so no toolgun for him.")
    end
end

hook.Add( "PlayerSpawn", "GiveTool", GiveTool)
what would go here: (USER IS IN GROUP "poweruser")

also, is this the best way to do something like this? (i cant use LoadOut)

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: see if someone is in a group inside a script
« Reply #1 on: September 13, 2009, 11:11:09 PM »
GetUserGroup or CheckGroup, which is right below that. Both of these functions only exist in SVN right now, though!
Experiencing God's grace one day at a time.

Offline xXshadowXx

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: see if someone is in a group inside a script
« Reply #2 on: September 14, 2009, 02:53:21 AM »
cool thanks :)

Offline Major_Pain

  • Newbie
  • *
  • Posts: 23
  • Karma: 1
Re: see if someone is in a group inside a script
« Reply #3 on: September 18, 2009, 02:53:48 PM »
I like using IsUserGroup("groupname"), IsAdmin(), and IsSuperAdmin().

It is really whatever you want to do. IsAdmin does all admin groups.