How to Add Webhooks

How to Add Your Webhook (Old & New File Structure)

Webhooks are essential for integrating external services like Discord with your FiveM server. They can be used to log player activity, send notifications, or track in-game events. Below you will find instructions for both the old file structure (editable_server.lua) and the new file structure (server/discord_log.lua).


🔄New Files: Using server/discord_log.lua

This is the recommended and updated method for configuring your webhook.

Step 1: Obtain Your Webhook URL

Create or Use an Existing Webhook: Set up a webhook using your preferred platform (e.g., Discord). Once created, copy the webhook URL.

Keep the URL Secure: Treat your webhook URL like a password. Never share it publicly or store it in unsecured locations.

Step 2: Locate the discord_log.lua File

Access Your Server Files: Connect to your server using FTP or a file manager.

Navigate to the Correct Path: Go to the server directory inside your script folder and locate the discord_log.lua file: resources/[your_script]/server/discord_log.lua

Open the File: Use a text editor such as VS Code or Notepad++ to open it.

Step 3: Insert Your Webhook URL

Find the configuration section that looks like this:

discord = {
    ['webhook'] = 'https://discord.com/api/webhooks/xxxxxxxx/xxxxxxxx',
    ['name'] = 'Rainmad Scripts',
    ['image'] = 'https://cdn.discordapp.com/avatars/869260464775921675/dff6a13a5361bc520ef126991405caae.png?size=1024',
}

Replace the 'webhook' value with your actual Discord webhook URL. Paste it inside the quotation marks. Do not change any other lines unless necessary.

Step 4: Test Your Webhook

  • Restart Your Server to apply the changes.

  • Perform an action that triggers the webhook (e.g., player join, command usage).

  • Check your Discord channel to see if the message was sent.


🗂️ Old Files: Using editable_server.lua

This method was used in older versions of the script.

Step 1: Obtain Your Webhook URL

Create or Use an Existing Webhook: If you haven't already, create a webhook in your preferred service (e.g., Discord, Slack). Copy the webhook URL provided by the service.

Keep the URL Secure: Treat your webhook URL like a password. Do not share it publicly or expose it in unsecured locations.

Step 2: Locate the editable_server.lua File

Access Your Server Files: Connect to your server via FTP or your file manager. Navigate to the directory where your server's scripts are stored.

Open editable_server.lua: Locate the editable_server.lua file in the script directory. Open the file using a text editor like Notepad++ or VS Code.

Step 3: Insert Your Webhook URL

Find the Webhook Section: Search for a comment like -- Webhooks. You should see a block like this:

discord = {
    ['webhook'] = 'https://discord.com/api/webhooks/xxxxxxxx/xxxxxxxx',
    ['name'] = 'Rainmad Scripts',
    ['image'] = 'https://cdn.discordapp.com/avatars/869260464775921675/dff6a13a5361bc520ef126991405caae.png?size=1024',
}

Replace the placeholder webhook URL with your actual one, keeping it inside the quotation marks.

Step 4: Test the Webhook

  • Restart your server.

  • Perform an action that would trigger the webhook.

  • Check your Discord (or other service) to ensure it was received.


⚠️ Troubleshooting & Security Tips

  • Webhook not working? Double-check the URL for typos and ensure it’s placed correctly in the respective file.

  • No events triggered? Confirm that the server is set up to fire the events linked to the webhook.

  • Security Reminder: Never share your webhook URL publicly. Treat it like a password.

Last updated