Guide · Setup

Add automatic calls to ps-dispatch

ps-dispatch is the most common dispatch script on QBCore and Qbox servers. Its alerts come from things players do: shots fired, a store robbery, a car theft. When nobody is doing anything, the dispatch stays empty. Here's how to fill it without getting in the way of real RP.

The logic

Whatever you build, it needs five checks before it sends anything:

  1. Is anyone from police on duty? Count players whose job is police (or whose QBCore job type is leo) and who are on duty. No officers, no call.
  2. Has it been quiet? Track the time of the last real alert. Wait 10 to 15 minutes after it before sending anything.
  3. How busy is the city? Wait longer as more players join, and stop entirely above a ceiling. A good rule is to wait quietMinutes × (1 + players / 20) and stay off at 40 or more players.
  4. Is it within your hours? Some owners only want calls overnight.
  5. Has this call happened here recently? Don't send the same call type to the same place twice in a few days.

Then pick a call and a place from a fixed list and send it to ps-dispatch as an alert for police jobs only.

A sketch in Lua

This is the shape of it, server-side. sendToDispatch is where you call your ps-dispatch version's alert export; the export name and fields have changed between versions, so check its README.

local lastReal = os.time()
AddEventHandler('your:realAlertHappened', function() lastReal = os.time() end)

CreateThread(function()
    while true do
        Wait(30000)
        local officers, players = countOnDutyPolice(), #GetPlayers()
        local wait = 12 * 60 * (1 + players / 20)
        if officers > 0 and players < 40 and os.time() - lastReal > wait then
            local call, place = pickCallAndPlace()   -- from your own lists
            if call then
                sendToDispatch(call, place)           -- ps-dispatch alert, police jobs only
                lastReal = os.time()
            end
        end
    end
end)

Mistakes to avoid

  • Calls at a player's location. It's tempting, but a "suspicious person" call at a real player's coordinates accuses them of something they didn't do. Use a list of places instead.
  • Sending during real scenes. Reset the quiet timer on every real alert, including your generated ones, or officers get pulled off a pursuit for a noise complaint.
  • One call type on repeat. Officers stop answering after the third identical alarm. Have at least 15 to 20 call types, and keep track of which ones officers actually respond to.
  • Coordinates from another map pack. Check every place on your own map. MLOs move buildings.

The quick way

Overshift is a free FiveM resource that does all of the above. It finds ps-dispatch on its own, sends calls as targeted alerts to on-duty police, adds a short radio line, and learns which calls your officers pick up. Install takes about five minutes:

ensure ox_lib
ensure ps-dispatch
ensure overshift

Then run /overshift doctor as an admin; it shows which dispatch script it found and checks your police job names. /overshift test sends one call straight away.

Install free Other dispatch scripts