looks dope, trynna figure out how to implement it in esx_carthief, wish me luck
Hey, what command has been written to send a dispatch? i tried the phrase from your video, but i received no message.
Any held?
Cool ! I have a script of vehiclerobbery at a random position is this possible to send the notification at the same random position where the vehicle has been robbed ?
Why youtube link doesn’t work anymore?
To anyone who didnt understand how to use this:
You need to copy the little snippet that @zThundy provided and register a CLIENT event in YOUR SCRIPT. So if you want a command to automatically call a dispatch code, create a client.lua file and register a command with the dispatch table and create a logic based on a job, license or whatever you want to trigger the server event (svnotify).
So heres a detailed version of what i said:
-
First figure what you, a command etc (the example i will provide is a command
-
Create a random client.lua (with fxmanifest or __resource)
-
Create your code, you can base it on mine:
`RegisterCommand(‘cod1’, function(source, args, rawCommand)
local xPlayer = ESX.GetPlayerData()
local job = xPlayer.job.name
local player = GetPlayerPed(-1)
local coords = GetEntityCoords(player)
local dispatch1 = {
code = "Código 1",
street = GetStreetAndZone(),
id = randomId(),
priority = 1,
title = "teste",
position = {
x = coords.x,
y = coords.y,
z = coords.z
},
blipname = "Test dispatch",
color = 2,
sprite = 304,
fadeOut = 60,
duration = 10000,
officer = "test",
job = job,
}
if job == 'police' or job == 'gnr' then
TriggerServerEvent("dispatch:svNotify", dispatch1)
elseif job == nil then
exports['okokNotify']:Alert('Sem permissão', 'Não és policia', 5000, 'warning', true)
end
end)`
(its in portuguese but you can figure it out, i cant give you everything too lol), i added a simple okokNotify export to make sure no one outside of ‘police’ or ‘gnr’ jobs can use the command (well they couldnt before anyways)
-
You also need to create or copy the functions provided in the esx_dispatch.config file to handle getStreetAndZone() and randomId()
-
Your done. Make sure u have 3 logics: Command and 2 functions. Save it and run it after running esx_dispatch
I get it why so many people got confused, wasnt explained in the best way possible (mostly its because english is not OP’s first language) but hey its ok.
Also @zThundy “officer” cannot be called as a dynamic name (or at least im stupid and idk) cause im trying to dynamically call a the command summoner name and it returns “invalid”. So if you are interested in improving this script i would recommend to add that dinamic range to officer
Also realized that i added a line called job in your snippet. Basically i locked that command to only show notification to the job of the player job.
Lemme me know if you need any more informations (im not a pro, just a guy learning too)
Also cfx.forum text formatting went bonkers lol