Protection¶
This page documents hooks in the protection category.
CanDeleteChar(client, character)View Source
Purpose
Determines whether a character can be deleted from the character menu.
Category
Protection
Realm
Client
Parameters
Player client The local player attempting to delete the character.
table|Character character The target character data being evaluated for deletion.
Returns
boolean|nil Return false to block deletion.
Example Usage
hook.Add("CanDeleteChar", "liaExampleCanDeleteChar", function(client, character)
if IsValid(client) and client:IsAdmin() then
return true
end
end)
CanPlayerSwitchChar(client, character, newCharacter)View Source
Purpose
Determines whether a player may switch away from their current character to another one.
Category
Protection
Realm
Shared
Parameters
Player client The player attempting the character switch.
Character character The player's current character.
Character newCharacter The character the player wants to switch to.
Returns
boolean, string|nil Return false and an optional denial message to block the switch.
Example Usage
hook.Add("CanPlayerSwitchChar", "liaExampleCanPlayerSwitchChar", function(client, character, newCharacter)
if character == newCharacter then
return false, "You are already using that character."
end
end)
OnCheaterCaught(client)View Source
Purpose
Called after the anti-cheat timeout flow identifies a player as cheating.
Category
Protection
Realm
Server
Parameters
Player client The player flagged by the anti-cheat flow.
Example Usage
hook.Add("OnCheaterCaught", "liaExampleOnCheaterCaught", function(client)
if not IsValid(client) then return end
print(string.format("[MyModule] handled OnCheaterCaught for %s", client:Name()))
end)
PlayerCheatDetected(client)View Source
Purpose
Called when the anti-cheat system detects or flags suspicious cheating behavior for a player.
Category
Protection
Realm
Server
Parameters
Player client The player detected by the anti-cheat system.
Example Usage
hook.Add("PlayerCheatDetected", "liaExamplePlayerCheatDetected", function(client)
if not IsValid(client) then return end
print(string.format("[MyModule] handled PlayerCheatDetected for %s", client:Name()))
end)