# Accessible code

{% tabs %}
{% tab title="framework.lua" %}

```lua
Framework = {}
PlayerData = {}

-- if your framework is renamed then change it here
local es_extended = 'es_extended'
local qb_core = 'qb-core'
local esx = GetResourceState(es_extended):find('start')
local qb = GetResourceState(qb_core):find('start')

if esx then
    Framework = { esx = true, name = es_extended }
elseif qb then
    Framework = { qb = true, name = qb_core }
end

SetTimeout(1000, function()
    if table.type(Framework) == 'empty' then
        for i = 1, 5 do
            warn(("No framework resource was found, check %s/framework.lua"):format(cache.resource))
        end
    end
end)
```

{% endtab %}

{% tab title="shared/shared.lua" %}

```lua
Config = {
    Locale = 'en',

    Commands = {
        Radars = {
            name = 'radars',
            help = 'Open radars control panel',
        },
    },

    Events = {
        esx = {
            loaded = 'esx:playerLoaded',
            logout = 'esx:onPlayerLogout',
            setjob = 'esx:setJob'
        },
        qb = {
            loaded = 'QBCore:Client:OnPlayerLoaded',
            logout = 'QBCore:Client:OnPlayerUnload',
            setjob = 'QBCore:Client:OnJobUpdate',
        }
    },

    -- rest of config is in game
}
```

{% endtab %}

{% tab title="locales/en.json" %}

```json
{
    "cancel": "Cancel",
    "confirm": "Confirm",
    "save": "Save",
    "status": "Status",
    "active": "Active",
    "inactive": "Inactive",
    "relocate": "Relocate",
    "select": "Select",
    "selected": "Selected",
    "teleport": "Teleport",
    "delete": "Delete",
    "activate": "Activate",
    "deactivate": "Dectivate",
    "settings": "Settings",
    "only_admin": "Admin Only",
    "speed": "Speed",

    "admin_required": "Admin access required",
    "teleport_to_radar": "Teleport To Radar",
    "delete_radar": "Delete Radar",
    "search_radars": "Search radars",
    "speed_limit": "Speed Limit",
    "dialog_title": "Dialog Title",
    "field_required": "This field is required",
    "edit_speed": "Edit Speed",
    "new_speed_value": "Enter new speed value",
    "confirm_required": "Confirmation Required",
    "confirmation_required": "Confirmation is required",
    "confirm_required_sure": "Are you sure you want to proceed?",
    "activate_radar": "Activate Radar",
    "deactivate_radar": "Dectivate Radar",
    "sure_activate": "Are you sure you want to activate this radar",
    "sure_deactivate": "Are you sure you want to deactivate this radar",
    "sure_delete_radar": "Are you sure you want to delete this radar?",
    "sure_teleport_to_radar": "Are you sure you want to teleport to this radar",
    "enter_valid_hex_color": "Please enter a valid hex color",
    "radarExists": "A radar with this name already exists",
    "name_too_long": "Name cannot be longer than 15 characters",

    "generalSettings": "General Settings",
    "allowed_jobs": "Allowed Jobs",
    "whitelisted_vehicles": "Whitelisted Vehicles",
    "radar_prop": "Radar Prop",
    "instant_money_remove": "Instant Money Remove",
    "money_type": "Money Type",
    "cash": "Cash",
    "bank": "Bank",
    "speed_unit": "Speed Unit",
    "multiplier": "Multiplier (speed * multiplier = price, if above limit)",
    "fine_cooldown": "Fine Cooldown (seconds)",

    "keys": "Keys",
    "finish": "Finish",
    "moveup": "Move Up",
    "movedown": "Move Down",
    "moveright": "Move Right",
    "moveleft": "Move Left",
    "moveforward": "Move Forward",
    "moveback": "Move Back",
    "rotateright": "Rotate Right",
    "rotateleft": "Rotate Left",
    "increase_distance": "Increase Distance",
    "reduce_distance": "Reduce Distance",

    "logs": "Logs",
    "enable_logs": "Enable Logs",
    "webhookURL": "Webhook URL",
    "enterURL": "Enter Discord webhook URL",
    "botName": "Bot Name",
    "identityType": "Identity Type",
    "identityType1": "Steam Name",
    "identityType2": "RP Name",
    "webhookColor": "Webhook Color",

    "radarSettings": "Radar Settings",
    "radarActive": "Radar Active",
    "radarName": "Radar Name",

    "blipsSettings": "Blips Settings",
    "enableBlips": "Enable Blips",
    "blipLabel": "Blip Label",
    "blipID": "Blip ID",
    "blipScale": "Blip Scale",
    "blipColor": "Blip Color",

    "addNewradar": "Add New Radar",
    "addNewRadarDesc": "Configure radar settings below",
    "createRadar": "Create Radar",

    "basicSettings": "Basic Settings",
    "radarStatus": "Radar Status",
    "enterSpeedLimit": "Enter speed limit",

    "blipSettings": "Blip Settings",
    "blipStatus": "Blip Status",
    "enterBlipID": "Enter Blip ID",
    "enterBlipColorID": "Enter Blip Color ID",
    "enterBlipScale": "Enter Blip Scale",

    "manage_radars": "Manage Radars",
    
    "no_permission": "You don't have permission to use this command",
    "placeing_object": [
        "[ [ ] - Rotate left  \n",
        "[ ] ] - Rotate right  \n",
        "[ ↑ ] - Move Forward  \n",
        "[ ↓ ] - Move Back  \n",
        "[ → ] - Move Right  \n",
        "[ ← ] - Move Left  \n",
        "[ Q ] - Move Up  \n",
        "[ Z ] - Move Down  \n",
        "[ ENTER ] - Finish  \n",
        "[ BACKSPACE ] - Cancel  \n"
    ],
    "placeing_radius": [
        "[ - ] - Increase Distance  \n",
        "[ + ] - Increase Distance  \n",
        "[ ↑ ] - Move Forward  \n",
        "[ ↓ ] - Move Back  \n",
        "[ → ] - Move Right  \n",
        "[ ← ] - Move Left  \n",
        "[ Q ] - Move Up  \n",
        "[ Z ] - Move Down  \n",
        "[ ENTER ] - Finish  \n",
        "[ BACKSPACE ] - Cancel  \n"
    ],
    "success_cancel": "You successfully cancel action",
    "paid_fine": "You paid €%s fine for driving above limit, limit: %s, your speed: %s",
    "log_title_created": "Radar Created",
    "log_title_msg": "%s created new radar %s at %s",
    "radar_deleted_title": "Radar Deleted",
    "radar_deleted_msg": "%s has deleted radar %s",
    "radar_activated_title": "Radar Activated",
    "radar_activated_msg": "%s has activated radar %s",
    "radar_deactivated_title": "Radar Deactivated",
    "radar_deactivated_msg": "%s has deactivated radar %s",
    "radar_name_edited_title": "Radar Name Edited",
    "radar_name_edited_msg": "%s has renamed %s to %s",
    "radar_speed_edited_title": "Radar Speed Edited",
    "radar_speed_edited_msg": "%s has edited speed of %s to %s",
    "radar_blip_activated_title": "Radar Blip Activated",
    "radar_blip_activated_msg": "%s has activated %s blip",
    "radar_blip_deactivated_title": "Radar Blip Deactivated",
    "radar_blip_deactivated_msg": "%s has deactivated %s blip",
    "radar_blip_label_changed_title": "Radar Blip Label Changed",
    "radar_blip_label_changed_msg": "%s has changed %s blip label to %s",
    "radar_blip_id_changed_title": "Radar Blip Id Changed",
    "radar_blip_id_changed_msg": "%s has changed %s blip id to %s",
    "radar_blip_scale_changed_title": "Radar Blip Scale Changed",
    "radar_blip_scale_changed_msg": "%s has changed %s blip scale to %s",
    "radar_blip_color_changed_title": "Radar Blip Color Changed",
    "radar_blip_color_changed_msg": "%s has changed %s blip color to %s"
}

```

{% endtab %}

{% tab title="client/editable.lua" %}

```lua
function Notify(description, type)
    lib.notify({
        description = description,
        duration = 4500,
        type = type,
        position = 'bottom'
    })
end

RegisterNetEvent('uniq_radarsystem2:Notify', Notify)
```

{% endtab %}

{% tab title="server/editable.lua" %}

```lua
function IsAdmin(playerId)
    return IsPlayerAceAllowed(playerId, 'command')
end

function SendBill(playerId, price)
    local identifier = GetIdentifier(playerId) -- in case you need
end


-- data.playerId
-- data.price
-- data.limit
-- data.myspeed
function PayFine(data)
    local notify = false

    if GlobalState.Settings.general.instantMoneyRemove == true then
        if Framework.esx then
            local xPlayer = ESX.GetPlayerFromId(data.playerId)

            if xPlayer then
                if GlobalState.Settings.general.moneyType == 'money' then
                    local money = xPlayer.getInventoryItem('money').count or 0

                    if money >= data.price then
                        xPlayer.removeInventoryItem('money', data.price)
                        notify = true
                    else
                        SendBill(data.playerId, data.price)
                    end
                elseif GlobalState.Settings.general.moneyType == 'bank' then
                    local money = xPlayer.getAccount('bank')?.money or 0

                    if money >= data.price then
                        xPlayer.removeAccountMoney('bank', data.price)
                        notify = true
                    end
                end
            end
        else
            local xPlayer = QBCore.Functions.GetPlayer(data.playerId)

            if GlobalState.Settings.general.moneyType == 'money' then
                local money = xPlayer.Functions.GetMoney('cash') or 0

                if money >= data.price then
                    xPlayer.Functions.RemoveMoney('cash', data.price)
                    notify = true
                else
                    SendBill(data.playerId, data.price)
                end
            elseif GlobalState.Settings.general.moneyType == 'bank' then
                local money = xPlayer.Functions.GetMoney('bank') or 0

                if money >= data.price then
                    xPlayer.Functions.RemoveMoney('bank', data.price)
                    notify = true
                else
                    SendBill(data.playerId, data.price)
                end
            end
        end
    else
        SendBill(data.playerId, data.price)
    end

    if notify then
        TriggerClientEvent('uniq_radarsystem2:Notify', data.playerId, Locales.paid_fine:format(data.price, data.limit, data.myspeed))
    end
end
```

{% endtab %}
{% endtabs %}
