[FREE] CAS-Dispatch With Clean UI From Code After S*x


image

2023-07-03 14-51-03.mkv (5.5 MB)

Code After S*x Dispatch is a simple dispatch system.

Features

  • Working With QBCore and ESX Frameworks.
  • You can see the name of the nearest EMS and Police unit to the scene.
  • You can waypoint the coordinate where the crime is located by pressing β€œZ”
  • You can use this system simply, it is easy to use.

Example from QB-StoreRobbery

Config = {
    DispatchInfo = {
        header = "POLICE ALERT",
        event = "Store Robbery",
        callsign = "19-02-04",
        forwho = "police",
        blips = {
            blipText = "Store Robbery Combination Try",
            blipSprite = 153,
            blipColour = 71,
            blipScale = 0.7,
            blipTime = 2, -- minute
        }
    }
}

GetStreetName = function(coords)
    local hashKey = GetStreetNameAtCoord(coords.x, coords.y, coords.z)
    local streetName = GetStreetNameFromHashKey(hashKey)
    return streetName
end


RegisterNUICallback('TryCombination', function(data, cb)
    QBCore.Functions.TriggerCallback('qb-storerobbery:server:isCombinationRight', function(combination)
        if tonumber(data.combination) ~= nil then
            if tonumber(data.combination) == combination then
                TriggerServerEvent("qb-storerobbery:server:SafeReward", currentSafe)
                TriggerServerEvent("qb-storerobbery:server:setSafeStatus", currentSafe)
                SetNuiFocus(false, false)
                SendNUIMessage({
                    action = "closeKeypad",
                    error = false,
                })
                currentSafe = 0
                takeAnim()
            else
                -- TriggerEvent("police:SetCopAlert")
                local coords = GetEntityCoords(PlayerPedId()) 
                TriggerServerEvent("cas-sendDispatch",coords, Config.DispatchInfo, GetStreetName(coords))
                SetNuiFocus(false, false)
                SendNUIMessage({
                    action = "closeKeypad",
                    error = true,
                })
                currentSafe = 0
            end
        end
        cb("ok")
    end, currentSafe)
end)

Download ESX/QB Version Here

Updates;

  • Added Shot Alert
  • Added driveBy alert
  • Added Civdown alert
  • Added Carjacking alert

How can i use this script?

  • Install baseevents fivem script Download on github
  • Install CAS-Dispatch
  • Set config file according to your server.
  • And start scripts.

How can i add dispatch alert for store robbery?

  • Add dispatch settings to config like this;
Config.StoreRobbery = {
    header = "Store Robbery", // header
    event = "A market is being robbed!", // footer
    callsign = "55-88", // callsign code 
    forwho = {"police", "sheriff"}, //
    blips = {
        blipText = "Store Robbery",  // Blip Name
        blipSprite = 153, // Blip Icon
        blipColour = 71, // Blip Colour
        blipScale = 0.7, // Blip Scale
        blipTime = 2, // Blip Time
    }
}

  • Then open client.lua and type this;
RegisterNetEvent("youreventName")
AddEventHandler("youreventName",function()
    local coords = GetEntityCoords(GetPlayerPed(-1))
    TriggerServerEvent("cas-sendDispatch",coords, Config.StoreRobbery, GetStreetName(coords))
end)
  • Finally go to your store robbery script I will give you an example via qb-storerobbery
  • Find this part;
TriggerServerEvent("qb-storerobbery:server:callCops", "cashier", currentRegister, streetLabel, pos)
  • Then Replace with this;
TriggerEvent("youreventName")

Note
yourEventName can be any text you want.

Code is accessible YES
Subscription-based NO
Lines (approximately) +100
Requirements QBCore/ESX
Support YES
11 Likes

Pls Provide a direct Download link

Thats the Rules of the forum

1 Like

really nice work bro thank youu

1 Like

Can you link github link? And, how does it store callsign?

1 Like

Oh, thanks for warn. Done

Done, mate. it doesn’t store the callsign, if my answer is wrong, sorry about this. What do you mean exactly?

In the picture i can see an Callsign, its a Cop callsign or what?

2 Likes

The callsign here is the event code or a police callsign code. You can write whatever you want.

Can you provide some more previews?

1 Like

When i available i will record a video.
image

Woah , this s crazy!!

does this replace esx_outlawalert? if so how do i put in the events to trigger fighting,gunshots,carjacking etc?

i will update the file within today.

2 Likes

From what I understand is a script to send the alert on certain configurable issues for example for a Central Bank Robbery and that is activated by means of the command that can be registered as automatic within the theft script, is it correct?

It can be configured for example I suppose a /911 and that it reaches the emergency services

i will update the file within today.

Topic updated.

1 Like

Ok if it works well only the civdown is not working for me

this is a hit

keep the updates coming :smiley: seems like a nice script, would love to be able to use my drug selling script to notify when we fail a sale!

1 Like

image
Can anyone fix this ?

RegisterServerEvent("cas-sendDispatch")
AddEventHandler("cas-sendDispatch",function(coords, prmtwo,street)
    local dispatchInfos = {}
    local playerInfos = GetPlayerNameByCoords(coords)
    table.insert(dispatchInfos, {
        nPolice = playerInfos.nPolice,
        nEms = playerInfos.nEms,
        header = prmtwo.header,
        street = street,
        callsign = prmtwo.callsign,
        event = prmtwo.event,
        victimName = playerInfos.name,
        blips = prmtwo.blips
    })
    local players = GetFwPlayers()
    for _, player in ipairs(players) do
        local xPlayer = GetPlayerById(player)
        print(type(prmtwo.forwho))
        if type(prmtwo.forwho) == "table" then
            for key,value in pairs(prmtwo.forwho) do
                if GetJobOfPlayer(xPlayer) == value then
                    local source = GetSource(xPlayer)
                    TriggerClientEvent("cas-sendDispatchToClient",source, dispatchInfos,coords)
                end
            end
        else
            if GetJobOfPlayer(xPlayer) == prmtwo.forwho then
                local source = GetSource(xPlayer)
                TriggerClientEvent("cas-sendDispatchToClient",source, dispatchInfos,coords)
            else
                print("none")
            end
        end
    end
end)