Administration¶
This page documents hooks in the administration category.
AddToAdminStickHUD(client, target, information)View Source
Purpose
Allows modules to append extra text lines to the admin stick HUD for the currently traced target.
Category
Administration
Realm
Client
Parameters
Player client The local player viewing the admin stick HUD.
Entity target The current entity or player targeted by the admin stick.
table information The mutable array of text lines that will be rendered in the HUD panel.
Example Usage
hook.Add("AddToAdminStickHUD", "liaExampleAddToAdminStickHUD", function(client, target, information)
if IsValid(target) and target:isDoor() then
information[#information + 1] = "Door ID: " .. target:MapCreationID()
end
end)
AdminStickAddModels(modList)View Source
Purpose
Allows clientside code to add extra model definitions to the admin stick model picker before they are displayed.
Category
Administration
Realm
Client
Parameters
table modList The mutable array of model definitions with `name` and `mdl` fields.
Example Usage
hook.Add("AdminStickAddModels", "liaExampleAdminStickAddModels", function(modList)
modList[#modList + 1] = {
name = "Citizen Male",
mdl = "models/Humans/Group01/male_01.mdl"
}
end)
CharListColumns(columns)View Source
Purpose
Allows code to add extra columns to the administration character list.
Category
Administration
Realm
Client
Parameters
table columns The mutable list of character list column definitions.
Example Usage
hook.Add("CharListColumns", "liaExampleCharListColumns", function(columns)
columns[#columns + 1] = {
name = "SteamID",
field = "steamID"
}
end)
CharListEntry(entry, row)View Source
Purpose
Allows code to append extra values to a generated character list row before it is sent to clients.
Category
Administration
Realm
Server
Parameters
table entry The character entry data being serialized.
table row The mutable row data that will be sent to the client.
Example Usage
hook.Add("CharListEntry", "liaExampleCharListEntry", function(entry, row)
if not istable(entry) then return end
entry.exampleHandled = true
end)
GetAdminESPTarget(ent, client)View Source
Purpose
Allows clientside code to override which entity should be treated as the admin ESP target.
Category
Administration
Realm
Client
Parameters
Entity ent The entity currently under consideration.
Player client The local player drawing admin ESP.
Returns
Entity|false|nil Return a replacement target entity, or false to suppress the current target.
Example Usage
hook.Add("GetAdminESPTarget", "liaExampleGetAdminESPTarget", function(ent, client)
if not IsValid(client) then return end
print(string.format("[MyModule] handled GetAdminESPTarget for %s", client:Name()))
end)
GetAdminStickLists(target, lists)View Source
Purpose
Allows modules to contribute structured submenu definitions for the admin stick based on the current target entity.
Category
Administration
Realm
Client
Parameters
Entity target The entity currently selected or hovered by the admin stick.
table lists The mutable array that receives generated list definitions with categories, subcategories, and items.
Example Usage
hook.Add("GetAdminStickLists", "liaExampleGetAdminStickLists", function(target, lists)
if IsValid(target) and target:isDoor() then
lists[#lists + 1] = {
name = "Example",
category = "doorManagement",
subcategory = "example",
items = {
{
name = "Print Door ID",
callback = function(currentTarget)
print(currentTarget:MapCreationID())
end
}
}
}
end
end)
OnAdminSystemLoaded(groups, privileges)View Source
Purpose
Called after the administration system finishes loading usergroups and privileges.
Category
Administration
Realm
Server
Parameters
table groups The registered administration groups.
table privileges The registered privilege definitions.
Example Usage
hook.Add("OnAdminSystemLoaded", "liaExampleOnAdminSystemLoaded", function(groups, privileges)
print("[MyModule] handled OnAdminSystemLoaded")
end)
OnlineStaffDataReceived(staffData)View Source
Purpose
Runs after the online-staff summary payload arrives on the client so UI code can refresh with the latest staff data.
Category
Administration
Realm
Client
Parameters
table staffData The decoded online-staff summary array received from the server.
Example Usage
hook.Add("OnlineStaffDataReceived", "liaExampleOnlineStaffDataReceived", function(staffData)
print("Online staff entries:", #staffData)
end)
OnPrivilegeRegistered(privilege)View Source
Purpose
Called after a new administration privilege is registered.
Category
Administration
Realm
Server
Parameters
table privilege The registered privilege definition.
Example Usage
hook.Add("OnPrivilegeRegistered", "liaExampleOnPrivilegeRegistered", function(privilege)
print("[MyModule] handled OnPrivilegeRegistered")
end)
OnPrivilegeUnregistered(privilege)View Source
Purpose
Called after an administration privilege is removed.
Category
Administration
Realm
Server
Parameters
table privilege The privilege definition that was removed.
Example Usage
hook.Add("OnPrivilegeUnregistered", "liaExampleOnPrivilegeUnregistered", function(privilege)
print("[MyModule] handled OnPrivilegeUnregistered")
end)
OnSetUsergroup(sid, newGroup, source, player)View Source
Purpose
Called after the administration system changes a player's usergroup.
Category
Administration
Realm
Server
Parameters
string sid The SteamID being updated.
string newGroup The new usergroup name.
string source optional The source or provider that triggered the change.
Player player optional The online player object, if available.
Example Usage
hook.Add("OnSetUsergroup", "liaExampleOnSetUsergroup", function(sid, newGroup, source, player)
print("[MyModule] handled OnSetUsergroup")
end)
OnUsergroupCreated(groupName, groupData)View Source
OnUsergroupPermissionsChanged(groupName, groupData)View Source
Purpose
Called after a usergroup's permissions are changed.
Category
Administration
Realm
Server
Parameters
Example Usage
hook.Add("OnUsergroupPermissionsChanged", "liaExampleOnUsergroupPermissionsChanged", function(groupName, groupData)
if not istable(groupData) then return end
groupData.exampleHandled = true
end)
OnUsergroupRemoved(groupName)View Source
Purpose
Called after an administration usergroup is removed.
Category
Administration
Realm
Server
Parameters
string groupName The removed usergroup name.
Example Usage
hook.Add("OnUsergroupRemoved", "liaExampleOnUsergroupRemoved", function(groupName)
print("[MyModule] handled OnUsergroupRemoved")
end)
OnUsergroupRenamed(oldName, newName)View Source
OpenAdminStickUI(target)View Source
Purpose
Runs when the admin stick requests its management UI for a traced target and the client should build or replace the active admin stick menu.
Category
Administration
Realm
Client
Parameters
Entity target The targeted entity that the admin stick is attempting to manage.
Example Usage
hook.Add("OpenAdminStickUI", "liaExampleOpenAdminStickUI", function(target)
if IsValid(target) then
print("Opening admin stick UI for:", target:GetClass())
end
end)
PlayerGagged(target, admin)View Source
PlayerMuted(target, admin)View Source
PlayerUngagged(target, admin)View Source
Purpose
Called after a player is ungagged.
Category
Administration
Realm
Server
Parameters
Example Usage
hook.Add("PlayerUngagged", "liaExamplePlayerUngagged", function(target, admin)
if not IsValid(target) then return end
print(string.format("[MyModule] handled PlayerUngagged for %s", target:Name()))
end)
PlayerUnmuted(target, admin)View Source
Purpose
Called after a player is unmuted.
Category
Administration
Realm
Server
Parameters
Example Usage
hook.Add("PlayerUnmuted", "liaExamplePlayerUnmuted", function(target, admin)
if not IsValid(target) then return end
print(string.format("[MyModule] handled PlayerUnmuted for %s", target:Name()))
end)
PopulateAdminStick(currentMenu, currentTarget, currentStores)View Source
Purpose
Runs while the admin stick menu is being populated so modules can add menu options and submenu groups for the current target.
Category
Administration
Realm
Client
Parameters
Panel currentMenu The active admin stick context menu being populated.
Entity currentTarget The entity currently targeted by the admin stick.
table currentStores The mutable store table used to cache created category and subcategory menus.
Example Usage
hook.Add("PopulateAdminStick", "liaExamplePopulateAdminStick", function(currentMenu, currentTarget, currentStores)
if IsValid(currentMenu) and IsValid(currentTarget) and currentTarget:isDoor() then
currentMenu:AddOption("Print Door ID", function()
print(currentTarget:MapCreationID())
end):SetIcon("icon16/information.png")
end
end)
RunAdminSystemCommand(cmd, victim, dur, reason)View Source
Purpose
Allows clientside code to handle an admin command before the chat-command fallback runs.
Category
Administration
Realm
Client
Parameters
string cmd The admin command being executed.
Player|string victim The target player or identifier.
number dur optional The optional duration for timed commands.
string reason optional The optional reason text supplied with the command.
Returns
boolean|nil, function|nil Return true and a callback to handle the command through the hook.
Example Usage
hook.Add("RunAdminSystemCommand", "liaExampleRunAdminSystemCommand", function(cmd, victim, dur, reason)
if cmd == "goto" and victim then
return true, function()
chat.AddText(Color(255, 200, 0), "Opening a custom goto confirmation for ", tostring(victim))
end
end
end)
ShowPlayerOptions(target, options)View Source
Purpose
Allows modules to append clickable player actions to the scoreboard options menu for a target player.
Category
Administration
Realm
Client
Parameters
Player target The player whose options menu is being built.
table options The mutable array of option tables consumed by the scoreboard UI.
Example Usage
hook.Add("ShowPlayerOptions", "liaExampleShowPlayerOptions", function(target, options)
if target:getChar() then
options[#options + 1] = {
name = "Print Name",
image = "icon16/information.png",
func = function()
print(target:getChar():getName())
end
}
end
end)