Skip to Content
Mavix

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.lua

Each 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.

Watch outKeep the links secret

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

  1. In Discord, open the channel that should get the logs (for example #ban-logs).
  2. Click the gear next to the channel name: Edit Channel → Integrations → Webhooks.
  3. Press New Webhook. Give it a name if you want (the server sets its own name anyway).
  4. 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 the default link. If default is also empty, that log is off.
  • To send everything to one Discord channel, fill in only default.
  • To turn one channel off while default is set, add its name to disabled in WebhookSettings, for example disabled = { '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

ChannelWhat gets loggedSent by
defaultEvery channel below that has no link of its own–
admin_bansBans from the tablet, offline bans and unbans, with the player's identifiers and the staff membermvx_admin
admin_actionsKicks (and any other script that calls the old sendToDiscord export)mvx_admin
anticheatBlacklisted props spawned by a player, and bans made by the anticheatmvx_admin
connectionsPlayers joining and leaving, with identifiers and the leave reasonmvx_admin
admin_commandsAdmin commands like /car, /dv, /fix, /setjob, /giveitem, /setgroup, /tpm, /noclip. Only when Config.AdminLogging = true in es_extended/config.luaes_extended
reportsA new player report (title, type, first message, player) and a closed report (who closed it)mvx_scripts report
paycheckEvery paycheck. Only when Config.LogPaycheck = true in es_extended/config.luaes_extended
blackmarketBlack market buys (what, for how much) and forged orders (cheat attempts)mvx_blackmarket
phoneBank transfers sent from the phonemvx_phone
drugsField pickups, processing, dealer buys, using drugs, and refused or cheated actions (yellow)mvx_drugs
robberyA player starts robbing another player, and what was takenmvx_scripts player robbery
heistsHumane Labs, Pacific Bank, train and Vangelico: who started it and what they earnedmvx_heists
housingStorage opened in a house, lockpicked houses and police breachesmvx_housing
mechanicOrders, tablet tuning, servicing, invoices, mechanic shop, nitrous, repairs, duty, hiring and firingmvx_mechanic
mechanic_securityMechanic security warnings: refused requests and bad vehicle datamvx_mechanic
esxAny other script that calls ESX.DiscordLog with its own log namees_extended

Bot name, picture and colours

Below the channels, WebhookSettings sets how the logs look:

OptionWhat it changesExample
botNameName shown on every log'Mavix Logs'
avatarUrlPicture of the bot (an https link to a png or jpg). Empty = Discord's own picture''
footerSmall text under every log; the channel name is added after it'Mavix'
colorsColour of the line on the left, per level: info blue, success green, warning yellow, error rederror = 15158332
mentionRoleIdA Discord role pinged on error logs (bans, forged orders, break-ins). Empty = never ping'123456789012345678'
mentionLevelsWhich levels ping that role{ error = true }
disabledChannels 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.

NoteSafe by default

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" and set fivemanage:key "<your Fivemanage logs token>".
  • ox_inventory image check: set inventory:webhook "<link>" in server-data/oxinventory.cfg checks the picture link of items and posts each one there. Leave it empty unless items get custom pictures.

Admin Quick Test

Setup

  1. Make a test webhook in a private Discord channel (see How to make a Discord webhook).
  2. Paste it into admin_actions in modules/webhooks/config.lua, save, and type restart mvx_scripts in the txAdmin console. The console prints webhooks: 1 of 17 log channels send to Discord.

Test command

  1. In the txAdmin console type webhooktest. It lists the channels that are On and Off; admin_actions is On.
  2. Type webhooktest admin_actions. A green Webhook test log appears in your Discord channel within a few seconds.
  3. Type webhooktest housing. It says the channel has no link and nothing is sent.

A real log

  1. 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.
  2. Paste the same link into default and leave housing empty. Restart mvx_scripts, then open the storage of a house you own. A Storage log appears: empty channels fall back to default.

Clean up

  1. Delete the test webhook in Discord, or replace it with the real ones for each channel.

On this page