Documentation
  • Weed Script
    • Installation
      • RedEM-RP
      • RSG
      • QR CORE
      • QBR CORE
      • VORP
      • SQL
    • Accessible code
  • Report System
    • Installation
    • Accessible code
  • SafeZone Creator
    • Installation
    • SQL File
    • Accessible code
  • Promo Codes Creator
    • Installation
    • Accessible code
  • Player Manager
    • Installation
    • Accessible code
Powered by GitBook
On this page
  1. Report System

Accessible code

Config = {}

Config.Locale = 'en'

-- you can disable some of actions in here if you dont want to have them in menu, put just false
Config.MenuActions = {
    [1] = true, -- Read Description
    [2] = true, -- Get Player Info
    [3] = true, -- Copy Player Identifier
    [4] = true, -- Send Message
    [5] = true, -- Give Item
    [6] = true, -- Give Horse
    [7] = true, -- Teleport back
    [8] = true, -- Goto Player
    [9] = true, -- Bring Player
    [10] = true, -- Teleport player back
    [11] = true, -- Revive Player
    [12] = true, -- Set job
    [13] = true, -- Set gang (only qr, qbr and rsg framework)
    [14] = true, -- Give gun (only vorp framework)
}

-- Set this to '' to disable the keybind.
Config.OpenReportsMenuKey = 'DELETE' -- List of keys here: https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/

Config.playerCommand = 'sendreport'

Config.staffComamnd = {
    name = 'reports',
    restricted = 'group.admin' -- for qb core could be group.god or QRCore.god
}

Config.Inventory = 'ox_inventory'      -- also 'qs-inventory' or 'qb-inventory' or 'ps-inventory', server/editable.lua you can put your inventory


Config.NotifyPosition = 'bottom-right' -- using ox lib notify, position: 'top' or 'top-right' or 'top-left' or 'bottom' or 'bottom-right' or 'bottom-left' or 'center-right' or 'center-left'
Config.NotifyDuration = 3500           -- 3.5 sec


Config.MinLetterTitle = 3          -- how many characters needs to be in title
Config.MinLetterDescription = 3    -- how many characters needs to be in description, example people cant put just title "a", description "a"


-- esx only
Config.AllowedGroups = { -- groups that will get notify when new report appears
    ['admin'] = true,
}


Config.Icons = {
    -- dont edit key, you can edit value {icon, color} for menu, colors https://mantine.dev/theming/colors/#default-colors
    ['question'] = {'fa-question', '#69DB7C'},
    ['report'] = {'fa-solid fa-bullhorn', '#F59F00'},
    ['bug'] = {'fa-solid fa-bug', '#C92A2A'}
}


Config.GiveVehicleList = {
    -- ['Vehicle Name'] = `spawncode`, must be ``
    ['Adder'] = `adder`,
}
Discord = {

    url = '',  -- url here

    title = 'Server Name',

    /*
        https://www.spycolor.com/

        ['default'] = 14423100,
        ['blue'] = 255,
        ['red'] = 16711680,
        ['green'] = 65280,
        ['white'] = 16777215,
        ['black'] = 0,
        ['orange'] = 16744192,
        ['yellow'] = 16776960,
        ['pink'] = 16761035,
        ['lightgreen'] = 65309,
    */

    color = 65309, -- green

    imageUrl = '', -- optional, if you dont want it put ''


    Log = {                         -- here you can handle what you want to be logged
        newReport = true,           -- when new report is created
        sendMessage = true,         -- when staff sends message to players
        giveItem = true,            -- when staff gives item to players
        giveVehicle = true,         -- when staff gives vehicles to players
        gotoPlayer = true,          -- when staff teleports to players
        bringPlayer = true,         -- when staff brings players to him
        teleportPlayerBack = true,  -- when staff teleports people back to old position
        goBack = true,              -- when staff goes back to his old position
        revivePlayer = true,        -- when staff revives players
        setJob = true,              -- when staff sets job to players
        setGang = true,             -- when staff sets gang to players - QB CORE ONLY
        concludeReport = true       -- when staff concludes report
    }
}
RegisterNetEvent('enpwr_reports:sendNotify', function(title, description, type)
    /*
        for notify type we use error or success, if you use something else, you can do following:

        if type == 'error' then
            type = 'xyz'
        end
	*/

    lib.notify({
        title = title,
        description = description,
        type = type,
        position = Config.NotifyPosition,
        duration = Config.NotifyDuration
    })
end)
local dbItems, invData = {}, {}

if IsVorp() then
    ---------------- Initialize Vorpcore Inventory API ----------------
    VORPinv = exports.vorp_inventory
    local result = MySQL.query.await('SELECT `item`, `label` FROM `items`')

    if result[1] then
        for k,v in pairs(result) do
            dbItems[v.item] = v.label
        end
    end
elseif IsRedem() then
    TriggerEvent("redemrp_inventory:getData",function(call)
        invData = call
    end)
end

-- will be used in admin command and when sending notify for new report, if you want some additional checks that suits your server you can put them here
function IsAllowed(source)
    if IsQR() then
        -- edit this to your server
        if QRCore.Functions.HasPermission(source, 'god') or QRCore.Functions.HasPermission(source, 'admin') or QRCore.Functions.HasPermission(source, 'mod') then
            return true
        end

        return false
    elseif IsVorp() then
        local group = VORPcore.getUser(source).getGroup

        if group == 'admin' then
            return true
        end
    elseif IsRedem() then
        local Player = RedEM.GetPlayer(source)

        if Player then
            if Player.group == 'mod' or Player.group == 'admin' or Player.group == 'superadmin' then
                return true
            end
        end
        
        return false
    elseif IsQBR() then
        for k,v in pairs(exports['qbr-core']:GetPermissions(source)) do
            if v == true then
                return true
            end
        end
        
        return false
    elseif IsRSG() then
        for k,v in pairs(RSGCore.Functions.GetPermission(source)) do
            if v == true then
                return true
            end
        end

        return false
    end
end
function RevivePlayer(source)
    if IsQR() then
        TriggerClientEvent('hospital:client:Revive', source)
    elseif IsVorp() then
        -- zavrsit
    elseif IsRedem() then
        TriggerEvent('redemrp_respawn:server:RequestRevivePlayer', source)
    elseif IsQBR() then
        TriggerClientEvent('hospital:client:Revive', source)
    elseif IsRSG() then
        TriggerClientEvent('rsg-medic:client:playerRevive', source)
    end
end


function GiveItem(source, item, count)
    if IsQR() then
        local Player = QRCore.Functions.GetPlayer(source)

        if Player then
            Player.Functions.AddItem(item, count)
        end
    elseif IsVorp() then
        VORPinv:addItem(source, item, count)
    elseif IsRedem() then
        local ItemData = invData.getItem(source, item)

        if ItemData then
            ItemData.AddItem(count)
        end
    elseif IsQBR() then
        local Player = exports['qbr-core']:GetPlayer(source)

        if Player then
            Player.Functions.AddItem(item, count)
        end
    elseif IsRSG() then
        local Player = RSGCore.Functions.GetPlayer(source)

        if Player then
            Player.Functions.AddItem(item, count)
        end
    end
end


-- for vorp
function GiveGun(target, weaponHash)
    exports.vorp_inventory:createWeapon(target, weaponHash)
end


function GetPlayerIdentifier(source)
    if IsQR() then
        return QRCore.Functions.GetPlayer(source).PlayerData.citizenid
    elseif IsVorp() then
        return VORPcore.getUser(source).getUserCharacters[1].identifier
    elseif IsRedem() then
        return RedEM.GetPlayer(source).identifier
    elseif IsQBR() then
        return exports['qbr-core']:GetPlayer(source).PlayerData.citizenid
    elseif IsRSG() then
        return RSGCore.Functions.GetPlayer(source).PlayerData.citizenid
    end
end


-- if you want to add some additional check before player sets job to player, otherwise leave it as it is
function CanSetJob(source)
    return true
end

function GetItemLabel(source, name)
    if IsQR() then
        local items = QRCore.Shared.GetItems()

        if items and items[name] then
            return items[name].label
        end
    elseif IsVorp() then
        return dbItems[name]
    elseif IsRedem() then
        local ItemData = invData.getItem(source, name)

        if ItemData then
            return ItemData.ItemInfo.label
        end
    elseif IsQBR() then
        local item = exports['qbr-core']:GetItems()

        if item[name] then
            return item[name].label
        end
    elseif IsRSG() then
        if RSGCore.Shared.Items[name] then
            return RSGCore.Shared.Items[name].label
        end
    end
end
PreviousInstallationNextSafeZone Creator

Last updated 11 months ago