Skip to content

admin/core/sh_usergroups

Source: gamemode/modules/admin/core/sh_usergroups.lua

Registers a Parallax usergroup and mirrors it to CAMI when available.

Documented functions: 20

Functions


MODULE:CanAccessPrivilege(client, privilege, fallback)

Checks whether a player can use a CAMI privilege with a local fallback.

Realm: shared

Parameters

Name Type Description
client Player\|nil Player to check; console always passes
privilege string CAMI privilege name
fallback string Fallback access level: user, admin, or superadmin

Returns

  • boolean: allowed Whether access is granted

MODULE:CanAssignUsergroup(actor, usergroup)

Checks whether an actor can assign a usergroup.

Realm: server

Parameters

Name Type Description
actor Player\|nil Actor player; console always passes
usergroup string Usergroup identifier

Returns

  • boolean: allowed Whether assignment is allowed
  • string|nil: reason Failure reason

MODULE:CanManageUsergroup(actor, target, usergroup)

Checks whether an actor can change a target player to a usergroup.

Realm: server

Parameters

Name Type Description
actor Player\|nil Actor player; console always passes
target Player Target player
usergroup string Desired usergroup

Returns

  • boolean: allowed Whether management is allowed
  • string|nil: reason Failure reason
  • string|nil: uniqueID Normalized usergroup identifier
  • table|nil: group Usergroup data

MODULE:CanTarget(actor, target)

Checks whether an actor can target a player for usergroup management.

Realm: server

Parameters

Name Type Description
actor Player\|nil Actor player; console always passes
target Player Target player

Returns

  • boolean: allowed Whether targeting is allowed
  • string|nil: reason Failure reason

MODULE:GetPlayerUsergroup(client)

Returns the best known Parallax usergroup for a player.

Realm: shared

Parameters

Name Type Description
client Player Target player

Returns

  • string: usergroup Usergroup identifier

MODULE:GetPlayerUsergroupImmunity(client)

Returns a player's target immunity value.

Realm: shared

Parameters

Name Type Description
client Player Target player

Returns

  • number: immunity Player immunity value

MODULE:GetPlayerUsergroupLevel(client)

Returns a player's access level.

Realm: shared

Parameters

Name Type Description
client Player Target player

Returns

  • number: level Player access level

MODULE:GetSortedUsergroups()

Returns all registered usergroups sorted by level then name.

Realm: shared

Returns

  • table: usergroups Sorted usergroup array

MODULE:GetUsergroup(uniqueID)

Returns a registered usergroup by identifier.

Realm: shared

Parameters

Name Type Description
uniqueID string Usergroup identifier

Returns

  • table|nil: usergroup Usergroup data

MODULE:GetUsergroupImmunity(uniqueID)

Returns a usergroup's target immunity value.

Realm: shared

Parameters

Name Type Description
uniqueID string Usergroup identifier

Returns

  • number: immunity Usergroup immunity value

MODULE:GetUsergroupLevel(uniqueID)

Returns a usergroup's access level.

Realm: shared

Parameters

Name Type Description
uniqueID string Usergroup identifier

Returns

  • number: level Usergroup access level

MODULE:GetUsergroups()

Returns all registered usergroups.

Realm: shared

Returns

  • table: usergroups Usergroup registry keyed by unique ID

MODULE:IsUsergroup(uniqueID)

Returns whether a usergroup exists.

Realm: shared

Parameters

Name Type Description
uniqueID string Usergroup identifier

Returns

  • boolean: exists Whether the usergroup exists

MODULE:NormalizeSteamID64(identifier)

Normalizes a SteamID or SteamID64 into SteamID64 form.

Realm: shared

Parameters

Name Type Description
identifier string SteamID or SteamID64

Returns

  • string|nil: steamID64 Normalized SteamID64

MODULE:NormalizeUsergroup(uniqueID)

Normalizes a usergroup identifier, accepting exact names and unambiguous partial matches.

Realm: shared

Parameters

Name Type Description
uniqueID string Usergroup identifier, display name, or partial match

Returns

  • string|nil: uniqueID Normalized identifier
  • table|nil: usergroup Usergroup data
  • string|nil: err Failure reason

MODULE:RegisterUsergroup(uniqueID, data)

Registers a Parallax usergroup and mirrors it to CAMI when available.

Realm: shared

Parameters

Name Type Description
uniqueID string Stable lower-case usergroup identifier
data table Usergroup metadata

Returns

  • table|nil: usergroup Registered usergroup data

MODULE:SetPlayerUsergroup(actor, target, usergroup, callback)

Sets an online player's usergroup through the authoritative admin API.

Realm: server

Parameters

Name Type Description
actor Player\|nil Actor player; console may be nil
target Player Target player
usergroup string Desired usergroup
callback function\|nil Optional callback receiving (ok, result, err)

Returns

  • boolean: ok Whether the change started/succeeded
  • string|nil: err Failure reason when ok is false

MODULE:SetSteamIDUsergroup(actor, identifier, usergroup, callback)

Sets an offline player's persisted usergroup by SteamID64.

Realm: server

Parameters

Name Type Description
actor Player\|nil Actor player; console may be nil
identifier string SteamID or SteamID64
usergroup string Desired usergroup
callback function\|nil Optional callback receiving (ok, result, err)

Returns

  • boolean: ok Whether the request was accepted
  • string|nil: err Failure reason when request validation fails

MODULE:SyncPlayerUsergroup(client, usergroup)

Applies a player's stored usergroup to Garry's Mod runtime state.

Realm: server

Parameters

Name Type Description
client Player Target player
usergroup string\|nil Optional usergroup override

Returns

  • string: usergroup Applied usergroup

MODULE:UsergroupInherits(uniqueID, parentID)

Returns whether a usergroup inherits from another usergroup.

Realm: shared

Parameters

Name Type Description
uniqueID string Child usergroup identifier
parentID string Parent usergroup identifier

Returns

  • boolean: inherits Whether the child inherits from the parent