🖼️QB-Core

  1. Replace config/config_s.lua with:

QBCore = exports['qb-core']:GetCoreObject()

return {
    locales = 'en', -- EN | PL

    imageUpload = {
        type = 'fivemanage', -- fivemanage | fmsdk | discord | custom
        token = '', -- fivemanage token | discord webhook
        custom = function(source)
            return nil --return url
        end
    },

    jobsWithAccess = {
        'ambulance'
    },

    homePage = {
        getDoctorData = function(player)
            local radiochannel = Player(player.PlayerData.source).state.radioChannel
            local image = player.PlayerData.metadata.ems_mdt_image
            local badge = player.PlayerData.metadata.callsign or 0

            return {
                radio = radiochannel,
                img = image,
                badge = badge
            }
        end,
        getPhoto = function(identifier)
            local player = QBCore.Functions.GetPlayerByCitizenId(identifier) or QBCore.Functions.GetOfflinePlayerByCitizenId(identifier)
            if not player then return false end

            return player.PlayerData.metadata.ems_mdt_image
        end
    },

    citizen = {
        updatePhoto = function(identifier, url)
            local player = QBCore.Functions.GetPlayerByCitizenId(identifier) or QBCore.Functions.GetOfflinePlayerByCitizenId(identifier)
            if not player then return false end

            player.Functions.SetMetaData('ems_mdt_image', url)
            return true
        end,
        getCitizenDetails = function(identifier)
            local player = QBCore.Functions.GetPlayerByCitizenId(identifier) or QBCore.Functions.GetOfflinePlayerByCitizenId(identifier)
            if not player or not player.PlayerData then return {} end
            local data = player.PlayerData
            local licenses = {}

            for name, value in pairs(data.metadata.licences) do
                table.insert(licenses, {
                    label = name,
                    owns = value
                })
            end

            return {
                name = data.charinfo.firstname .. ' ' .. data.charinfo.lastname,
                dob = data.charinfo.birthdate,
                img = data.metadata.ems_mdt_image,
                ssn = identifier,
                nationality = data.charinfo.nationality,
                licenses = licenses
            }
        end
    },

    case = {
        giveInvoice = function(identifier, fine, data)
            -- fill with your own ticket system
        end,
        injuries = {
            {
                name = 'First-degree burn', -- Oparzenie 1. stopnia
                price = 1000
            },
            {
                name = 'Second-degree burn', -- Oparzenie 2. stopnia
                price = 1500
            },
            {
                name = 'Third-degree burn', -- Oparzenie 3. stopnia
                price = 2500
            },
            {
                name = 'Open fracture', -- Złamanie otwarte
                price = 2000
            },
            {
                name = 'Closed fracture', -- Złamanie zamknięte
                price = 1500
            },
            {
                name = 'Concussion', -- Wstrząs mózgu
                price = 1200,
                onlyForRegion = 'Head'
            },
            {
                name = 'Hematoma', -- Krwiak
                price = 800
            },
            {
                name = 'Dislocation', -- Zwichnięcie
                price = 1100
            },
            {
                name = 'Sprain', -- Skręcenie
                price = 900
            },
            {
                name = 'Minor laceration', -- Małe rozcięcie
                price = 700
            },
            {
                name = 'Deep laceration', -- Głębokie rozcięcie
                price = 1600
            },
            {
                name = 'Whiplash injury', -- Uraz kręgosłupa szyjnego
                price = 1300,
                onlyForRegion = 'Head'
            },
            {
                name = 'Puncture wound', -- Rana kłuta
                price = 1700
            },
            {
                name = 'Gunshot wound', -- Rana postrzałowa
                price = 3000
            },
        }
    },

    patrols = {
        inviteExpiration = 60000, -- 1 minute
    },

    dispatch = {
        getGender = function(frPlayer)
            return frPlayer.PlayerData.charinfo.gender and "Male" or "Female"
        end,
        ignoreJobsWithAccess = true,
    },

    permissions = {
        [1] = { -- [grade] = { permissions }
            announcements = {
                'view',
            },
            patrols = {
                'view',
            },
            citizens = {
                'view'
            },
            citizen = {
                'view',
            },
            cases = {
                'view',
            },
            case = {
                'view',
            },
            notes = {
                'view',
            },
            note = {
                'view',
            },
            settings = {
                'view'
            }
        },
        [2] = {
            homepage = {
                'chat',
                'search'
            },
            announcements = {
                'create',
            },
            announcement = {
                'edit',
                'remove'
            },
            patrols = {
                'create'
            },
            citizen = {
                'photo',
                'viewcases',
                'viewnotes',
                'viewvehicles'
            },
            cases = {
                'listview',
                'create'
            },
            case = {
                'edit'
            },
            notes = {
                'listview',
                'create'
            },
            note = {
                'edit',
                'remove'
            }
        }
    },

    queries = {
        ['searchCitizens'] = [[
            SELECT
                COUNT(*) as count
            FROM
                players
            WHERE
                JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.firstname')) LIKE @search
                OR JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.lastname')) LIKE @search
        ]],
        ['getCitizens'] = [[
            SELECT
                citizenid AS identifier,
                citizenid AS ssn,
                JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.firstname')) AS firstname,
                JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.lastname')) AS lastname,
                JSON_UNQUOTE(JSON_EXTRACT(metadata, '$.ems_mdt_image')) AS image
            FROM
                players
            WHERE
                JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.firstname')) LIKE @search
                OR JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.lastname')) LIKE @search
            LIMIT @limit OFFSET @offset
        ]],
        ['getAuthor'] = [[
            SELECT
                JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.firstname')) AS firstname,
                JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.lastname')) AS lastname
            FROM
                players
            WHERE
                citizenid = ?
        ]],
        ['getCitizensByIdentifiers'] = [[
            SELECT
                citizenid AS identifier,
                JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.firstname')) AS firstname,
                JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.lastname')) AS lastname
            FROM
                players
            WHERE
                citizenid IN (?)
        ]],
        search = {
            ['citizens'] = [[
                SELECT
                    citizenid AS identifier,
                    JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.firstname')) AS firstname,
                    JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.lastname')) AS lastname
                FROM
                    players
                WHERE
                    JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.firstname')) LIKE @query
                    OR JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.lastname')) LIKE @query
                LIMIT 20]],
            ['doctors'] = [[
                SELECT
                    p.citizenid AS identifier,
                    JSON_UNQUOTE(JSON_EXTRACT(p.charinfo, '$.firstname')) AS firstname,
                    JSON_UNQUOTE(JSON_EXTRACT(p.charinfo, '$.lastname')) AS lastname
                FROM
                    players p
                WHERE
                    JSON_UNQUOTE(JSON_EXTRACT(p.job, '$.name')) = @job
                    AND (
                        JSON_UNQUOTE(JSON_EXTRACT(p.charinfo, '$.firstname')) LIKE @query
                        OR JSON_UNQUOTE(JSON_EXTRACT(p.charinfo, '$.lastname')) LIKE @query
                    )
                LIMIT 20
            ]],
        }
    },
}

Last updated