☰ All guides
ESXQB-Core

6-GPS V1

Job GPS: colleagues with an active GPS see each other on the map.

Resource folder

six_gps_v1

01Requirements

  • ESX (1.1, 1.2 or Legacy) or QB-Core
  • No database resource needed.

02Installation

  1. 01Sign in to the Cfx Portal with the account you bought with and download the script under Granted Assets.
  2. 02Unzip the download and move the folder six_gps_v1 into the resources folder of your server. Keep the folder name and upload every file, including the hidden .fxap.
  3. 03Create the item gps. ESX: run the statement below. QB-Core: add the line below to qb-core/shared/items.lua.
  4. 04QB-Core only: open fxmanifest.lua and remove the line '@es_extended/imports.lua'. That file does not exist on a QB server and causes an error at start.
  5. 05Open config.lua and set Config.framework to "esx" or "qb".
  6. 06Add ensure six_gps_v1 to your server.cfg, below your framework.
  7. 07Restart the server (or run refresh and then ensure with the folder name in the server console).
ESX
INSERT INTO items (name, label) VALUES ('gps', 'GPS');
qb-core/shared/items.lua
gps = { name = 'gps', label = 'GPS', weight = 100, type = 'item', image = 'gps.png', unique = false, useable = true, shouldClose = true, description = 'Shows your position to your colleagues' },

Good to know

ox_inventory: items are not read from the database. Add the item to ox_inventory/data/items.lua instead: ['gps'] = { label = 'GPS', weight = 100 },

03How players use it

Using the item gps switches the device on, using it again switches it off. While it is on, everyone in the same job with an active GPS sees each other as blips. Jobs listed in NoAccessToGPS cannot switch it on.

04Configuration

Option

Config.framework
"esx" or "qb".
Config.newESX
true for ESX Legacy (1.2 and newer, shared object via export). false for old ESX 1.1 (shared object via event). Ignored on QB.
Config.Language
"en" or "de".
GPS.item
Name of the GPS item.
GPS.refreshtime
How often positions update, in milliseconds. Default 40 seconds. Lower values cost performance in V1.
GPS.NoAccessToGPS
Jobs that cannot use the GPS.
Config.Blip
Look of the blip: sprite, scale, color, display, category, shortRange.
notify()
Function for notifications. Swap in your own notify event here.

Sprite and colour numbers are listed in the FiveM blip reference.

›config.luaComplete file · 44 lines
config.lua
Config = {}

Config.framework = "esx" -- esx or qb
Config.newESX = true

Config.Language = "en"

Config.GPS = {
    item = "gps", -- GPS item name
    refreshtime = 40 * 1000, -- Change can make performance issues

    NoAccessToGPS = { -- These jobs have no access to start the GPS
        "unemployed",
    }
}

Config.Blip = {
    sprite = 1,
    scale = 1.0,
    color = 0,
    display = 4,
    category = 7,
    shortRange = true,
}

function notify(source, title, message, type)
    -- TriggerClientEvent("six", source, title, message, type, 5000)

    -- Basic ESX Notification:
    TriggerClientEvent('esx:showNotification', source, message)
end

Config.Locales = {
    ['de'] = {
        ["gps_notify_title"] = "GPS-Gerät",
        ["gps_on"] = "Dein GPS Gerät wurde aktiviert",
        ["gps_off"] = "Dein GPS Gerät wurde deaktiviert",
    },
    ['en'] = {
        ["gps_notify_title"] = "GPS Device",
        ["gps_on"] = "Your GPS device has been activated",
        ["gps_off"] = "Your GPS device has been deactivated",
    },
}

Good to know

Modified framework? Every framework call of this script sits in client/esx.lua, client/qb.lua, server/esx.lua and server/qb.lua. Adapt those files if your server uses renamed events or a custom inventory. They stay editable in the Locked version too.

05Troubleshooting

The item cannot be used.

The item gps is missing or has another name than GPS.item.

I don't see my colleagues.

Both players need the same job and an active GPS. Check that your job is not listed in NoAccessToGPS.

06Still stuck?

Open a ticket on our Discord. Send the script name, your framework and version, and the full error from the server console (F8 for client errors). That saves a round of questions.