Common Problems

Please note that most common errors can be caused by a bad installation or a poorly done update, always verify this using the default asset before communicating your problem to us, this will save time.

If you've made it this far, congratulations, you're one of the few customers reading through the documentation and taking an interest in fixing problems that come your way using our resources.

This section is intended for the common problems that some players usually have when using this asset, we ask you to check one by one to find your problem here and save long waits on community tickets. If your problem still persists, do not hesitate to contact us from the Discord community by opening a ticket.


List of common problems

Deploy each section according to your problem, so you will find the solution quickly, each problem has a general and basic solution in its description that will help you solve the case.

I get spam alerts when a dispatch call is executed

The problem occurs when calling the client function 'ramdomscript:client:fight' from the server code, setting the value to -1. This causes an alert to be generated for each player on the server.

RegisterCommand('test', function ()
    TriggerClientEvent('ramdomscript:client:fight', -1)
end)

Or

RegisterCommand('test', function(source, args, rawCommand)
    local xPlayers = ESX.GetExtendedPlayers() -- Devuelve todos los xPlayers
    for _, xPlayer in pairs(xPlayers) do
        if player.job.name == 'police' then -- Envía el evento A TODOS LOS POLICÍAS CONECTADOS
            TriggerClientEvent('ramdomscript:client:fight', xPlayer.source)
        end
    end
end, false)

The solution to the problem:

The solution is to assign the correct values to the function. Instead of using TriggerClientEvent('qs-dispatch:client:fight', -1), we should use 'source' instead.

RegisterCommand('test', function (source, args, rawCommand)
    TriggerClientEvent('qs-dispatch:client:fight', source)
end)

Or

RegisterCommand('pepe', function(source, args, rawCommand)
    exports['qs-dispatch']:GetPlayerInfo(source, function(playerData)
        if (not playerData) then
            print("Error al obtener los datos del jugador")
            return
        end
        exports['qs-dispatch']:GetSSURL(source, function(screenshot)
            TriggerEvent('qs-dispatch:server:CreateDispatchCall', {
                job = { 'police', 'sheriff', 'traffic', 'patrol' },
                callLocation = playerData.coords,
                callCode = { code = 'Alta velocidad', snippet = 'Vehículo' },
                message = " street_1: " .. playerData.street_1 .. " street_2: " .. playerData.street_2 .. " sex: " .. playerData.sex .. " vehicle_label: " .. playerData.vehicle_label .. " vehicle_colour: " .. playerData.vehicle_colour .. " vehicle_plate: " .. playerData.vehicle_plate .. " speed: " .. playerData.speed .. "",
                flashes = false,
                image = screenshot or nil,
                blip = {
                    sprite = 488,
                    scale = 1.5,
                    colour = 1,
                    flashes = true,
                    text = 'Alta velocidad',
                    time = (20 * 1000), -- 20 segundos
                }
            })
        end)
    end)
end, false)

In short, the solution ensures that the event is sent only to the player who initiated it ('source'), thus avoiding issuing alerts to all players on the server. Additionally, some bugs in the code, such as incorrect use of variables, were fixed and readability was improved.

Data overflow (qs-dispatch:blips:updateAll)

If you have problems with this event qs-dispatch:blips:updateAll and you get out of your server, is that you are using the default configuration of Config.PlayerLocationTick, so this is equal to 5 seconds, this means that you are running the event of the blips every 5 seconds per player, a solution to this is to increase the value, to prevent repeating this event as often as possible.

Config.PlayerLocationTick = 5 -- Change to 15 for example
Open job menu key sends a dispatch call

Go to client/custom/misc/commands.lua and replace the commands name, and restart the server.

TriggerEvent('chat:addSuggestion', '/police', 'Call to Police Services', {
    { name = 'message', help = 'Message to send to police' },
})

RegisterCommand("police", function(source, args, rawCommand)
    -- Rest of the call code
end, false)

The modified code is:

-- The change was in the /police command
TriggerEvent('chat:addSuggestion', '/policecall', 'Call to Police Services', {
    { name = 'message', help = 'Message to send to police' },
})

RegisterCommand("policecall", function(source, args, rawCommand)
    -- Rest of the call code
end, false)

Last updated