📹Dashcams V2

Introduction

Dashcams adds the ability for your players to view live dashcam feeds from vehicles that can be specified within the config file, This also allows your dispatchers to record the feed while they are watching it, allowing them to playback this footage for future roleplay ventures.

This script is written to work with QBCore and ESX Legacy - This can also be used as standalone

Features of Power Dashcams v2:

  • The ability to browse and view available dashcam feeds a simple but effective UI.

  • The ability for the viewer to record the feed, allowing it to be played back at any time,

  • Recordings are automatically segmented, allowing smooth uploading, when played back they are seamlessly merged allowing for smooth playback.

  • Recordings can be searched to allow fast and simple locating of past recordings.

  • Records Vehicle Speed and Location to allow for additional roleplay ventures.

  • The ability for dashcams to be viewed anywhere with the dashcam command

  • Ability to define certain jobs and ranks that can access the command

  • Ability to define new vehicles that are fitted with dashcams,

  • UI Displays all available vehicles spawned within the server.

  • Ability to change notifications and language within the config.


Installation

  • Download the power_dashcams_v2 from Keymaster

  • Add the files to your resources folder

  • Ensure that the resource file will start (either ensure your resource in the server.cfg or inside a folder which is started on server start)

  • Edit the config file to your needs

  • Restart your server


FiveMerr Integration

Due to recent limitations put in place with Discord images, we now require you to use FiveMerr to handle the images and videos for this script. You will need to make an account at https://fivemerr.com/.

The best part is, their services are free to use and includes multiple media types, logs, and more to come! You can view more details by joining their discord at discord.gg/fivemerr

After creating your account at FiveMerr, go to API Tokens, and create a new video token.

Going into your html folder, open the script.js file, and ensure fivemerr is set as your apiService and edit the apiKey on the following line:

const apiService = 'fivemerr';
const apiKey = `API_KEY` // REPLACE API_KEY WITH YOUR FIVEMERR API KEY

Replace API_KEY with the token you have created in FiveMerr


Configuration

Select the tab below for your framework to see the configuration options available.

To add new vehicles that are capable of utilizing dashcams, follow the below format:

AllowedVehicles = {
 [`police`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`police2`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`police3`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`police4`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`police5`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polaudia4`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polbike`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polbmw`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polbmw2`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polbus`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polcharger`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`pole60`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polevo9`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polevo10`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polfrontier`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polheli`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polmazda6`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polnspeedo`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polqashqai`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polrange`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polskoda`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polskoda2`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polskoda3`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`poltahoe`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polxt`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polz`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`polzonda`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`2020tacoma`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`opke`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`ekam`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`ekamG65`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`unaudia4`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`unevo9`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`unevo10`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25},
 [`unrange`] = {boneName = "bonnet", xOffset = 0.16, yOffset = -0.60, zOffset = 0.25}
}

Editable files

client_functions.lua

Custom Notifications

If you would like to edit the notifications to add your own custom notifications or to match them to your other server notifications, you can edit them in the client_functions.lua file. Default notifications are as follows:

function sendNotification(message) 
 TriggerEvent('chatMessage', 'Dashcam', {255, 0, 0}, {message})
end 

Framework Compatibility

If you need to edit some of the framework functions to work with your framework, you can edit them in the client_functions.lua. Callbacks are setup for the player job and job grade for qb_core and es_extended.

if GetResourceState('qb_core') == 'started' then
 local QBCore = exports['qb-core']:GetCoreObject()

 function GetJobName()
  return QBCore.Functions.GetPlayerData().job.name
 end

 function GetJobGrade()
  return QBCore.Functions.GetPlayerData().job.grade
 end
 return
end

if GetResourceState('es_extended') == 'started' then
 local ESX = exports['es_extended']:getSharedObject()

 function GetJobName()
  return ESX.GetPlayerData().job.name
 end

 function GetJobGrade()
  return ESX.GetPlayerData().job.grade
 end
 return 
end 

function GetJobName()
 return 'police'
end

function GetJobGrade()
 return 1
end

RegisterCommand('dash', function(source, args, rawCommand)
 TriggerServerEvent('dashcams:load')
end, false)

server_functions.lua

Discord Webhook

If you would like to add a discord webhook, you can add it to the server_functions.lua. Be sure to change the CHANGEME to your webhook URL.

uploadWebhook = 'https://discord.com/api/webhooks/CHANGE_ME'

if uploadWebhook == 'https://discord.com/api/webhooks/CHANGE_ME' then
 print('You have not changed the webhook in server_functions.lua, please change this to your own discord webhook.')
end

Framework Compatibility

If you need to edit some of the framework functions to work with your framework, you can edit them in the server_functions.lua. Callbacks are setup for the player name and job name for qb_core and es_extended.

if GetResourceState('qb_core') == 'started' then
 local QBCore = exports['qb-core']:GetCoreObject()

 function GetName(source)
  local Player = QBCore.Functions.GetPlayer(source)
  return Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname   
 end

 function GetJobName(source)
  local Player = QBCore.Functions.GetPlayer(source)
  return Player.PlayerData.job.name
 end

 return 
end

if GetResourceState('es_extended') == 'started' then
 local ESX = exports['es_extended']:getSharedObject()

 function GetName(source)
  local player = ESX.GetPlayerFromId(source)
  return player.getName()
 end

 function GetJobName(source)
  local player = ESX.GetPlayerFromId(source)
  return player.getJob().name
 end

 return 
end 

function GetName(source)
 return GetPlayerName(source)  
end

HTML

HTML files can be edited if need for additional language support or styling edits.

Additional language edits can be applied in index.html

Look for the following terms that can be translated:

  • Active Dashcams

  • Past Recordings

  • View Feed

  • Close

  • View Recording

Last updated

Was this helpful?