Webhooks & Logs
Every Discord log on the server, set in one file.
What it is
Many systems post a log to Discord when something happens: a ban, a robbery, a house break-in, a black market buy. All of these logs are set in one file:
server-data/resources/[scripts]/[standalone]/mvx_scripts/modules/webhooks/config.luaEach log has a channel name, for example admin_bans or housing. You paste a Discord webhook link next to a channel,
and that log starts showing up in Discord. A channel with no link sends nothing.
Anyone with a webhook link can post into your Discord channel. Never share the config file with links in it, never put it on GitHub, and never paste a link in chat. This file is only read by the server; players never get it.
How to make a Discord webhook
- In Discord, open the channel that should get the logs (for example
#ban-logs). - Click the gear next to the channel name: Edit Channel → Integrations → Webhooks.
- Press New Webhook. Give it a name if you want (the server sets its own name anyway).
- Press Copy Webhook URL. The link starts with
https://discord.com/api/webhooks/.
You can make one webhook per Discord channel, or use the same link for several log channels.
Where to paste it
Open modules/webhooks/config.lua and paste the link between the quotes of the channel:
Webhooks = {
default = '',
admin_bans = 'https://discord.com/api/webhooks/123.../abc...',
housing = '',
-- ...
}Then restart mvx_scripts (in the txAdmin console: restart mvx_scripts) or the whole server.
Rules
- An empty channel (
'') uses thedefaultlink. Ifdefaultis also empty, that log is off. - To send everything to one Discord channel, fill in only
default. - To turn one channel off while
defaultis set, add its name todisabledinWebhookSettings, for exampledisabled = { 'connections' }.
Or keep the links in server.cfg. A line in server-data/server.cfg beats the file:
set mvx_webhook_admin_bans "https://discord.com/api/webhooks/..."
set mvx_webhook_default "https://discord.com/api/webhooks/..."The name is always mvx_webhook_ + the channel name. Use set, never setr: setr would send the link to every player.
Every channel
| Channel | What gets logged | Sent by |
|---|---|---|
default | Every channel below that has no link of its own | – |
admin_bans | Bans from the tablet, offline bans and unbans, with the player's identifiers and the staff member | mvx_admin |
admin_actions | Kicks (and any other script that calls the old sendToDiscord export) | mvx_admin |
anticheat | Blacklisted props spawned by a player, and bans made by the anticheat | mvx_admin |
connections | Players joining and leaving, with identifiers and the leave reason | mvx_admin |
admin_commands | Admin commands like /car, /dv, /fix, /setjob, /giveitem, /setgroup, /tpm, /noclip. Only when Config.AdminLogging = true in es_extended/config.lua | es_extended |
reports | A new player report (title, type, first message, player) and a closed report (who closed it) | mvx_scripts report |
paycheck | Every paycheck. Only when Config.LogPaycheck = true in es_extended/config.lua | es_extended |
blackmarket | Black market buys (what, for how much) and forged orders (cheat attempts) | mvx_blackmarket |
phone | Bank transfers sent from the phone | mvx_phone |
drugs | Field pickups, processing, dealer buys, using drugs, and refused or cheated actions (yellow) | mvx_drugs |
robbery | A player starts robbing another player, and what was taken | mvx_scripts player robbery |
heists | Humane Labs, Pacific Bank, train and Vangelico: who started it and what they earned | mvx_heists |
housing | Storage opened in a house, lockpicked houses and police breaches | mvx_housing |
mechanic | Orders, tablet tuning, servicing, invoices, mechanic shop, nitrous, repairs, duty, hiring and firing | mvx_mechanic |
mechanic_security | Mechanic security warnings: refused requests and bad vehicle data | mvx_mechanic |
esx | Any other script that calls ESX.DiscordLog with its own log name | es_extended |
Bot name, picture and colours
Below the channels, WebhookSettings sets how the logs look:
| Option | What it changes | Example |
|---|---|---|
botName | Name shown on every log | 'Mavix Logs' |
avatarUrl | Picture of the bot (an https link to a png or jpg). Empty = Discord's own picture | '' |
footer | Small text under every log; the channel name is added after it | 'Mavix' |
colors | Colour of the line on the left, per level: info blue, success green, warning yellow, error red | error = 15158332 |
mentionRoleId | A Discord role pinged on error logs (bans, forged orders, break-ins). Empty = never ping | '123456789012345678' |
mentionLevels | Which levels ping that role | { error = true } |
disabled | Channels turned off without deleting their link | { 'connections' } |
To get a role ID: in Discord turn on User Settings → Advanced → Developer Mode, then Server Settings → Roles, right-click the role → Copy Role ID.
Text typed by players (report titles, names, items) can never ping @everyone or @here: those words are broken before they reach Discord.
Logs wait in a line per link and go out in groups, so a busy evening never hits Discord's limits. If Discord says "too many requests",
the log waits and tries again.
Logs that have their own setting
- ox_inventory and ox_lib logs (item moves, shop buys, admin item commands) do not go to Discord. They go to Fivemanage, Datadog or
Grafana Loki. To turn them on, add to
server.cfg:set ox:logger "fivemanage"andset fivemanage:key "<your Fivemanage logs token>". - ox_inventory image check:
set inventory:webhook "<link>"inserver-data/oxinventory.cfgchecks the picture link of items and posts each one there. Leave it empty unless items get custom pictures.
Admin Quick Test
Setup
- Make a test webhook in a private Discord channel (see How to make a Discord webhook).
- Paste it into
admin_actionsinmodules/webhooks/config.lua, save, and typerestart mvx_scriptsin the txAdmin console. The console printswebhooks: 1 of 17 log channels send to Discord.
Test command
- In the txAdmin console type
webhooktest. It lists the channels that are On and Off;admin_actionsis On. - Type
webhooktest admin_actions. A green Webhook test log appears in your Discord channel within a few seconds. - Type
webhooktest housing. It says the channel has no link and nothing is sent.
A real log
- Have a second player online. Press HOME, click the player and press Kick with the reason "test". A red Player Kicked log appears in Discord with the name, identifiers, reason and your name as executioner.
- Paste the same link into
defaultand leavehousingempty. Restartmvx_scripts, then open the storage of a house you own. A Storage log appears: empty channels fall back todefault.
Clean up
- Delete the test webhook in Discord, or replace it with the real ones for each channel.