Skip to content

Examples and troubleshooting

All examples change config.lua in the ares_electrician folder. Restart the resource after every change:

restart ares_electrician

Allow lobbies of one player. Dispatch then only offers sites made for one player.

Config.MaxPlayers = 1

Edit the multipliers inside Config.Dispatch:

difficultyMultipliers = {
easy = 1.0,
medium = 2.0,
hard = 3.0,
expert = 4.0
},

A hard site with basePay = 800 now pays 2400 for the lobby. The same multiplier also scales XP, so a hard job gives 300 XP with the default defaultXPPerJob = 100.

Config.JobItems = {
{item = 'water', count = 1},
{item = 'sandwich', count = 3}
}

The items are removed when the player ends the job or leaves the lobby. The item names go through Config.InventoryAliases, so water becomes water_bottle on qb-inventory.

customSpawnCoords = {
vector3(299.9698, -449.0337, 43.5865),
vector3(300.0, -450.0, 43.5)
},

Keep useCustomSpawnForFirstVehicleOnly = true.

Config.Leveling.enabled = false

No XP is given and no pay bonus is applied. Pay is the plain site pay.

At the default settings a medium job gives 150 XP and a hard job gives 200 XP. Level 3 needs 1500 XP, which is about 10 medium jobs. Two ways to speed this up:

defaultXPPerJob = 300,

or lower the xpRequired values in Config.leveling.levels.

The opacity value a is 0 to 255. Change it from 0.8 to 200:

color = {r = 37, g = 87, b = 35, a = 200},
Config.JobCenter = {
coords = vector3(100.0, 200.0, 30.0), -- replace with your coordinates
radius = 2.0,
blip = {
sprite = 408,
color = 3,
scale = 0.8,
name = "Electrician Job Center"
}
}

When the work van spawns, the host’s game triggers the client event vehiclekeys:client:SetOwner with the van’s plate. qb-vehiclekeys and key resources that copy it listen to this event, so they work without extra setup.

  • Another key resource: add a small listener in your own resource (client side) that gives the key in your system. Use the real export of your key resource:

    RegisterNetEvent('vehiclekeys:client:SetOwner', function(plate)
    exports['my_keys']:GiveKeyByPlate(plate)
    end)

    Do not add this if your key resource already listens to the same event, or the player gets the key twice.

  • No keys on your server, or keys handled elsewhere: set Config.WorkVan.giveKeys.enabled = false.

  • Only the host gets the keys. If your key resource needs a key to start the engine, the partner needs a key from the host. Use the key sharing feature of your key resource.

  • The player who opens the lobby is the host. Only the host presses Start Job and takes the job offer.
  • A lobby holds Config.MaxPlayers players (default 2).
  • Every lobby member gets the waypoint and the blip for the site.
  • A lobby with 1 player only gets sites for 1 player. A lobby with 2 players only gets sites with minPlayers = 2 and maxPlayers = 2. If you raise Config.MaxPlayers above 2, also add sites that accept that lobby size, or those lobbies get no offers.
  • The pay of a job is shared equally between the lobby members. Each player’s level bonus is applied to their share.
  • Every lobby member gets XP.
  • Any lobby member can start the repair at the site.
  • When a player leaves the lobby, their job items are removed and their map blips are cleared.
  • Reroll asks dispatch for another random job from the matching sites. If only one site matches, you may get the same one again.
  • The reroll limit is off by default (enableRerollLimit = false).
  • When you turn it on, the counter goes up each time the player accepts a job and returns to 0 when a job is completed. In version 1.2.2 presses of the Reroll button are not counted. Test your values before you use the limit on a live server.
  • Never turn the limit on with maxRerolls = 0. That blocks every job offer.
  • Use one logical item name in Config.JobItems and map it per inventory in Config.InventoryAliases.
  • If an item has no alias entry for your inventory, the name is used unchanged.
  • If the item name does not exist in your inventory, the player does not receive it. Turn on Config.Debug to see the failed attempt in the console.
  • Giving and removing items needs a detected inventory. On QBCore and QBox the framework’s own item functions are used when no inventory is detected. On ESX nothing is given.

Sometimes the lobby resource asks the players to swap the work van. The players see a notification such as “Drive to the marked place and park inside the highlighted zone”. They park the van in the zone and everyone gets out. The van is replaced and the job continues.

If the parking area is full or the van cannot be created, the host sees a message and can try again after a moment. If you use customSpawnCoords, make sure the position is free and that the value is a table of vector3.

If a player closes a minigame before finishing it, or fails it, the job counts as failed. The lobby is paid a reduced amount and gets less XP.

If every work van of the lobby is destroyed, the job ends.

XP is stored per player, not per character. All characters of one player share the same XP and level.

Problem Likely cause Fix
The console says the resource folder name is wrong The folder is not called ares_electrician Rename it to exactly ares_electrician and restart the server.
The resource does not start and a dependency is missing ares-core or ox_lib is not installed or not started Install them and start them before ares_electrician. Keep the folder name ares-core.
The console reports that no supported framework was found The framework is not started before the job, or its resource name is different Start es_extended, qb-core or qbx-core first. Set Config.Framework to 'esx' or 'qb-core' if auto-detection fails.
There is no target option at the job center No target resource is running, or it starts after the job Start ox_target or qb-target before ares_electrician. Set Config.Target. Turn on Config.Debug to see the zone.
The lobby window does not open or the job does not start ares-core is not running Check that ares-core is started and has no errors.
“No jobs available” appears No site is in range, no site matches the lobby size, or all sites were removed Increase Config.Dispatch.maxDistance, check minPlayers and maxPlayers of the sites, or add sites.
A lobby of 2 never gets a job Only sites with minPlayers = 2 and maxPlayers = 2 are offered to 2 players Add sites for 2 players. See Job sites.
XP is not saved or the console shows database errors The SQL file was not imported, or oxmysql is not running Import the SQL file shipped with the resource and start oxmysql.
The marker is not visible The default opacity a = 0.8 is almost transparent Use a = 200.
The language did not change The language code does not match a file in shared/lang, or the JSON is invalid Check the file name, check the JSON for missing commas or quotes, and restart. The script falls back to English.
Some texts stay in English Those texts are not read from the language files See Language files.
Players do not get keys Your key resource does not listen to vehiclekeys:client:SetOwner Add a listener as shown in the vehicle keys section above.
Custom notifications do not show Config.Notification is not 'custom', or the code in notify.lua is incomplete See Framework adapter.
Job items are not given The item does not exist, or no inventory is detected Check the item name, Config.InventoryAliases and Config.Inventory.
The work van does not appear The parking area is full, or customSpawnCoords is wrong Wait and try again. Check that customSpawnCoords is a table of vector3 and that the position is free.

For anything else, set Config.Debug = true, repeat the problem and read the server and client consoles. Set it back to false afterwards.