forked from Simnation/Main
e
e
This commit is contained in:
parent
4d0046b454
commit
d546bef0c5
2 changed files with 86 additions and 0 deletions
|
@ -1325,6 +1325,37 @@ function HasItemsCheck(itemname)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Register hotkeys for recording
|
||||||
|
if Config.EnableRecordingHotkeys then
|
||||||
|
RegisterCommand('+bodycamrecord', function()
|
||||||
|
if bcamstate then
|
||||||
|
TriggerServerEvent('spy-bodycam:server:toggleRecording')
|
||||||
|
else
|
||||||
|
NotifyPlayer('Bodycam not activated!', 'error', 2500)
|
||||||
|
end
|
||||||
|
end, false)
|
||||||
|
|
||||||
|
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('Vehicle not authorized for dashcam!', 'error', 2500)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
NotifyPlayer('You need to be in a vehicle to use dashcam!', 'error', 2500)
|
||||||
|
end
|
||||||
|
end, false)
|
||||||
|
|
||||||
|
RegisterKeyMapping('+bodycamrecord', 'Start/Stop bodycam recording', 'keyboard', Config.RecordHotkey)
|
||||||
|
RegisterKeyMapping('+dashcamrecord', 'Start/Stop dashcam recording', 'keyboard', Config.DashcamHotkey)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -429,3 +429,58 @@ AddEventHandler('onResourceStart', function(resourceName)
|
||||||
checkForUpdates()
|
checkForUpdates()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
-- Handle bodycam recording toggle
|
||||||
|
RegisterNetEvent('spy-bodycam:server:toggleRecording', function()
|
||||||
|
local src = source
|
||||||
|
if PlayerOnBodycam[src] then
|
||||||
|
local defwebhook
|
||||||
|
if Upload.ServiceUsed == 'discord' then
|
||||||
|
local jobKey
|
||||||
|
if Config.Framework == 'qb' then
|
||||||
|
local Player = QBCore.Functions.GetPlayer(src)
|
||||||
|
jobKey = Player.PlayerData.job.name
|
||||||
|
else
|
||||||
|
local xPlayer = ESX.GetPlayerFromId(src)
|
||||||
|
jobKey = xPlayer.getJob().name
|
||||||
|
end
|
||||||
|
if Upload.JobUploads[jobKey] then
|
||||||
|
defwebhook = Upload.JobUploads[jobKey].webhook
|
||||||
|
else
|
||||||
|
defwebhook = Upload.DefaultUploads.webhook
|
||||||
|
end
|
||||||
|
elseif Upload.ServiceUsed == 'fivemanage' or Upload.ServiceUsed == 'fivemerr' then
|
||||||
|
defwebhook = Upload.Token
|
||||||
|
end
|
||||||
|
TriggerClientEvent('spy-bodycam:client:startRec', src, defwebhook, Upload.ServiceUsed)
|
||||||
|
else
|
||||||
|
NotifyPlayerSv('Bodycam not turned on!', 'error', 3000, src)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Handle dashcam recording toggle
|
||||||
|
RegisterNetEvent('spy-bodycam:server:toggleDashcamRecording', function(netId)
|
||||||
|
local src = source
|
||||||
|
if CarsOnBodycam[netId] then
|
||||||
|
local defwebhook
|
||||||
|
if Upload.ServiceUsed == 'discord' then
|
||||||
|
local jobKey
|
||||||
|
if Config.Framework == 'qb' then
|
||||||
|
local Player = QBCore.Functions.GetPlayer(src)
|
||||||
|
jobKey = Player.PlayerData.job.name
|
||||||
|
else
|
||||||
|
local xPlayer = ESX.GetPlayerFromId(src)
|
||||||
|
jobKey = xPlayer.getJob().name
|
||||||
|
end
|
||||||
|
if Upload.JobUploads[jobKey] then
|
||||||
|
defwebhook = Upload.JobUploads[jobKey].webhook
|
||||||
|
else
|
||||||
|
defwebhook = Upload.DefaultUploads.webhook
|
||||||
|
end
|
||||||
|
elseif Upload.ServiceUsed == 'fivemanage' or Upload.ServiceUsed == 'fivemerr' then
|
||||||
|
defwebhook = Upload.Token
|
||||||
|
end
|
||||||
|
TriggerClientEvent('spy-bodycam:client:startDashcamRec', src, defwebhook, Upload.ServiceUsed, netId)
|
||||||
|
else
|
||||||
|
NotifyPlayerSv('Dashcam not turned on!', 'error', 3000, src)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue