Player extensions of the admin plugin: the player's role, their individual and temporary permissions, those of their active character, and the staff level checks. The engine's GetUserGroup, IsAdmin and IsSuperAdmin are overridden so that other addons see Flux roles and permissions.

Summary

Functions

Overrides the engine method to return the player's Flux role ID.
Overrides the engine method so that other addons recognize Flux admins.
Overrides the engine method so that other addons recognize Flux super admins.

Methods

Returns the value of one of the permissions set on the player's active character.
Returns the permissions set on the player's active character, not counting those of the player and of their role.
Returns one of the temporary permissions of the player's active character.
Returns the temporary permissions of the player's active character.
Returns the value of one of the player's individual permissions.
Returns the permissions set on the player individually, not counting those of their role.
Returns the ID of the player's role.
Returns the player's role object.
Returns one of the player's temporary permissions.
Returns the player's temporary permissions.
Makes a vanished player invisible and not solid again after they have respawned, unless they are in observer mode, which hides them in its own way.
Checks whether the player is an admin: a super admin or anyone with the 'moderate' permission.
Checks whether the player is at least an assistant: an admin or anyone with the 'staff' permission.
Checks whether the player is hidden from other players: vanished, or in observer mode.
Checks whether the player has the 'staff' permission.
Checks whether the player is a super admin: a root player or anyone with the 'administrate' permission.
Runs a command as this player, with the usual permission checks.
Writes the player's current name and role to their database record, if they have one.
Sets one of the permissions of the player's active character, which apply together with the player's own permissions while that character is loaded, see Bolt:get_permission_layer.
Gives the player's active character a temporary permission value that takes precedence over its lasting permissions until it expires.
Sets one of the player's individual permissions: updates the Permission records on the player's database record (PERM_NO destroys the record and takes it off the list) and the networked table, then runs the PlayerPermissionChanged hook.
Replaces the player's networked table of individual permissions.
Gives the player a temporary permission value that takes precedence over their regular permissions until it expires.
Replaces the player's networked table of temporary permissions.
Hides the player from everyone without the 'moderate' permission, or shows them again.
Sets the player's role, overriding the engine method.
Moves the player to a position and unsticks them.
Applies which of the hidden players this player may see to the networking of all of them.
Starts or stops networking the player, together with everything attached to them such as their weapons, to one other player, going by whether the player is hidden and whether the receiver has the 'moderate' permission, which lets them see hidden players.
Applies whether the player is hidden to the networking of the player to everyone else and sets their own 'transmission_prevented' net var.

Functions

Player.GetUserGroup(self)

shared plugins/admin/plugin/lib/meta/sh_player.lua:53

Overrides the engine method to return the player's Flux role ID.

Parameters

  • self Player

Returns

  • String role ID

Overrides the engine method so that other addons recognize Flux admins.

Parameters

  • self Player

Returns

  • Boolean

Player.IsSuperAdmin(self)

shared plugins/admin/plugin/lib/meta/sh_player.lua:57

Overrides the engine method so that other addons recognize Flux super admins.

Parameters

  • self Player

Returns

  • Boolean

Methods

Player:get_character_permission(perm)

shared plugins/admin/plugin/lib/meta/sh_player.lua:104

Returns the value of one of the permissions set on the player's active character.

Parameters

  • perm String permission ID

Returns

  • Number PERM_ value
  • PERM_NO if the permission is not set or no character is loaded

Player:get_character_permissions()

shared plugins/admin/plugin/lib/meta/sh_player.lua:97

Returns the permissions set on the player's active character, not counting those of the player and of their role. They are networked to every client while the character is loaded. The table is empty when no character is loaded; it must not be modified.

Returns

  • Map PERM_ values keyed by permission ID

Player:get_character_temp_permission(perm)

shared plugins/admin/plugin/lib/meta/sh_player.lua:120

Returns one of the temporary permissions of the player's active character.

Parameters

  • perm String permission ID

Returns

  • Map table with value (PERM_ value) and expires (unix timestamp), or nil if not set

Player:get_character_temp_permissions()

shared plugins/admin/plugin/lib/meta/sh_player.lua:113

Returns the temporary permissions of the player's active character.

Returns

  • Map tables with value and expires (unix timestamp) fields, keyed by permission ID; empty when no character is loaded. The table must not be modified

Player:get_permission(perm)

shared plugins/admin/plugin/lib/meta/sh_player.lua:72

Returns the value of one of the player's individual permissions.

Parameters

  • perm String permission ID

Returns

  • Number PERM_ value
  • PERM_NO if the permission is not set

Player:get_permissions()

shared plugins/admin/plugin/lib/meta/sh_player.lua:65

Returns the permissions set on the player individually, not counting those of their role.

Returns

  • Map PERM_ values keyed by permission ID

Returns the ID of the player's role.

Returns

  • String role ID, 'user' if none has been set

Player:get_role_table()

shared plugins/admin/plugin/lib/meta/sh_player.lua:40

Returns the player's role object.

Returns

  • Role the role, or an empty table if it is not registered

Player:get_temp_permission(perm)

shared plugins/admin/plugin/lib/meta/sh_player.lua:87

Returns one of the player's temporary permissions.

Parameters

  • perm String permission ID

Returns

  • Map table with value (PERM_ value) and expires (unix timestamp), or nil if not set

Player:get_temp_permissions()

shared plugins/admin/plugin/lib/meta/sh_player.lua:80

Returns the player's temporary permissions.

Returns

  • Map tables with value and expires (unix timestamp) fields, keyed by permission ID

Player:hide_vanished_body()

server plugins/admin/plugin/lib/meta/sv_player.lua:260

Makes a vanished player invisible and not solid again after they have respawned, unless they are in observer mode, which hides them in its own way. Server-side only.

Checks whether the player is an admin: a super admin or anyone with the 'moderate' permission.

Returns

  • Boolean

Checks whether the player is at least an assistant: an admin or anyone with the 'staff' permission.

Returns

  • Boolean

Checks whether the player is hidden from other players: vanished, or in observer mode.

Returns

  • Boolean

Checks whether the player has the 'staff' permission.

Returns

  • Boolean

Player:is_super_admin()

shared plugins/admin/plugin/lib/meta/sh_player.lua:15

Checks whether the player is a super admin: a root player or anyone with the 'administrate' permission.

Returns

  • Boolean

Player:run_command(cmd)

server plugins/admin/plugin/lib/meta/sv_player.lua:191

Runs a command as this player, with the usual permission checks.

Parameters

  • cmd String command name and arguments without the leading slash, e.g. 'getup 5'

Player:save_usergroup()

server plugins/admin/plugin/lib/meta/sv_player.lua:36

Writes the player's current name and role to their database record, if they have one.

Player:set_character_permission(perm_id, value)

server plugins/admin/plugin/lib/meta/sv_player.lua:174

Sets one of the permissions of the player's active character, which apply together with the player's own permissions while that character is loaded, see Bolt:get_permission_layer. Writes it to the database and runs the PlayerPermissionChanged hook if the character's value has changed.

Parameters

  • perm_id String permission ID
  • value Number PERM_ALLOW or PERM_NEVER, or PERM_NO to remove the permission

Returns

  • Boolean false if no character is loaded or an argument is not valid

See also

Player:set_character_temp_permission(perm_id, value, duration)

server plugins/admin/plugin/lib/meta/sv_player.lua:185

Gives the player's active character a temporary permission value that takes precedence over its lasting permissions until it expires.

Parameters

  • perm_id String permission ID
  • value Number PERM_ALLOW or PERM_NEVER
  • duration Number seconds until the permission expires

Returns

  • Boolean false if no character is loaded or an argument is not valid

See also

Player:set_permission(perm_id, value)

server plugins/admin/plugin/lib/meta/sv_player.lua:56

Sets one of the player's individual permissions: updates the Permission records on the player's database record (PERM_NO destroys the record and takes it off the list) and the networked table, then runs the PlayerPermissionChanged hook.

Parameters

  • perm_id String permission ID
  • value Number PERM_ALLOW or PERM_NEVER, or PERM_NO to remove the permission

Player:set_permissions(perm_table)

server plugins/admin/plugin/lib/meta/sv_player.lua:47

Replaces the player's networked table of individual permissions. Does not touch the database.

Parameters

  • perm_table Map PERM_ values keyed by permission ID

Player:set_temp_permission(perm_id, value, duration)

server plugins/admin/plugin/lib/meta/sv_player.lua:122

Gives the player a temporary permission value that takes precedence over their regular permissions until it expires. Updates the TempPermission records and the networked table. Giving the value the player already has temporarily adds the duration to the time that is left, up to Bolt.max_temp_duration from now; any other value starts counting from now. The config is sent to the player again if that has changed their right to edit configs.

Parameters

  • perm_id String permission ID
  • value Number PERM_ value, normally PERM_ALLOW or PERM_NEVER
  • duration Number seconds until the permission expires

Player:set_temp_permissions(perm_table)

server plugins/admin/plugin/lib/meta/sv_player.lua:110

Replaces the player's networked table of temporary permissions. Does not touch the database.

Parameters

  • perm_table Map tables with value and expires (unix timestamp) fields, keyed by permission ID

Player:set_vanished(should_vanish)

server plugins/admin/plugin/lib/meta/sv_player.lua:274

Hides the player from everyone without the 'moderate' permission, or shows them again. A player in observer mode keeps the look the Observer plugin gave them; anyone else is made invisible and not solid, and gets their previous color back when they reappear. The weapon is only drawn again when the player carries nothing, since the engine drops the carried object as soon as the weapon is drawn and draws the weapon by itself once the object is let go of. A player who leaves vanish while in observer mode stays hidden as an observer. Sets the player's is_vanished field and notifies nobody.

Parameters

  • should_vanish Boolean true to hide the player, false to show them again

Player:SetUserGroup(group)

server plugins/admin/plugin/lib/meta/sv_player.lua:13

Sets the player's role, overriding the engine method. Networks the role, calls on_role_taken / on_role_set on the roles involved, saves the role to the database unless one of them returns a value, and runs the PlayerUserGroupChanged hook.

Parameters

  • group String optional, defaults to 'user' role ID

Moves the player to a position and unsticks them. The previous position is kept in prev_pos, which the Return command uses.

Parameters

  • pos Vector

Player:update_hidden_players()

server plugins/admin/plugin/lib/meta/sv_player.lua:241

Applies which of the hidden players this player may see to the networking of all of them. Called when the player joins and whenever their permissions change.

Player:update_transmit(receiver)

server plugins/admin/plugin/lib/meta/sv_player.lua:214

Starts or stops networking the player, together with everything attached to them such as their weapons, to one other player, going by whether the player is hidden and whether the receiver has the 'moderate' permission, which lets them see hidden players.

Parameters

  • receiver Player

Player:update_visibility()

server plugins/admin/plugin/lib/meta/sv_player.lua:229

Applies whether the player is hidden to the networking of the player to everyone else and sets their own 'transmission_prevented' net var. Called whenever the player is hidden or shown, and again whenever something new is attached to a hidden player.

Defined in