Hooks called by Admin Mod

Summary

Hooks

Called on the client when the admin panel is created.
Run by the Staff command to get the color of the message text, the same hook the chatbox runs for a regular chat message.
Run by the Staff command to get the color of the sender's name, the same hook the chatbox runs for a regular chat message.
Run by the commands that find their targets themselves (ban add and role remove), for every player they are about to affect, the same way the command interpreter runs it for a command with immunity set.
Run by the admin plugin when a player who has the spawn_chairs permission but not the spawn_vehicles one tries to spawn a chair, in place of the gamemode, which runs it for every other vehicle.
Run on the server by the Changelevel command right before the map changes, so that everything is saved first.
Called on the server after a ban has been created or an existing ban of the same SteamID has been replaced, when the record is in the ban cache and is being saved.
Called on the server after a ban has been lifted: by the ban remove command, from the ban list of the admin panel, or because it has expired by the time its owner tried to join.
Called on both realms while a role is being registered, right after its define_permissions method has run.
Called on the server after a permission of a player has changed in one of the layers that Bolt:get_permission_layer consults: when one of the player's individual permissions has been set with Player:set_permission, and when the value that the player's active character sets for a permission has changed, which happens when a character is loaded, switched or dropped, when a lasting or temporary permission of the loaded character is set or removed, and when a temporary one expires.
Called on the server after a player's role has been set with Player:SetUserGroup.
Called on both realms once all plugins have loaded.
Called on the server when the Changelevel command is about to change the map, after the FLSaveData hook has run, the same way the Restart command calls it.
Called on the server when a connecting player has a ban on record, before the ban is enforced or lifted.
Called on the server when the temporary ban of a connecting player has expired and the admin plugin is about to lift it and leave the connection to the other checks.

Hooks

AddAdminMenuItems(self, self.sidebar)

client plugins/admin/plugin/views/cl_admin.lua:37

Called on the client when the admin panel is created. Add pages to it here with panel:add_panel(id, title, permission); the page itself must be registered with the theme under the same ID, as Bolt:OnThemeLoaded does.

Parameters

  • panel Panel The admin panel, an fl_admin_panel
  • sidebar Panel The sidebar of the admin panel, which holds the page buttons

Called from

Call sites

ChatboxGetMessageColor(actor, text)

shared plugins/admin/plugin/commands/sh_staff.lua:32

Run by the Staff command to get the color of the message text, the same hook the chatbox runs for a regular chat message.

Parameters

  • speaker Player Player who sent the staff message
  • text String The message

Returns

  • Color Color of the text; white when nothing is returned

Called from

Call sites

ChatboxGetPlayerColor(actor, text)

shared plugins/admin/plugin/commands/sh_staff.lua:25

Run by the Staff command to get the color of the sender's name, the same hook the chatbox runs for a regular chat message.

Parameters

  • speaker Player Player who sent the staff message
  • text String The message

Returns

  • Color Color of the name; the color of the sender's team when nothing is returned

Called from

Call sites

CommandCheckImmunity(actor, target, can_equal)

server plugins/admin/plugin/lib/sv_staff.lua:163

Run by the commands that find their targets themselves (ban add and role remove), for every player they are about to affect, the same way the command interpreter runs it for a command with immunity set.

Parameters

  • actor Player Player who runs the command
  • target Player Player the command targets
  • can_equal Boolean Whether a target of the same standing may be affected

Returns

  • Boolean Return false if the target is immune to the actor

Called from

Call sites

FLPlayerSpawnVehicle(actor, model, name, tab)

server plugins/admin/plugin/sv_hooks.lua:94

Run by the admin plugin when a player who has the spawn_chairs permission but not the spawn_vehicles one tries to spawn a chair, in place of the gamemode, which runs it for every other vehicle.

Parameters

  • actor Player The player spawning the chair
  • model String Model of the chair
  • name String Name of the chair in the vehicle list
  • tab Map Vehicle table from the vehicle list

Returns

  • Boolean Return false to prevent the chair from being spawned

Called from

Call sites

Run on the server by the Changelevel command right before the map changes, so that everything is saved first. This is the hook Flux also runs from its periodic save; the gamemode's handler saves the config and runs the SaveData hook.

Call sites

OnBanAdded(steam_id, obj)

server plugins/admin/plugin/lib/sh_admin.lua:712

Called on the server after a ban has been created or an existing ban of the same SteamID has been replaced, when the record is in the ban cache and is being saved.

Parameters

  • steam_id String SteamID that has been banned
  • ban Ban The ban record: name, steam_id, reason, duration (seconds, 0 for a permanent ban), unban_time, admin_name and admin_steam_id

Called from

Call sites

OnBanRemoved(steam_id, dump)

server plugins/admin/plugin/lib/sh_admin.lua:795

Called on the server after a ban has been lifted: by the ban remove command, from the ban list of the admin panel, or because it has expired by the time its owner tried to join.

Parameters

  • steam_id String SteamID that is no longer banned
  • data Map Column values of the deleted ban record

Called from

Call sites

OnDefinePermissions(self)

shared plugins/admin/plugin/lib/classes/sh_role.lua:250

Called on both realms while a role is being registered, right after its define_permissions method has run. The can, cannot and allow_anything globals are still bound to the role, so a handler can adjust its permissions. Roles without a define_permissions method do not run this hook.

Parameters

  • role Role The role being registered

Called from

Call sites

PlayerPermissionChanged(self, perm_id, value)

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

Called on the server after a permission of a player has changed in one of the layers that Bolt:get_permission_layer consults: when one of the player's individual permissions has been set with Player:set_permission, and when the value that the player's active character sets for a permission has changed, which happens when a character is loaded, switched or dropped, when a lasting or temporary permission of the loaded character is set or removed, and when a temporary one expires. The temporary permissions of the player themselves do not run this hook. Use Player:can to learn what the player may do now.

Parameters

  • target Player The player whose permission has changed
  • perm_id String Permission ID
  • value Number New value in the layer that has changed: PERM_ALLOW, PERM_NEVER, or PERM_NO when it was unset

Called from

Call sites

PlayerUserGroupChanged(self, group_obj, old_group_obj)

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

Called on the server after a player's role has been set with Player:SetUserGroup. Either role is nil when its ID does not belong to a registered role.

Parameters

  • target Player The player whose role has changed
  • group Role The player's new role
  • old_group Role The role the player had before

Called from

Call sites

RegisterPermissions()

shared plugins/admin/plugin/sh_plugin.lua:190

Called on both realms once all plugins have loaded. Register permissions here with Bolt:register_permission. Registering a permission does not allow it for anybody: the role files allow permissions to roles with can.

Called from

Call sites

Called on the server when the Changelevel command is about to change the map, after the FLSaveData hook has run, the same way the Restart command calls it. The gamemode's handler saves the data of every player.

Call sites

ShouldCheckBan(steam_id, ip, name)

server plugins/admin/plugin/sv_hooks.lua:31

Called on the server when a connecting player has a ban on record, before the ban is enforced or lifted.

Parameters

  • steam_id String SteamID of the connecting player
  • ip String Address the player connects from
  • name String Name of the connecting player

Returns

  • Boolean Return false to ignore the ban, so that the admin plugin neither rejects the player nor lifts the ban

Called from

Call sites

ShouldExpireBan(steam_id, ip, name)

server plugins/admin/plugin/sv_hooks.lua:42

Called on the server when the temporary ban of a connecting player has expired and the admin plugin is about to lift it and leave the connection to the other checks.

Parameters

  • steam_id String SteamID of the connecting player
  • ip String Address the player connects from
  • name String Name of the connecting player

Returns

  • Boolean Return false to keep the ban, so that the player is rejected with the reason of the ban

Called from

Call sites

Defined in