Page cover

🧬API

Integrate the Dispatch script with more of your scripts

Calls are used in case of an incident (like robbery). Messages are used for citizens to contact authorities

🤙 CALLS

Use these Exports or Triggers to integrate Calls into your server

In client file:

every export can take coords as parameters (vector3), if not pass it will use the player position by default

exports['core_dispatch']:sendShootingAlert() -- Alert for shooting
exports['core_dispatch']:sendCarjackAlert() -- Alert for carjacking
exports['core_dispatch']:sendCarTheftAlert() -- Alert for car theft
exports['core_dispatch']:sendStoreRobbery() -- Alert for store robbery
exports['core_dispatch']:sendBankRobbery() -- Alert for bank robbery
exports['core_dispatch']:sendHouseRobbery() -- Alert for House robbery
exports['core_dispatch']:sendDrugSellAlert() -- Alert for Drug sell
exports['core_dispatch']:sendInjuredPersonAlert() -- Alert for injured person
exports['core_dispatch']:sendOfficerDown() -- Alert for officer down (priority alert)

In server file:

coords is the position where you want to trigger the alert

gender is the gender of a player you want to include in the notification (unknow if not set)

exports['core_dispatch']:sendShootingAlert(coords, gender) -- Alert for shooting
exports['core_dispatch']:sendStoreRobbery(coords, gender) -- Alert for store robbery
exports['core_dispatch']:sendBankRobbery(coords, gender) -- Alert for bank robbery
exports['core_dispatch']:sendHouseRobbery(coords, gender) -- Alert for House robbery
exports['core_dispatch']:sendDrugSellAlert(coords, gender) -- Alert for Drug sell
exports['core_dispatch']:sendInjuredPersonAlert(coords, gender) -- Alert for injured person
exports['core_dispatch']:sendOfficerDown(coords, gender) -- Alert for officer down (priority alert)

✉️ MESSAGES

Use these Exports or Triggers to integrate Messages into your server

With export :

exports['core_dispatch']:addMessage(
    message, --- @message string message in the notification    
    { coords }, --- @coords number,number,number coords where the notification is trigger
    job, --- @job string job who will receive the notification (one at a time)
    time, --- @time number time duration of the notification in ms
    blipSprite, --- @blipSprite number Sprite that will be use on the minimap to 
    blipColor, --- @blipColor number color use for the blip
    priority --- @priority boolean define if the call is priority or not
)

Example:

local playerPos = GetEntityCoords(PlayerPedId())
local gender = IsPedMale(ped) and 'male' or 'female'

exports['core_dispatch']:addMessage(
    "I need help please",
  {
    {icon = "fa-venus-mars", info = gender}
  },
  { playerPos.x, playerPos.y, playerPos.z },
  "police", 
  3000, 
  11, 
  5,
  false
)

With event:

TriggerServerEvent("core_dispatch:addMessage", 
    message, --- @message string message in the notification
    info, --- @info table of type {icon= string, info= string }
    coords, --- @coords number,number,number coords where the notification is trigger
    job, --- @job string job who will receive the notification (one at a time)
    cooldown, --- @time number time duration of the notification in ms
    sprite, --- @spritenumber Sprite that will be use on the minimap to 
    color, --- @colornumber color use for the blip
    priority --- @priority boolean define if the call is priority or not
)

Example:

local playerPos = GetEntityCoords(PlayerPedId())
local gender = IsPedMale(ped) and 'male' or 'female'

TriggerServerEvent("core_dispatch:addMessage", 
  "I need help please", 
  {
    {icon = "fa-venus-mars", info = gender}
  },
  { playerPos.x, playerPos.y, playerPos.z },
  'police',
  5000,
  156, 
  1,
  false
)

Last updated