Skip to content

Developer Events

A comprehensive guide to the Lua events exposed by monoAdmin for external script integration.

monoAdmin exposes a wide variety of server and client-side events that allow external scripts to react to admin actions, player lifecycles, and session state changes.

You can listen for these events using the standard FiveM AddEventHandler.

-- Server-side listener example
AddEventHandler('monoadmin:action:kick_player', function(data)
print(('Player %d was kicked. Reason: %s'):format(data.target_server_id, data.reason))
end)
-- Client-side listener example (client scripts only)
AddEventHandler('monoadmin:action:mode_changed', function(data)
print(('Mode changed to: %s'):format(data.mode))
end)

These events fire on the server after admin commands are executed via the Web Panel.

Fires when a player is kicked by an admin.

FieldTypeDescription
target_server_idnumberServer ID of the kicked player
reasonstringKick reason message
command_idstringUnique command identifier
AddEventHandler('monoadmin:action:kick_player', function(data)
-- Log to Discord, database, etc.
print(('[MonoAdmin] Kicked player %d: %s'):format(data.target_server_id, data.reason))
end)

Fires when a player is banned by an admin.

FieldTypeDescription
target_server_idnumberServer ID of the banned player
reasonstringBan reason message
durationnumberBan duration in seconds (0 = permanent)
command_idstringUnique command identifier
AddEventHandler('monoadmin:action:ban_player', function(data)
local durationText = data.duration > 0 and ('%d seconds'):format(data.duration) or 'permanent'
print(('[MonoAdmin] Banned player %d for %s: %s'):format(data.target_server_id, durationText, data.reason))
end)

Fires when an admin sets a player’s job.

FieldTypeDescription
target_server_idnumberServer ID of the target player
jobstringJob name
gradenumberJob grade/rank
command_idstringUnique command identifier
AddEventHandler('monoadmin:action:set_job', function(data)
print(('[MonoAdmin] Set player %d job to %s (grade %d)'):format(data.target_server_id, data.job, data.grade))
end)

Fires when an admin gives an item to a player.

FieldTypeDescription
target_server_idnumberServer ID of the target player
itemstringItem name/identifier
amountnumberQuantity given
command_idstringUnique command identifier
AddEventHandler('monoadmin:action:give_item', function(data)
print(('[MonoAdmin] Gave %dx %s to player %d'):format(data.amount, data.item, data.target_server_id))
end)

Fires when an admin spawns a vehicle for a player.

FieldTypeDescription
target_server_idnumberServer ID of the target player
modelstringVehicle model name
network_idnumberNetwork ID of spawned vehicle
command_idstringUnique command identifier
AddEventHandler('monoadmin:action:spawn_vehicle', function(data)
print(('[MonoAdmin] Spawned %s for player %d (netId: %d)'):format(data.model, data.target_server_id, data.network_id))
end)

Fires when an admin deletes a player’s vehicle.

FieldTypeDescription
target_server_idnumberServer ID of the target player
command_idstringUnique command identifier
AddEventHandler('monoadmin:action:delete_vehicle', function(data)
print(('[MonoAdmin] Deleted vehicle for player %d'):format(data.target_server_id))
end)

These events fire on the server when admins use the In-Game Control Panel.

Fires when an admin changes their player mode.

FieldTypeDescription
sourcenumberServer ID of the admin
user_idnumberMonoAdmin user ID
modestringMode name (NoClip, Freecam, GodMode, SuperJump, Normal)
AddEventHandler('monoadmin:action:player_mode', function(data)
print(('[MonoAdmin] Admin %d enabled %s mode'):format(data.source, data.mode))
end)

Fires when an admin teleports to waypoint.

FieldTypeDescription
sourcenumberServer ID of the admin
user_idnumberMonoAdmin user ID
destinationtable{ x, y, z } coordinates
AddEventHandler('monoadmin:action:teleport_waypoint', function(data)
print(('[MonoAdmin] Admin %d teleported to %.1f, %.1f, %.1f'):format(
data.source, data.destination.x, data.destination.y, data.destination.z
))
end)

Fires when an admin repairs their vehicle.

FieldTypeDescription
sourcenumberServer ID of the admin
user_idnumberMonoAdmin user ID
AddEventHandler('monoadmin:action:fix_vehicle', function(data)
print(('[MonoAdmin] Admin %d repaired their vehicle'):format(data.source))
end)

Fires when an admin heals themselves.

FieldTypeDescription
sourcenumberServer ID of the admin
user_idnumberMonoAdmin user ID
AddEventHandler('monoadmin:action:heal_self', function(data)
print(('[MonoAdmin] Admin %d healed themselves'):format(data.source))
end)

These events fire on the client (local to the admin using the panel).

Fires when spectating begins.

FieldTypeDescription
target_server_idnumberServer ID of player being spectated
target_namestringName of player being spectated
AddEventHandler('monoadmin:action:spectate_start', function(data)
print(('Now spectating %s (%d)'):format(data.target_name, data.target_server_id))
end)

Fires when spectating ends. Payload is empty.

AddEventHandler('monoadmin:action:spectate_stop', function(data)
print('Stopped spectating')
end)

Fires when player modes are toggled.

FieldTypeDescription
modestringMode that was just toggled
active_modestableArray of currently active mode names
AddEventHandler('monoadmin:action:mode_changed', function(data)
print(('Toggled mode: %s'):format(data.mode))
print(('Active modes: %s'):format(table.concat(data.active_modes, ', ')))
end)

These events fire on the server during player session lifecycle.

Fires when a player session begins (after spawn delay).

FieldTypeDescription
session_idstringUnique session identifier
server_idnumberPlayer’s server ID
namestringPlayer name
identifierstablePlayer identifiers (license, discord, etc.)
ip_addressstringPlayer IP address
AddEventHandler('monoadmin:session:start', function(data)
print(('[Session] Started for %s (ID: %d)'):format(data.name, data.server_id))
end)

Fires when a player fully loads with framework data.

FieldTypeDescription
server_idnumberPlayer’s server ID
namestringPlayer name
identifierstablePlayer identifiers
ip_addressstringPlayer IP address
jobstring|nilPlayer’s job (if framework present)
positiontable|nil{ x, y, z } spawn position
groupstringPermission group (e.g., ‘user’, ‘admin’)
AddEventHandler('monoadmin:player:joined', function(data)
-- Custom welcome message
TriggerClientEvent('chat:addMessage', data.server_id, {
args = { 'Server', 'Welcome to the server, ' .. data.name .. '!' }
})
end)

Fires when a player session ends.

FieldTypeDescription
session_idstringSession identifier
server_idnumberPlayer’s server ID
quit_reasonstringReason for disconnect
last_positiontable|nil{ x, y, z } last known position
AddEventHandler('monoadmin:session:end', function(data)
print(('[Session] Ended for server ID %d: %s'):format(data.server_id, data.quit_reason))
end)

Fires when a player disconnects.

FieldTypeDescription
server_idnumberPlayer’s server ID
identifierstringPrimary identifier
session_idstring|nilSession ID if available
quit_reasonstringReason for disconnect
AddEventHandler('monoadmin:player:left', function(data)
print(('[%d] Player left: %s'):format(data.server_id, data.quit_reason))
end)

local WEBHOOK_URL = 'https://discord.com/api/webhooks/...'
AddEventHandler('monoadmin:action:ban_player', function(data)
local playerName = GetPlayerName(data.target_server_id) or 'Unknown'
local duration = data.duration > 0 and ('%d hours'):format(data.duration / 3600) or 'Permanent'
PerformHttpRequest(WEBHOOK_URL, function() end, 'POST', json.encode({
embeds = {{
title = '🔨 Player Banned',
color = 16711680,
fields = {
{ name = 'Player', value = playerName, inline = true },
{ name = 'Duration', value = duration, inline = true },
{ name = 'Reason', value = data.reason, inline = false }
}
}}
}), { ['Content-Type'] = 'application/json' })
end)
local modeUsage = {}
AddEventHandler('monoadmin:action:player_mode', function(data)
modeUsage[data.source] = modeUsage[data.source] or { count = 0, lastUsed = 0 }
local now = os.time()
local record = modeUsage[data.source]
-- Reset counter if more than 60 seconds since last use
if now - record.lastUsed > 60 then
record.count = 0
end
record.count = record.count + 1
record.lastUsed = now
-- Alert if suspiciously high usage
if record.count > 20 then
print(('[ALERT] Admin %d is toggling modes excessively (%d times)'):format(data.source, record.count))
end
end)
local sessions = {}
AddEventHandler('monoadmin:session:start', function(data)
sessions[data.server_id] = {
startTime = os.time(),
name = data.name
}
end)
AddEventHandler('monoadmin:session:end', function(data)
local session = sessions[data.server_id]
if session then
local duration = os.time() - session.startTime
print(('[Stats] %s played for %d minutes'):format(session.name, duration / 60))
sessions[data.server_id] = nil
end
end)