Code Studio
Tebex DiscordYoutubeGitHub
  • 🌟Welcome to Code Studio
  • Overview
    • πŸ’‘What we do
  • πŸ“œOur Scripts
    • Ultimate License System
      • πŸ› οΈSetup
    • Bodycam & Dashcam
      • πŸ› οΈSetup
    • Weather Management
      • πŸ› οΈSetup
    • Car Radio - Car Play Pro
      • πŸ› οΈSetup
    • Modern HUD
      • πŸ› οΈSetup
    • Modern Shops
      • πŸ› οΈSetup
    • Advanced Radio
      • πŸ› οΈSetup
    • Modern ID Card
      • πŸ› οΈSetup
    • Billing Invoice System
      • πŸ› οΈSetup
    • Radial Menu
      • πŸ› οΈSetup
    • Death Screen
      • πŸ› οΈSetup
    • Boss & Gang Menu
      • πŸ› οΈSetup
    • Advanced Notification
      • πŸ› οΈSetup
    • Fingerprint Scanner
      • πŸ› οΈSetup
    • Drunk System + Alcohol Tester
      • πŸ› οΈSetup
    • Advanced Job + ID Card
      • πŸ› οΈSetup
    • Drug Selling + Level Based
      • πŸ› οΈSetup
    • Multi Job System
      • πŸ› οΈSetup
    • Discord2FiveM [V2]
      • πŸ› οΈSetup
    • Modern Radio
      • πŸ› οΈSetup
    • Grappling Gun
      • ♦️Standalone
  • ⚠️FiveM Escrow Protection FAQ
    • Home
    • Error parsing script ... <\1>
    • Failed to verify protected resource
    • You lack the required entitlement
    • What to do if nothing is fixing the errors
Powered by GitBook
On this page
  • Installation
  • Configuration
  • How to Use
  1. Our Scripts
  2. Bodycam & Dashcam

Setup

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

  1. Download & Extract: Place the script in your resources folder.

  2. Add to Server CFG: Add ensure cs_bodycamto your server.cfg.

  3. Configure Settings: Modify config.lua as needed.

  4. 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:

      INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES
      ('bodycam', 'Body Cam', 1, 0, 1),
      ('dashcam', 'Dash Cam', 1, 0, 1);

Configuration

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
    RecordMicKey = 'J',  -- (Push To Talk Key) Microphone audio capture with video recordings
    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.

  • RecordMicKey : Push-to-Talk key to record audio while recording.

  • 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

  1. Access Dashboard: Stand at the designated location (if set) and open the panel.

  2. Use BodyCam: Run /bodycam (if enabled) or activate via inventory.

  3. Use DashCam: Run /dashcam in a valid vehicle.

  4. Use Recording: Run /recording to open the record panel.

PreviousBodycam & DashcamNextWeather Management

Last updated 2 months ago

πŸ“œ
πŸ› οΈ