From a978bf0ed41fa80c88b2dfff996c558f331cc55d Mon Sep 17 00:00:00 2001 From: Shifty Date: Mon, 19 Aug 2024 18:06:22 -0400 Subject: [PATCH 1/2] Update main.lua Since the player can't see dispatch notifications unless they are on duty. Opening the dispatch menu and setting waypoints should be disabled as well. --- client/main.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/main.lua b/client/main.lua index 1833570..628b094 100644 --- a/client/main.lua +++ b/client/main.lua @@ -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 @@ -151,6 +151,7 @@ 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) @@ -158,7 +159,7 @@ local function setWaypoint() 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) @@ -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 @@ -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' }) From f506be95838e3ecdd5fb82bbf27fed7c7412c98b Mon Sep 17 00:00:00 2001 From: Shifty Date: Mon, 19 Aug 2024 18:10:45 -0400 Subject: [PATCH 2/2] Update eventhandlers.lua Made an exemption class table for plane and helicopter vehicle classes. This allows these vehicle classes to fly over roads without triggering the reckless driving call. --- client/eventhandlers.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client/eventhandlers.lua b/client/eventhandlers.lua index 1fc24bc..9449f93 100644 --- a/client/eventhandlers.lua +++ b/client/eventhandlers.lua @@ -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 @@ -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] @@ -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