Skip to content

Action Customization

Customize MonoAdmin's default behaviors for bans, kicks, heals, and revives using the customizable/ directory.

MonoAdmin allows developers to override default behaviors for specific actions. This is useful for integrating with custom frameworks, anti-cheat systems, or specialized server logic.

These customizations are handled via the customizable/ directory within the monoAdmin resource.


Server-side overrides are located in customizable/server.lua. These functions allow you to control what happens when a player is banned or kicked.

local internalName = "Sevent"
CustomizableAction = CustomizableAction or {}
CustomizableAction[internalName] = {}
local intTable = CustomizableAction[internalName]
-- playerId, reason, duration in seconds; 0 = permanent
intTable.onPlayerPunishmentBan = function(player, reason, duration)
-- Default behavior: DropPlayer(player, reason)
DropPlayer(player, reason)
return true, nil
end
intTable.onPlayerPunishmentKick = function(player, reason)
-- Default behavior: DropPlayer(player, reason)
DropPlayer(player, reason)
return true, nil
end
FunctionParametersDescription
onPlayerPunishmentBanplayer, reason, durationTriggered when a player is banned.
onPlayerPunishmentKickplayer, reasonTriggered when a player is kicked.

Client-side overrides are located in customizable/client.lua. These allow you to hook into actions like healing and reviving, which is essential if your server uses a custom ambulance or health system.

local internalName = "events"
CustomizableAction = CustomizableAction or {}
CustomizableAction[internalName] = {}
local intTable = CustomizableAction[internalName]
intTable.revive = function()
if Config.Framework == 'esx' then
TriggerEvent('esx_ambulancejob:revive')
else
local ped = MonoAdmin.State.ped
local coords = GetEntityCoords(ped)
NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, GetEntityHeading(ped), true, false)
SetEntityHealth(ped, GetEntityMaxHealth(ped))
ClearPedBloodDamage(ped)
ResetPedVisibleDamage(ped)
ClearPedTasksImmediately(ped)
end
return true
end
intTable.heal = function()
if Config.Framework == 'esx' then
TriggerEvent('esx_ambulancejob:heal', 'big', true)
else
local ped = MonoAdmin.State.ped
SetEntityHealth(ped, GetEntityMaxHealth(ped))
SetPedArmour(ped, 100)
ClearPedBloodDamage(ped)
ResetPedVisibleDamage(ped)
end
return true
end
FunctionDescription
reviveOverrides the behavior when an admin revives a player.
healOverrides the behavior when an admin heals a player.

  1. Return Values: Ensure your functions return true (and nil for error if applicable) to signify a successful override.
  2. Framework Checks: Use Config.Framework to tailor logic for ESX, QB-Core, or Standalone environments.
  3. State Management: Access local player state via MonoAdmin.State.ped on the client side for optimized performance.