This is a detailed setup guide for Bodycam & Dashcam. If you have any questions before making a purchase, you can contact us on Discord
Installation
Download & Extract: Place the script in your resources folder.
Add to Server CFG: Add ensure cs_bodycamto your server.cfg.
Configure Settings: Modify config.lua as needed.
Add Inventory Items (Only QB & ESX):
Ox Inventory: Add the following to ox_inventory/data/items.lua:
['bodycam'] = {
label = 'Radio',
weight = 500,
stack = false,
description = 'A portable body camera used by law enforcement.'
client = {
event = 'cs:bodycam:useBodyCam',
remove = function(total)
if total < 1 then
TriggerEvent('cs:bodycam:forceStop')
end
end
}
}
['dashcam'] = {
label = 'Dash Cam',
weight = 500,
stack = false,
description = 'A vehicle-mounted dashcam used for recording footage.'
client = {
event = 'cs:bodycam:useDashCam',
}
},
QB Inventory: Add the following to qb-core/shared/items.lua:
["bodycam"] = {
name = "bodycam",
label = "Body Cam",
weight = 500,
type = "item",
image = "bodycam.png",
unique = true,
description = "A portable body camera used by law enforcement."
},
["dashcam"] = {
name = "dashcam",
label = "Dash Cam",
weight = 500,
type = "item",
image = "dashcam.png",
unique = true,
description = "A vehicle-mounted dashcam used for recording footage."
},
ESX Inventory: Run the following SQL query in your database:
Modify the config.lua file to customize the script:
General Framework Settings
CodeStudio.ServerType = 'QB' -- Choose the framework:
-- 'QB' for QBCore Framework
-- 'ESX' for ESX Framework
-- false for Standalone Mode
Dashboard Panel & Groups
CodeStudio.Dashboard = {
['police'] = {
Dashboard_Access = 4, -- Minimum rank required to view dashboard
Title = 'Los Santos Police Department', -- Name displayed in dashboard
Logo = 'police.png', -- Path to department logo image (optional)
Location = vector4(459.74, -989.2, 24.91, 279.71) -- Physical location to access the dashboard (optional, set to false if not needed)
},
['ambulance'] = {
Dashboard_Access = 4,
Title = 'Pillbox Hospital Department',
Logo = 'ambulance.png'
}
}
Using Standalone Mode
If you are running a standalone server (not using QBCore or ESX), you need to define user permissions manually using Steam, Ace Permissions, Discord IDs, or Role IDs. Hereβs how to configure it:
['put_perms_here'] = {
DashBoard_Access = 'put_perms_here', -- Steam/Ace Group/Discord ID/Role ID to allow dashboard access
Title = 'YOUR Department', -- Name of the department
Logo = 'police.png', -- Department logo (optional)
Location = { -- Physical location for dashboard access (set to false if not needed)
vector4(485.74, -989.2, 24.91, 279.71)
}
},
DashBoard_Access: Replace 'put_perms_here' with Steam HEX, Ace Group, Discord ID, or Role ID.
Title: Department name.
Logo: Path to department logo.
Location: If set, players must stand at this position to access the dashboard. Set to false if not required.
BodyCam Settings
CodeStudio.BodyCam = {
Enable = true, -- Enable or disable body camera functionality
AllowCivilians = true, -- Allow civilians to use body cams (true = allowed, false = restricted to dashboard users)
ShowProfilePic = true, -- Show the profile picture of the player when using the bodycam
Use = {
WithItem = false, -- If true, players need an item in their inventory to use bodycam
ItemName = 'bodycam', -- Item name required if WithItem is enabled
DisconnectOnNo_BodyCam = false, -- If true, disconnects users without bodycam item access
WithCommand = true, -- Enable command-based activation
CommandName = 'bodycam' -- Command to activate bodycam
}
}
DashCam Settings
CodeStudio.DashCam = {
Enable = true, -- Enable or disable dashcam feature
UseMPH = false, --To change KMPH to MPH
Use = {
WithItem = false, -- If true, players need an item to use dashcam
ItemName = 'dashcam', -- Item name required if WithItem is enabled
RemoveItemOnUse = false, -- If true, item is removed after use
WithCommand = true, -- Enable command-based activation
CommandName = 'dashcam' -- Command to activate dashcam
},
Restrict_Vehicle = {-- Restrict access to certain vehicles set Restrict_Vehicle to false to allow all vehicles
['police'] = true,
['polguarlet'] = true,
['ambulance'] = true
}
}
Recording Settings
CodeStudio.Recording = {
Enable = false, -- Enable or disable recording feature
Fivemanage = false, -- If true, uses FiveManage API
Fivemerr = false, -- If true, uses FiveMerr API
RecordFPS = 45, -- The FPS at which video recordings will be captured
RecordMic = false, -- If true, microphone audio is recorded with video
Max_Recording_Time = 30 ---Max time Allowed to Record a single clip (In Seconds)
}
Enable: Turns the recording feature on or off.
Fivemanage: If using FiveManage API, set this to true.
Fivemerr: If using FiveMerr API, set this to true.
RecordFPS: Determines the frame rate of the recorded video.
RecordMic: If true, records microphone audio with the video.
Max_Recording_Time: The maximum duration (in seconds) for a single recording clip.
Note: The recording API or discord webhook settings can be configured in sv_function.lua
Use FiveManage or FiveMerr for longer video sizes due to the Discord webhook limit
Enabling Automatic Recording When Using BodyCam (Item)
Modify and replace existing code incs_bodycam\config\functions\sv_function.lua at line 90 with the below code to automatically start recording when a bodycam is used:
if CodeStudio.BodyCam.Use.WithItem then
local itemName = CodeStudio.BodyCam.Use.ItemName
if CodeStudio.ServerType == 'QB' then
QBCore.Functions.CreateUseableItem(itemName, function(source, item)
TriggerClientEvent('cs:bodycam:useBodyCam', source)
Wait(500)
TriggerClientEvent('cs:bodycam:toggleRecording', source)
end)
elseif CodeStudio.ServerType == 'ESX' then
ESX.RegisterUsableItem(itemName, function(source)
TriggerClientEvent('cs:bodycam:useBodyCam', source)
Wait(1000)
TriggerClientEvent('cs:bodycam:toggleRecording', source)
end)
else
--Standalone [You can edit this accordingly] --
end
end
This ensures the recording automatically starts when a player uses the bodycam item.
Adding a Keybind for Recording
To allow players to start recording by pressing Y (configurable), add the following code to cs_bodycam\config\functions\cl_function.lua:
lib.addKeybind({
name = 'record',
description = 'Press Y to record',
defaultKey = 'Y',
onPressed = function(self)
TriggerEvent('cs:bodycam:toggleRecording')
end,
})
This binds the Y key to toggle recording, providing a convenient way for players to start and stop recording manually.
How to Use
Access Dashboard: Stand at the designated location (if set) and open the panel.
Use BodyCam: Run /bodycam (if enabled) or activate via inventory.
Use DashCam: Run /dashcam in a valid vehicle.
Use Recording: Run /recording to open the record panel.