Kartik Scripts

Setup PDF Excel Exports

Setup PDF & Excel Exports

Kartik MDT V2 allows officers to export high-quality A4 print dossiers (PDFs) and server ledger/activity logs (Excel spreadsheets/XLSX). Rather than expecting players to copy links from the game, the MDT utilizes a Discord Bot to securely deliver beautiful, interactive embeds directly to their Discord Direct Messages (DMs) containing direct download links!


๐Ÿ“‹ What This Feature Does

When an officer exports a report, citizen dossier, or duty ledger:

  1. The MDT generates a secure, hosted file link.
  2. The server script checks the player's Discord identifier (or database mapping).
  3. The built-in bot opens a secure Direct Message (DM) channel with the player.
  4. The bot posts a premium, color-coded interactive card with a quick action button (e.g., "View & Download PDF" or "Download Excel Spreadsheet").

๐Ÿ› ๏ธ How to Create & Retrieve a Discord Bot Token

To enable this feature, you must have a Discord Bot registered in the Discord Developer Portal.

1. Register Your Bot

  1. Go to the Discord Developer Portal.
  2. Select your existing application (or click New Application and create one).
  3. Navigate to the Bot tab on the left sidebar.
  4. If you haven't added a bot to the application yet, click Add Bot.

2. Copy the Token

  1. Under the Bot's username section, locate the Token area.
  2. Click Reset Token (you will need to enter your Discord 2FA code if enabled).
  3. Copy the token immediately and save it in a safe place.

[!WARNING] Keep this token secret! Anyone who obtains your bot token can control your bot. Never share it or commit it to public GitHub repositories.

3. (Optional) Enable Gateway Intents

While sending direct messages doesn't strictly require privileged intents, it is highly recommended to enable them for optimal performance and compatibility:

  1. Scroll down on the Bot page to the Privileged Gateway Intents section.
  2. Toggle ON the Presence Intent, Server Members Intent, and Message Content Intent.
  3. Click Save Changes.

โš™๏ธ Configuration in server_config.lua

Once you have your token, open shared/server_config.lua and paste the token into ServerConfig.DiscordBotToken:

-- Discord Bot Token for sending PDF files directly to players' Discord DMs
ServerConfig.DiscordBotToken = "MTI......" -- Paste your bot token here

๐Ÿ“‚ PDF & Image Storage Providers (ServerConfig.Gallery)

In order for the Discord Bot to send files (like PDFs) or for features like gallery screenshots, CCTV captures, and mugshots to work, the files must be uploaded and hosted securely. Kartik MDT V2 uses ServerConfig.Gallery to manage storage backends.

Provider Options

  • discord: Uploads files directly to a Discord Channel using a Webhook URL. Files are served via Discord CDN (Fast and free).
  • fivemanage: Optimized media upload service specifically for FiveM resources.
  • gofile: Free, unlimited-size file sharing network that generates public download links.
  • fivemrr: FiveM Reports & Records webhook platform integration.

Configuration

Open your shared/server_config.lua file and locate ServerConfig.Gallery:

ServerConfig.Gallery = {
    -- Provider used for gallery screenshots, CCTV captures, mugshots, etc.
    -- Options: "discord", "fivemanage", "fivemrr", or "gofile"
    Provider = "discord",

    -- Provider specifically used for hosting PDF document exports (citizen/incident dossiers)
    -- Options: "discord", "fivemanage", "fivemrr", or "gofile"
    PdfProvider = "discord",

    -- 1. Discord Webhook Settings (Required if provider or PdfProvider is "discord")
    Discord = {
        WebhookURL = "YOUR_DISCORD_WEBHOOK_URL",
    },

    -- 2. FiveManage Settings (Required if provider or PdfProvider is "fivemanage")
    FiveManage = {
        Token = "YOUR_FIVEMANAGE_API_TOKEN",
    },

    -- 3. GoFile Settings (Required if provider or PdfProvider is "gofile")
    GoFile = {
        Token = "YOUR_GOFILE_PROFILE_TOKEN",
    },

    -- 4. FiveMRR Settings (Required if provider or PdfProvider is "fivemrr")
    FiveMRR = {
        WebhookURL = "YOUR_FIVEMRR_WEBHOOK",
    }
}

[!TIP] You can separate the hosting for in-game screenshots and official PDF documents. For example, you can set Provider = "discord" for quick in-game media and PdfProvider = "gofile" for PDF exports to keep them cleanly separated!

On this page