Ulysses

General => Developers Corner => Topic started by: xXshadowXx on September 13, 2009, 10:27:51 PM

Title: see if someone is in a group inside a script
Post by: xXshadowXx 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)
Title: Re: see if someone is in a group inside a script
Post by: Megiddo on September 13, 2009, 11:11:09 PM
GetUserGroup (http://ulyssesmod.net/docs/files/lua/ULib/shared/sh_ucl-lua.html#Player:GetUserGroup) or CheckGroup, which is right below that. Both of these functions only exist in SVN right now, though!
Title: Re: see if someone is in a group inside a script
Post by: xXshadowXx on September 14, 2009, 02:53:21 AM
cool thanks :)
Title: Re: see if someone is in a group inside a script
Post by: Major_Pain 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.