Unzip the file a5-policedash.zip and place it in your resource folder
In your server.cfg do ensure a5-policedash
Restart your server
Configure Your Resource
QBCore
To use this resource with QBCore Framework. Go to a5-policedash/Shared/sh_config.lua and set the framework to qb
Shared/sh_config.lua
Shared.Framework = 'qb' -- ['qb'] ['esx']
If you are using Old QBCore without the export. You can enable the option in a5-policedash/Shared/sh_config.lua
Shared/sh_config.lua
Shared.UseOldQB = false -- if you want to use old method of calling core and not the export
Shared.OldQbTrigger = "QBCore:GetObject"
You can also edit the getcoreobject function if you renamed your core by going to a5-policedash/server/sv_dashcam.lua and a5-policedash/client/cl_dashcam.lua and editing the function
server/sv_dashcam.lua
CreateThread(function()
if Shared.Framework == "qb" then
if Shared.UseOldQB then
TriggerEvent(Shared.OldQbTrigger, function(obj) QBCore = obj end)
else
QBCore = exports['qb-core']:GetCoreObject()
end
print("Loaded QBCore PoliceDash")
elseif Shared.Framework == "esx" then
if Shared.UseOldESX then
TriggerEvent(Shared.OldESXTrigger, function(obj) ESX = obj end)
else
ESX = exports['es_extended']:getSharedObject()
end
print("Loaded ESX PoliceDash")
else
print("Framework Not Supported")
end
end)
ESX
To use this resource with ESX Framework. Go to a5-policedash/Shared/sh_config.lua and set the framework to esx
Shared/sh_config.lua
Shared.Framework = 'esx' -- ['qb'] ['esx']
If you are using Old ESX without the export. You can enable the option in a5-policedash/Shared/sh_config.lua
Shared/sh_config.lua
Shared.UseOldESX = false -- if you want to use old method of calling core and not the export
Shared.OldESXTrigger = "esx:getSharedObject"
You can also edit the getcoreobject function if you renamed your core by going to a5-policedash/server/sv_dashcam.lua and a5-policedash/client/cl_dashcam.lua and editing the function
server/sv_hub.lua
CreateThread(function()
if Shared.Framework == "qb" then
if Shared.UseOldQB then
TriggerEvent(Shared.OldQbTrigger, function(obj) QBCore = obj end)
else
QBCore = exports['qb-core']:GetCoreObject()
end
Debug("Loaded QBCore Policehub")
elseif Shared.Framework == "esx" then
if Shared.UseOldESX then
TriggerEvent(Shared.OldESXTrigger, function(obj) ESX = obj end)
else
ESX = exports['es_extended']:getSharedObject()
end
Debug("Loaded ESX Policehub")
else
print("Framework Not Supported")
end
end)
Debug Mode
You can enable debugmode in a5-policedash/Shared/sh_config.lua this will allow you to see debug prints in addition you will be able to use the dashcam on yourself for testing purposes
Shared/sh_config.lua
Shared.DebugMode = false --enable debug prints and allows you to see your dashcam
Job Restriction
You can restrict the jobs that are allowed to access/use this on. You can pick a group of jobs and you can restrict if jobs can see each other's cams all through the config. In addition to that, you can restrict the use of the dashcam menu for certain ranks. a5-policedash/Shared/sh_config.lua
Shared/sh_config.lua
Shared.AllowedJobs = {
["police"] = true, -- Enter police job in case you changed yours in the core
-- ["sheriff"] = true,
-- ["sahp"] = true,
}
Shared.SeperateJobDashCams = false -- if enabled. Police can only access police. sheriff can only access sheriff
Shared.RankRestrict = true -- if you want only certain ranks to have access to the cams
Shared.RestrictAccessRanks = { -- based on default QB
["police"] = {
["0"] = false, --recruit
["1"] = true,
["2"] = true,
["3"] = true,
["4"] = true, -- chief
},
-- ["sheriff"] = {
-- ["0"] = false, --recruit
-- ["1"] = true,
-- ["2"] = true,
-- ["3"] = true,
-- ["4"] = true, -- chief
-- },
-- ["sahp"] = {
-- ["0"] = false, --recruit
-- ["1"] = true,
-- ["2"] = true,
-- ["3"] = true,
-- ["4"] = true, -- chief
-- },
}
Vehicle Restriction
In the config you need to specify the vehicle that are allowed to use the dashcam on. You can add those vehicle through the shared config a5-policedash/Shared/sh_config.lua
Shared.AllowedVehicles = { -- add your vehicles here example `charger12`
[`police`] = true,
[`police2`] = true,
[`police3`] = false,
}
Extra Functions
These functions are used for customisation. In case you needed to trigger something when the dashcam is active. These functions exist both on the server and client side and are in the exposed portion of the code
Server
-- when dashcam is enabled event
---@param pSource number - the source of the player being spectated
RegisterNetEvent("a5-dashcam:server:OnEnableDashcam", function(pSource)
-- add things here like hide hud or anything you want
end)
-- when dashcam is disabled
---@param pSource number - the source of the player being spectated
RegisterNetEvent("a5-dashcam:server:OnDisableDashcam", function(pSource)
-- add things here like hide hud or anything you want
end)
Client
-- when dashcam is enabled event
RegisterNetEvent("a5-dashcam:client:OnEnableDashcam", function()
-- add things here like hide hud or anything you want
end)
-- when dashcam is disabled
RegisterNetEvent("a5-dashcam:client:OnDisableDashcam", function()
-- add things here like hide hud or anything you want
end)
Locale
You can change some certain Script locales by heading to a5-policedash/Shared/sh_lang.lua
Shared/sh_lang.lua
Lang = {}
Lang.Access = "No access to this!"
Lang.NotNearStation = "You are not Near Police Station"
Lang.PoliceOnly = "This command is for emergency services!"
Lang.MenuHeader = "Police Dashcam System"
Lang.NoActive = "No active Dashcams in the field"