From 4d0046b45478f04ba16e2022e2805a67360acfac Mon Sep 17 00:00:00 2001 From: Nordi98 Date: Sun, 27 Jul 2025 04:29:23 +0200 Subject: [PATCH] ed --- .../spy-bodycam/client/client.lua | 55 ++++++++++--------- .../spy-bodycam/server/server.lua | 1 + 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/resources/[jobs]/[police]/[spy-bodycam]/spy-bodycam/client/client.lua b/resources/[jobs]/[police]/[spy-bodycam]/spy-bodycam/client/client.lua index cd1de2d6d..d73017782 100644 --- a/resources/[jobs]/[police]/[spy-bodycam]/spy-bodycam/client/client.lua +++ b/resources/[jobs]/[police]/[spy-bodycam]/spy-bodycam/client/client.lua @@ -874,37 +874,40 @@ RegisterNetEvent('spy-bodycam:client:refreshRecords',function(records,isBoss) end) -- Register hotkeys for recording if enabled in config -if Config.EnableRecordingHotkeys then - -- Bodycam recording hotkey - RegisterKeyMapping('bodycamrecord', 'Start/Stop bodycam recording', 'keyboard', Config.RecordHotkey) - RegisterCommand('bodycamrecord', function() - if bcamstate then -- Only if bodycam is active - TriggerServerEvent('spy-bodycam:server:toggleRecording') - else - NotifyPlayer('Bodycam not activated!', 'error', 2500) - end - end) +Citizen.CreateThread(function() + if Config.EnableRecordingHotkeys then + -- Bodycam recording hotkey + RegisterKeyMapping('bodycamrecord', 'Start/Stop bodycam recording', 'keyboard', Config.RecordHotkey) + RegisterCommand('bodycamrecord', function() + if bcamstate then -- Only if bodycam is active + TriggerServerEvent('spy-bodycam:server:toggleRecording') + else + NotifyPlayer('Bodycam not activated!', 'error', 2500) + end + end, false) - -- Dashcam recording hotkey - RegisterKeyMapping('dashcamrecord', 'Start/Stop dashcam recording', 'keyboard', Config.DashcamHotkey) - RegisterCommand('dashcamrecord', function() - if IsPedInAnyVehicle(cache.ped, false) then - local veh = GetVehiclePedIsIn(cache.ped, false) - if isCarAuth(veh) then - local netId = NetworkGetNetworkIdFromEntity(veh) - if GlobalState.CarsOnBodycam[netId] then - TriggerServerEvent('spy-bodycam:server:toggleDashcamRecording', netId) + -- Dashcam recording hotkey + RegisterKeyMapping('dashcamrecord', 'Start/Stop dashcam recording', 'keyboard', Config.DashcamHotkey) + RegisterCommand('dashcamrecord', function() + if IsPedInAnyVehicle(cache.ped, false) then + local veh = GetVehiclePedIsIn(cache.ped, false) + if isCarAuth(veh) then + local netId = NetworkGetNetworkIdFromEntity(veh) + if GlobalState.CarsOnBodycam[netId] then + TriggerServerEvent('spy-bodycam:server:toggleDashcamRecording', netId) + else + NotifyPlayer('Dashcam not activated in this vehicle!', 'error', 2500) + end else - NotifyPlayer('Dashcam not activated in this vehicle!', 'error', 2500) + NotifyPlayer('Vehicle not authorized for dashcam!', 'error', 2500) end else - NotifyPlayer('Vehicle not authorized for dashcam!', 'error', 2500) + NotifyPlayer('You need to be in a vehicle to use dashcam!', 'error', 2500) end - else - NotifyPlayer('You need to be in a vehicle to use dashcam!', 'error', 2500) - end - end) -end + end, false) + end +end) + RegisterKeyMapping('bodycamexit', 'Exit bodycam spectate', 'keyboard', Config.ExitCamKey) RegisterCommand('bodycamexit', function() diff --git a/resources/[jobs]/[police]/[spy-bodycam]/spy-bodycam/server/server.lua b/resources/[jobs]/[police]/[spy-bodycam]/spy-bodycam/server/server.lua index 77f6024a3..4e33e5b42 100644 --- a/resources/[jobs]/[police]/[spy-bodycam]/spy-bodycam/server/server.lua +++ b/resources/[jobs]/[police]/[spy-bodycam]/spy-bodycam/server/server.lua @@ -217,6 +217,7 @@ RegisterNetEvent('spy-bodycam:server:toggleDashcamRecording', function(netId) end end) + RegisterNetEvent('spy-bodycam:server:logVideoDetails', function(videoUrl, streetName, isDashcam) local src = source local offName