Garry's Mod Wiki

util.GetUserGroups

  table util.GetUserGroups()

Description

Returns a table of all SteamIDs that have a usergroup.

This returns the original usergroups table, changes done to this table are not retroactive and will only affect newly connected users
This returns only groups that are registered in the settings/users.txt file of your server.

In order to get the usergroup of a connected player, please use Player:GetUserGroup instead.

Returns

1 table
A table of users where the key is the SteamID of the user and the value is a table with 2 fields:
> string name - Player Steam name
> string group - Player usergroup name

Example

Retrieve the names of every superadmin registered

local supadminsList = {} for steamid, infos in pairs(util.GetUserGroups()) do if infos.group == "superadmin" then supadminsList[#supadminsList + 1] = infos.name end end PrintTable(supadminsList)
Output:
1 = rubat 2 = garry