See if someone is in a Ulib group?

If I want to do something based on whether or not someone is in a Ulib usergroup, how would I go about doing it?

ie



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


what would go here?: (USER IS IN GROUP “poweruser”)

I think is Ply:IsUserGroup( “poweruser” )

http://ulyssesmod.net/docs/files/lua/ULib/shared/sh_ucl-lua.html#ucl.query

yeah found it thanks :slight_smile:

here’s what I found:

so my script to give people toolgun on spawn based on usergroup looks like:



function givePower( Ply )
	local usergroup = Player:GetUserGroup(Ply)
	if usergroup == "poweruser" then
		Ply:Give("gmod_tool")
	else
		--Msg("Not given a toolgun cuz not in the usergroup!")
	end
	
end
hook.Add( "PlayerSpawn", "PowerUserGiveTool", givePower )


I’ve never understood why ply:GetUserGroup isn’t in Gmod by default.

Garry probably over looked it. Someone suggest it.

Garry doesn’t need it thus clearly no one else would ever need it.
ply:GetNWString(“usergroup”) works last I checked though.