Citizen.CreateThread(function()
RegisterKeyMapping('+dispatch', 'Dispatch', 'keyboard', 'TAB')
RegisterKeyMapping('+dispatchPressY', 'Dispatch [Heading to The Police Call]', 'keyboard', 'y')
RegisterKeyMapping('+dispatchPressE', 'Dispatch [Mark On Map]', 'keyboard', 'e')
end)
RegisterCommand('+dispatch', function()
if not toggleOld then
if PlayerData.job.name == "police" or PlayerData.job.name == "sheriff" then
toggleOld = true
SendNUIMessage({action = 'showOld'})
SetNuiFocus(true, true)
Citizen.Wait(1000)
end
end
end, false)
local pressE = false
local pressY = false
RegisterCommand('+dispatchPressY', function()
if alertOn then
if lastAlertId and pressY then
TriggerServerEvent("tgiann-policeAlert:server:yonel", lastAlertId, gpsName)
lastAlertId = nil
pressY = false
end
end
end, false)
RegisterCommand('+dispatchPressE', function()
if alertOn then
if pressE then
SetNewWaypoint(alertX, alertY)
pressE = false
alertX = nil
alertY = nil
exports['mythic_notify']:SendAlert('inform', 'Konum GPS\'de İşaretlendi.', 5000)
end
end
end, false)
RegisterNUICallback('setCoords', function(coords, cb)
exports['mythic_notify']:SendAlert('inform', 'Konum GPS\'de İşaretlendi.', 5000)
SetNewWaypoint(coords.x, coords.y)
end)
RegisterNUICallback('yonel', function(data, cb)
TriggerServerEvent("tgiann-policeAlert:server:yonel", data.alertId, gpsName)
end)
RegisterNetEvent('tgiann-policeAlert:client:yonel')
AddEventHandler('tgiann-policeAlert:client:yonel', function(alertId, name)
if PlayerData.job.name == "police" or PlayerData.job.name == "sheriff" then
SendNUIMessage({
action = "yonel",
alertId = alertId,
name = name
})
end
end)