🖼️ESX

  1. Replace config/config_s.lua with:

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.source).state.radioChannel
            local image = player.getMeta('ems_mdt_image')
            local badge = player.getMeta('badge') or 0

            return {
                radio = radiochannel,
                img = image,
                badge = badge
            }
        end,
        getPhoto = function(identifier)
            local player = ESX.GetPlayerFromIdentifier(identifier)
            local image = nil
            if player then
                image = player.getMeta('ems_mdt_image')
            else
                local response = MySQL.query.await("SELECT JSON_UNQUOTE(JSON_EXTRACT(metadata, '$.ems_mdt_image')) AS ems_mdt_image, FROM `users` WHERE `identifier` = ?", {
                    identifier
                })
                if response and response[1] then
                    image = response[1].ems_mdt_image
                end
            end

            return image
        end
    },

    citizen = {
        updatePhoto = function(identifier, url)
            local player = ESX.GetPlayerFromIdentifier(identifier)
            if player then
                player.setMeta('ems_mdt_image', url)
            else
                MySQL.update.await("UPDATE `users` SET `metadata` = JSON_SET(`metadata`, '$.ems_mdt_image', ?) WHERE `identifier` = ?", {
                    url,
                    identifier
                })
            end

            return true
        end,
        getCitizenDetails = function(identifier)
            local player = ESX.GetPlayerFromIdentifier(identifier)
            local data = {}

            if player then
                data.firstname = player.get('firstName')
                data.lastname = player.get('lastName')
                data.birthdate = player.get('dob')
                data.nationality = player.get('nationality')
                data.ems_mdt_image = player.getMeta('ems_mdt_image')
                data.badge = player.getMeta('badge')
            else
                local response = MySQL.query.await("SELECT `firstname`, `lastName`, `dateofbirth` AS `dob`, `nationality`, JSON_UNQUOTE(JSON_EXTRACT(metadata, '$.ems_mdt_image')) AS ems_mdt_image, JSON_UNQUOTE(JSON_EXTRACT(metadata, '$.badge')) AS badge FROM `users` WHERE `identifier` = ?", {
                    identifier
                })
                if response and response[1] then
                    data.firstname = response[1].firstname
                    data.lastname = response[1].lastName
                    data.birthdate = response[1].dob
                    data.nationality = response[1].nationality
                    data.ems_mdt_image = response[1].ems_mdt_image
                    data.badge = response[1].badge
                end
            end
            if not data.firstname then return {} end

            return {
                name = data.firstname .. ' ' .. data.lastname,
                dob = data.birthdate,
                img = data.ems_mdt_image,
                ssn = identifier,
                nationality = data.nationality,
                badge = data.badge
            }
        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.get('sex') == 'm' 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
                users
            WHERE
                firstname LIKE @search
                OR lastname LIKE @search
        ]],
        ['getCitizens'] = [[
            SELECT
                identifier AS identifier,
                identifier AS ssn,
                firstname,
                lastname,
                JSON_UNQUOTE(JSON_EXTRACT(metadata, '$.ems_mdt_image')) AS image
            FROM
                users
            WHERE
                firstname LIKE @search
                OR lastname LIKE @search
            LIMIT @limit OFFSET @offset
        ]],
        ['getAuthor'] = [[
            SELECT
                firstname,
                lastname
            FROM
                users
            WHERE
                identifier = ?
        ]],
        ['getCitizensByIdentifiers'] = [[
            SELECT
                identifier AS identifier,
                firstname,
                lastname
            FROM
                users
            WHERE
                identifier IN (?)
        ]],
        search = {
            ['citizens'] = [[
                SELECT
                    identifier AS identifier,
                    firstname,
                    lastname
                FROM
                    users
                WHERE
                    firstname LIKE @query
                    OR lastname LIKE @query
                LIMIT 20
            ]],
            ['doctors'] = [[
                SELECT `identifier`, `lastname`, `firstname`
                FROM `users`
                WHERE `job` IN (@jobs)
                AND (firstname LIKE @query OR lastname LIKE @query)
                LIMIT 20;
            ]],
        }
    },
}

Last updated