---
description: >-
  Here you will get your installation guide for the script and how to configure
  it as per your server.
---

# Installation and Config

[**Buy Script**](https://a5-scripts.tebex.io/category/scripts)

[**CFX Post**](https://forum.cfx.re/t/qb-esx-standalone-advanced-cams/4925498)

[**Youtube Preview**](https://youtu.be/yMCKeZwfCdI)

## Dependencies

ScreenshotBasic: [Download ](https://github.com/citizenfx/screenshot-basic)

### Installation Guide

1. Download the script from your [Keymaster](https://keymaster.fivem.net/asset-grants)
2. Unzip the file `a5-policecams.zip` and place it in your resource folder
3. In your `server.cfg` do ensure `a5-policecams`
4. `Restart your server`

## Configure Your Resource

### QBCore

To use this resource with QBCore Framework. Go to `a5-policecams/Shared/sh_config.lua` and set the framework to `qb`

{% code title="a5-policecams/Shared/sh_config.lua" %}
```lua
Shared.Framework = 'qb' -- ['qb'] ['esx'] ['custom']
```
{% endcode %}

If you are using Old QBCore without the export. You can enable the option in `a5-policecams/Shared/sh_config.lua`

{% code title="a5-policecams/Shared/sh_config.lua" %}
```lua
Shared.UseOldQB = false -- if you want to use old method of calling core and not the export
Shared.OldQbTrigger = "QBCore:GetObject"
```
{% endcode %}

You can also edit the getcoreobject function if you renamed your core by going to `a5-policecams/server/sv_main.lua` and `a5-policecams/client/cl_cams.lua` and editing the function

{% code title="a5-policehub/server/sv_main.lua" %}
```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 Policecams")
    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 PoliceCams")
    else
        print("Framework Not Supported")
    end
end)

```
{% endcode %}

### ESX

To use this resource with ESX Framework. Go to `a5-policecams/Shared/sh_config.lua` and set the framework to `esx`

{% code title="a5-policecams/Shared/sh_config.lua" %}
```lua
Shared.Framework = 'esx' -- ['qb'] ['esx'] ['custom']
```
{% endcode %}

If you are using Old ESX without the export. You can enable the option in `a5-policecams/Shared/sh_config.lua`

{% code title="a5-policecams/Shared/sh_config.lua" %}
```lua
Shared.UseOldESX = false -- if you want to use old method of calling core and not the export
Shared.OldESXTrigger = "esx:getSharedObject"
```
{% endcode %}

You can also edit the getcoreobject function if you renamed your core by going to `a5-policecams/server/sv_main.lua` and `a5-policecams/client/cl_cams.lua` and editing the function

{% code title="a5-policehub/server/sv_hub.lua" lineNumbers="true" %}
```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)
```
{% endcode %}

### Image Saving

The script uses Discrod webhook to upload images. You can setup your webhook in the following file `a5-policecams/Shared/sh_config.lua by creating a discord webhook. To learn how to create a discord webhook visit` [`this link`](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks)

{% code title="a5-policecams/Shared/sh_config.lua" %}
```lua
Shared.DiscordWebHook = "YOUR-WEBHOOK-HERE" -- Put your webhook here to save screenshots to discord https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
```
{% endcode %}

### Adding Cameras

If you want to add cameras. You can create your own custom category and it will show directly on the UI. This is the format you should use

{% code title="a5-policecams/Shared/sh_config.lua" %}
```lua

['custom'] = { -- the name of the category
    MarkerColor = 'rgb(240, 22, 120)', -- category color to show in UI
    MarkerIcon = 'fa-solid fa-building-columns', -- The icon used to show on UI https://forums.gta5-mods.com/topic/12424/reference-timecycle-modifier-setting-names
    CamType = 'secret_camera', -- camera effect type
    CamStrength = '0.96', --the strength of the effect
    CarSpeedIndecator = false, -- if the camera should have car speed indicator
    CameraMovement = true, --if camera can move using WASD
    coords = {
        [0] = {
            [0] = {location = nil, x = 433.25845336914, y = -978.44812011719, z = 33.743709564209, h = 116.2878036499, IsDisabled = false}, --0 index should always have location = nil
            [1] = {x = 424.03778076172, y = -996.80932617188, z = 34.468765258789, h = 113.70291137695, IsDisabled = false},
            [2] = {x = 427.49160766602, y = -1012.0303344727, z = 34.171649932861, h = 111.28598022461, IsDisabled = false},
            [3] = {x = 438.60894775391, y = -999.51812744141, z = 33.068157196045, h = 208.72505187988, IsDisabled = false},
            [4] = {x = 466.30383300781, y = -1016.0286865234, z = 35.468776702881, h = 228.79200744629, IsDisabled = false},
            [5] = {x = 494.36407470703, y = -967.91625976563, z = 35.67956161499, h = 96.381248474121, IsDisabled = false},
        },
    }
},
```
{% endcode %}

### Extra Functions

These functions are used for customization. In case you needed to trigger something when a certain UI element is triggered. You can find them in `a5-policecams/client/cl_cams.lua`

{% code title="a5-policecams/client/cl_cams.lua" %}
```lua
function OpenUI()
    -- gets triggered when you open the first UI
end

function CloseUI()
    -- gets triggered when you close the UI
end

function OpenCamera()
    -- gets triggered when you open or change camera
end

function CloseCamera()
    -- gets triggered when you close the cam
end

---This function triggers when you scan a vehicle plate
---@param plate string - vehicle plate
---@param speed integer - the speed
function ScanVehicle(plate, speed)
    -- gets triggered when you scan a vehicle with ctrl+x
end
```
{% endcode %}

### Locale

You can change some certain Script locales by heading to `a5-`policecams`/Shared/sh_lang.lua` Additionally you can edit UI locale through the HTML file

{% code title="a5-policecams/Shared/sh_lang.lua" %}
```lua
Lang.PoliceOnly = "No Access to this"
Lang.NotNearStation = "Not Near Station"

```
{% endcode %}

## Extra Information

* W A S D to move the camera
* CTRL+W To zoom in. CTRL+S to zoom out
* CTRL+X to plate read
* CTRL+C to take screenshot
* You can use the following client event to open the cams `'a5-policecams:client:OpenCamMenu'`
