Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions client/eventhandlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ AddEventHandler('CEventGunShot', function(witnesses, ped)
if IsPedCurrentWeaponSilenced(cache.ped) then return end
if inNoDispatchZone then return end
if BlacklistedWeapon(cache.ped) then return end

WaitTimer('Shooting', function()
if cache.ped ~= ped then return end

Expand Down Expand Up @@ -128,6 +128,11 @@ local SpeedingEvents = {
'CEventShockingInDangerousVehicle'
}

local exemptVehicleClass = {
[15] = true, -- Helicopters
[16] = true, -- Planes
}

local SpeedTrigger = 0
for i = 1, #SpeedingEvents do
local event = SpeedingEvents[i]
Expand All @@ -144,7 +149,10 @@ for i = 1, #SpeedingEvents do
return
end
end


local vehicleClass = GetVehicleClass(cache.vehicle)
if exemptVehicleClass[vehicleClass] then return end

if GetEntitySpeed(cache.vehicle) * 3.6 < (80 + math.random(0, 20)) then return end

if cache.ped ~= GetPedInVehicleSeat(cache.vehicle, -1) then return end
Expand Down
8 changes: 5 additions & 3 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local function removeZones()
for i = 1, #nodispatchZones do
nodispatchZones[i]:remove()
end
-- Hunting Blips --
-- Hunting Blips --
for i = 1, #huntingBlips do
RemoveBlip(huntingBlips[i])
end
Expand Down Expand Up @@ -151,14 +151,15 @@ end

local function setWaypoint()
if not isJobValid(PlayerData.job.type) then return end
if not IsOnDuty() then return end

local data = lib.callback.await('ps-dispatch:callback:getLatestDispatch', false)

if not data then return end

if data.alertTime == nil then data.alertTime = Config.AlertTime end
local timer = data.alertTime * 1000

if not waypointCooldown and lib.table.contains(data.jobs, PlayerData.job.type) then
SetNewWaypoint(data.coords.x, data.coords.y)
TriggerServerEvent('ps-dispatch:server:attach', data.id, PlayerData)
Expand Down Expand Up @@ -262,7 +263,7 @@ local OpenDispatchMenu = lib.addKeybind({
RegisterNetEvent('ps-dispatch:client:notify', function(data, source)
if data.alertTime == nil then data.alertTime = Config.AlertTime end
local timer = data.alertTime * 1000

if alertsDisabled then return end
if not isJobValid(data.jobs) then return end
if not IsOnDuty() then return end
Expand Down Expand Up @@ -301,6 +302,7 @@ end)

RegisterNetEvent('ps-dispatch:client:openMenu', function(data)
if not isJobValid(PlayerData.job.type) then return end
if not IsOnDuty() then return end

if #data == 0 then
lib.notify({ description = locale('no_calls'), position = 'top', type = 'error' })
Expand Down