Config File

Here is a copy of the config file.

Config = {}

Config.Debug = false -- Set to false in production



Config.Commands = {

    report = {command = "report", description = "Open report menu"},

    refresh_report_permissions = {command = "refresh_report_permissions", description = "Refresh report permissions"},

}



Config.MaxReportsPerPlayer = 3 -- Maximum number of reports a player can create before being blocked from creating more



Config.AdminChecker = function(source)

    --[[ -- Standalone

    return IsPlayerAceAllowed(source, "ez_reports.staff")

    ]]



    -- VorpCore

    local StaffGroups = { -- Add groups which are allowed to see all reports

        ["owner"] = true,

        ["superadmin"] = true,

        ["admin"] = true,

        ["headmoderator"] = true,

        ["moderator"] = true,

        ["discordmoderator"] = true,

        ["helper"] = false,

    }

    if not Core then Core = exports.vorp_core:GetCore() end

    local user = Core.getUser(source) -- Uses the group from user table. Not character table.

    if not user then return false end

    return StaffGroups[user.getGroup] or false

end



Config.PlayerJoin = {

    --[[ -- Standalone

    event = "playerJoining", -- Event to trigger when a player joins the server

    callback = function()

        local source = source

        local player = AddPlayer(source)

        RefreshPlayerReports(player)

        TriggerClientEvent('ez_reports:client:refreshPermissions', source, player)

    end,]]



    -- VorpCore. If your using vorp core permissions for admins you require to wait as the user is nil when playerJoining.

    event = "vorp:SelectedCharacter",

    callback = function(source, character)

        local source = source

        local player = AddPlayer(source)

        RefreshPlayerReports(player)

        TriggerClientEvent('ez_reports:client:refreshPermissions', source, player)

    end,

}



Config.Permissions = {

    Create = function(source)

        -- You should allow all players generally but if you want to exclude some players, you can use this function to check their permissions.

        return true -- Allow all players to create reports.

    end,

    Delete = function(source) -- MUST BE AN ADMIN TO VIEW THE BUTTON TO DELETE A REPORT SO IT DOES NOT SHOW FOR PLAYERS.

        --[[ -- Standalone

        return Config.AdminChecker(source) -- Allow admins to delete reports

        ]]



        -- VorpCore

        local StaffGroups = {

            ["owner"] = true,

            ["superadmin"] = true,

            ["admin"] = true,

        }

        if not Core then Core = exports.vorp_core:GetCore() end

        local user = Core.getUser(source)

        if not user then return false end

        return StaffGroups[user.getGroup] or false -- Only allow owner and superadmin of the server to delete reports

    end,

    Close = function(source)

        return true -- Allow all admins and report creators to close reports

    end,

    Reopen = function(source) -- MUST BE AN ADMIN TO VIEW THE BUTTON TO REOPEN A REPORT SO IT DOES NOT SHOW FOR PLAYERS.

        return Config.AdminChecker(source) -- Allow admins to reopen reports

    end,

    AdminActions = function(source) -- MUST BE AN ADMIN TO VIEW THE BUTTON TO PERFORM ADMIN ACTIONS SO IT DOES NOT SHOW FOR PLAYERS.

        --[[ -- Standalone

        return Config.AdminChecker(source) -- Allow admins to reopen reports

        ]]



        -- VorpCore

        local StaffGroups = {

            ["owner"] = true,

            ["superadmin"] = true,

            ["admin"] = true,

            ["headmoderator"] = true,

            ["moderator"] = true,

            ["discordmoderator"] = false,

            ["helper"] = false,

        }

        if not Core then Core = exports.vorp_core:GetCore() end

        local user = Core.getUser(source)

        if not user then return false end

        return StaffGroups[user.getGroup] or false

    end,

}



Config.Database = {

    enabled = true, -- Set to false to disable database usage where it will not save reports and they will delete after server restart

    tableChecker = true, -- Set to false to disable table checking, RECOMMENDED TO KEEP THIS TRUE

    deleteClosedReportsAfterRestart = false, -- Set to false to keep closed reports in the database after server restart

}



Config.AdminAction = {

    tp = function(adminId, targetId)

        if not adminId or not targetId then return end

        local playerCoords = GetEntityCoords(GetPlayerPed(targetId))

        SetEntityCoords(GetPlayerPed(adminId), playerCoords.x, playerCoords.y, playerCoords.z)

    end,

    bring = function(adminId, targetId)

        if not adminId or not targetId then return end

        local playerCoords = GetEntityCoords(GetPlayerPed(adminId))

        SetEntityCoords(GetPlayerPed(targetId), playerCoords.x, playerCoords.y, playerCoords.z)

    end,

    revive = function(adminId, targetId)

        if not adminId or not targetId then return end

        ReviveList = ReviveList or {}

        ReviveList[targetId] = true

        TriggerClientEvent('ez_reports:client:revive', targetId)

    end,

    freeze = function(adminId, targetId)

        if not adminId or not targetId then return end

        FreezeList = FreezeList or {}

        FreezeList[targetId] = true

        TriggerClientEvent('ez_reports:client:freeze', targetId)

    end,

}



Config.Locale = {

    Webhook = {

        ReportCreated = {

            Title = "New Report Created (ID: %s)",

            Message = function(data)

                return string.format(

                    "## Title\n```%s```## Description\n```%s```## Category\n```%s```## Player\n```%s (ID: %s)```## Location\n```%s %s %s```## Nearby Players\n```%s```",

                    data.title,

                    data.description,

                    data.category or "Unknown",

                    data.player_info.name or "Unknown",

                    data.player_info.id or "Unknown",

                    data.locationCreated and data.locationCreated.x or "N/A",

                    data.locationCreated and data.locationCreated.y or "N/A",

                    data.locationCreated and data.locationCreated.z or "N/A",

                    (function()

                        if not data.nearby_players or #data.nearby_players == 0 then

                            return "No nearby players"

                        end

                        local lines = {}

                        for _, p in ipairs(data.nearby_players) do

                            table.insert(lines, string.format("%s (ID: %s, %.1fm)", p.name or "Unknown", p.id or "N/A", p.distance or 0))

                        end

                        return table.concat(lines, "\n")

                    end)()

                )

            end

        },

        MessageSent = {

            Title = "New Report Message",

            Message = function(report, msg)

                return string.format(

                    "**Report ID:** `%s`\n**Sender:** `%s (%s)`\n**Message:** `%s`\n**Report Title:** `%s`",

                    report.id,

                    msg.name,

                    msg.sender,

                    msg.message,

                    report.title

                )

            end

        },

        ReportClaimed = {

            Title = "Report Claimed",

            Message = function(report)

                return string.format(

                    "**Report ID:** `%s`\n**Title:** `%s`\n**Claimed By:** `%s (ID: %s)`",

                    report.id,

                    report.title,

                    report.admin_info.name or "Unknown",

                    report.admin_info.id or "Unknown"

                )

            end

        },

        ReportReopened = {

            Title = "Report Reopened",

            Message = function(report, player)

                return string.format(

                    "**Report ID:** `%s`\n**Title:** `%s`\n**Reopened By:** `%s (ID: %s)`",

                    report.id,

                    report.title,

                    player.name or "Unknown",

                    player.id or "Unknown"

                )

            end

        },

        ReportClosed = {

            Title = "Report Closed",

            Message = function(report)

                return string.format(

                    "**Report ID:** `%s`\n**Title:** `%s`\n**Closed By:** `%s (ID: %s)`",

                    report.id,

                    report.title,

                    report.closed_by and report.closed_by.name or "Unknown",

                    report.closed_by and report.closed_by.id or "Unknown"

                )

            end

        },

        AdminAction = {

            Title = "Admin Action Taken",

            Message = function(report, admin, actionType)

                return string.format(

                    "**Report ID:** `%s`\n**Title:** `%s`\n**Action:** `%s`\n**Admin:** `%s (ID: %s)`\n**Target Player:** `%s (ID: %s)`",

                    report.id,

                    report.title,

                    actionType,

                    admin.name or "Unknown",

                    admin.id or "Unknown",

                    report.player_info and report.player_info.name or "Unknown",

                    report.player_info and report.player_info.id or "Unknown"

                )

            end

        },

        ReportDeleted = {

            Title = "Report Deleted",

            Message = function(report, player)

                return string.format(

                    "**Report ID:** `%s`\n**Title:** `%s`\n**Deleted By:** `%s (ID: %s)`",

                    report.id,

                    report.title,

                    player.name or "Unknown",

                    player.id or "Unknown"

                )

            end

        },

    },

    Notification = {

        report_not_found = {title = "Report Not Found", message = "The report you are trying to access does not exist or has been deleted.", dict = "multiwheel_emotes", icon = "emote_two_fingers", color = "COLOR_RED", duration = 5000},

        refresh_report_permissions = {title = "Permissions Refreshed", message = "Your report permissions have been refreshed.", dict = "inventory_items_mp", icon = "generic_coach", color = "COLOR_WHITE", duration = 5000},

        not_authorized_create_report = {title = "Not Authorized", message = "You are not authorized to create reports.", dict = "multiwheel_emotes", icon = "emote_two_fingers", color = "COLOR_RED", duration = 5000},

        missing_report_data = {title = "Missing Data", message = "Please provide a title, description and select a category for the report.", dict = "multiwheel_emotes", icon = "emote_two_fingers", color = "COLOR_RED", duration = 5000},

        report_limit_reached = {title = "Report Limit Reached", message = "You have reached the maximum number of reports allowed.", dict = "multiwheel_emotes", icon = "emote_two_fingers", color = "COLOR_RED", duration = 5000},

        create_report = {title = "Report Created", message = "Your report(%s) has been created successfully!", dict = "inventory_items_mp", icon = "folder_letters_cloud", color = "COLOR_GREEN", duration = 5000},

        receive_report = {title = "Report Created", message = "New report(%s) created by $s", dict = "inventory_items_mp", icon = "folder_letters_cloud", color = "COLOR_WHITE", duration = 5000},

        missing_message_data = {title = "Missing Message Data", message = "Please provide a message to send.", dict = "multiwheel_emotes", icon = "emote_two_fingers", color = "COLOR_RED", duration = 5000},

        message_sent = {title = "Message Sent", message = "Report(%s) has a new message.", dict = "BLIPS", icon = "blip_scm_letter", color = "COLOR_WHITE", duration = 5000},

        already_claimed = {title = "Report Already Claimed", message = "This report has already been claimed by you.", dict = "multiwheel_emotes", icon = "emote_two_fingers", color = "COLOR_RED", duration = 5000},

        claim_report = {title = "Report Claimed", message = "You have successfully claimed the report.", dict = "multiwheel_emotes", icon = "emote_two_fingers", color = "COLOR_GREEN", duration = 5000},

        not_authorized_reopen_report = {title = "Not Authorized", message = "You are not authorized to reopen reports.", dict = "multiwheel_emotes", icon = "emote_two_fingers", color = "COLOR_RED", duration = 5000},

        reopen_report = {title = "Report Reopened", message = "Report(%s) has been reopened.", dict = "INVENTORY_ITEMS", icon = "folder_letters", color = "COLOR_GREEN", duration = 5000},

        not_authorized_delete_report = {title = "Not Authorized", message = "You are not authorized to delete reports.", dict = "multiwheel_emotes", icon = "emote_two_fingers", color = "COLOR_RED", duration = 5000},

        delete_report = {title = "Report Deleted", message = "Report(%s) has been deleted.", dict = "multiwheel_emotes", icon = "emote_action_blow_kiss", color = "COLOR_WHITE", duration = 5000},

        not_authorized_close_report = {title = "Not Authorized", message = "You are not authorized to close reports.", dict = "multiwheel_emotes", icon = "emote_two_fingers", color = "COLOR_RED", duration = 5000},

        close_report = {title = "Report Closed", message = "Report(%s) has been closed.", dict = "INVENTORY_ITEMS", icon = "folder_letters", color = "COLOR_WHITE", duration = 5000},

        not_authorized_admin_actions = {title = "Not Authorized", message = "You are not authorized to perform admin actions.", dict = "multiwheel_emotes", icon = "emote_two_fingers", color = "COLOR_RED", duration = 5000},

        player_not_found = {title = "Player Not Found", message = "The player you are trying to perform an action on could not be found.", dict = "multiwheel_emotes", icon = "emote_two_fingers", color = "COLOR_RED", duration = 5000},

        revived = {title = "Report Action", message = "You have been revived!", dict = "itemtype_textures", icon = "itemtype_player_health", color = "COLOR_WHITE", duration = 5000},

        frozen = {title = "Report Action", message = "You have been frozen!", dict = "INVENTORY_ITEMS", icon = "weapon_lasso", color = "COLOR_RED", duration = 5000},

        unfrozen = {title = "Report Action", message = "You have been unfrozen!", dict = "INVENTORY_ITEMS", icon = "weapon_lasso", color = "COLOR_WHITE", duration = 5000},

    }

}

Last updated

Was this helpful?