General > Developers Corner
see if someone is in a group inside a script
(1/1)
xXshadowXx:
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: ---
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)
--- End code ---
what would go here: (USER IS IN GROUP "poweruser")
also, is this the best way to do something like this? (i cant use LoadOut)
Megiddo:
GetUserGroup or CheckGroup, which is right below that. Both of these functions only exist in SVN right now, though!
xXshadowXx:
cool thanks :)
Major_Pain:
I like using IsUserGroup("groupname"), IsAdmin(), and IsSuperAdmin().
It is really whatever you want to do. IsAdmin does all admin groups.
Navigation
[0] Message Index
Go to full version