Bablo ResourcesDocs

Configuration

All configuration lives in config.lua. Routes and boxes built with the Route Creator are saved in data/placements.json instead, so this file holds the server-wide rules and the default routes.

Changes to config.lua need a resource restart to take effect (restart bablo-electricjob in the console).

The bridge files are open too: frameworks/notification, frameworks/outfit, frameworks/vehiclekeys and frameworks/<framework>/server.lua with the mission hooks. See Exports & Hooks.


Debug

LUA
Config.DEBUG = false -- testing only: one round per repair and extra logs

Makes repairs short for testing: a breaker cabinet needs one round instead of four or five, and a fuse box has one blown fuse instead of two to four. It also prints extra lines in the server console and in each player’s F8 console, for example which framework and target were detected.

Keep Config.DEBUG = false on a live server.


Framework

LUA
Config.Framework = 'auto' -- auto, qbcore, qbox or esx

auto checks for es_extended, then qbx_core, then qb-core, and waits up to 5 seconds for one of them to start. Force a value only if detection picks the wrong one. When no framework is found, the job does not work.

Each framework has its own open bridge files in frameworks/<framework>. They read the character name and identifier, pay out money and send notifications.


Language

LUA
Config.Locale = 'en' -- en or sv

The language of the menus, the mission panel, the tips and the route creator, loaded from locales/<locale>.json (en and sv ship with the resource). See Languages for how to add one.


Inventory

LUA
Config.Inventory = 'auto'

The job uses no items. The inventory is detected at startup, but nothing in the job uses it. Leave it as it is.


Target and prompts

LUA
Config.Target = 'auto'
Config.Interaction = 'auto'
SettingUsed for
Config.TargetEvery interaction of the job: the options at the dispatcher and at the boxes. auto uses ox_target when it runs, then qb-target, otherwise standalone. With standalone, players get a built-in [E] prompt with the option’s name within 2.5 metres.
Config.InteractionDetected at startup (ox_lib when it runs, otherwise standalone), but no prompt of the job uses it. Leave it as it is.

The bridge files are in src/interactions.


Notifications

LUA
Config.Notify = 'framework' -- framework, ox_lib or gta
ValueNotifications use
frameworkThe notifications of your framework (QBCore, Qbox or ESX).
ox_libThe ox_lib notifications.
gtaThe GTA notification feed above the map.

Any other value works like framework. If the framework notification fails, the GTA feed is used. While a player is working on a box, messages show on the screen of that box instead. The bridge is frameworks/notification/client.lua.


Brand

LUA
Config.Brand = 'LSDWP Power Division' -- menu header and map blip

The name in the header of the work order menu and the name of the depot blip. Below it, the menu shows Los Santos electrical maintenance (brandDescription in the language file). To give the blip another name than the menu, set label in the depot blip.


Command

LUA
Config.Command = 'electrician' -- F7, answers crew invites

The chat command that answers a crew invitation. It is bound to F7 by default. A new invitation pops up in the middle of the screen by itself; when a player closed it with Escape, F7 gives them the mouse back to click Join crew or Decline. While the menu is open, the command closes it.

It does not open the work order menu. That only opens at the dispatcher, with Electrician work orders.

The F7 default is set in the script, not here. Players can bind another key in their settings. See Commands.


Currency

LUA
Config.Currency = {
    pattern = '$%s',
    thousands = ',',
    account = 'bank',
}
OptionDescription
accountThe framework money account payouts are paid into, for example bank or cash. On ESX, cash is the money account.
pattern, thousandsNot read by the script.

The menu writes amounts as US dollars, for example $1,500, and in the Swedish number format when Config.Locale is sv. The payout notification reads Work order settled. You earned $1500. See Payouts.


Tutorial

LUA
Config.Tutorial = {
    enabled = true,
    command = 'electrichelp',
    dismissKey = 'F6',
}

First-time tips during a repair: three for breaker cabinets and three for fuse boxes, one for each step. A tip shows the first time a character reaches its step. Tips are saved per character on the server once shown, and finishing a repair marks every tip of that box type as learned. See First-Time Tips.

OptionDescription
enabledfalse shows no tips and does not register the two commands below.
commandChat command that shows the tip for the current step again. It only works during a repair.
dismissKeyDefault key of the electrichelpdismiss command, which closes the tip on screen.

See Commands.


Mission HUD

LUA
Config.MissionHud = {
    movable = true,
    showControls = true,
    toggleKey = 'I',
}

The Mission Progress panel on the right of the screen during a work order. See Mission HUD & Waypoints.

OptionDescription
movabletrue lets players move and resize the panel with /editelectricui. With false the command does nothing and its hint on the panel is hidden.
showControlsShows the key hints at the bottom of the panel: Hide progress with the toggle key, and Move & resize with /editelectricui.
toggleKeyDefault key of the electricianhud command, which hides and shows the panel. The hint on the panel shows this key.

Placement

LUA
Config.Placement = {
    enabled = true,
    command = 'electriceditor',
    ace = 'command.electricplacer',
    maxDistance = 0, -- 0 = place anywhere
}

The in-game Route Creator. Routes and boxes it saves go to data/placements.json.

OptionDescription
enabledfalse removes the creator commands, and the server refuses every creator request. Routes already saved in data/placements.json still load.
commandChat command that opens the creator. /electriceditor and /electricplacer always open it as well.
aceThe ACE a player needs to use the creator. It is checked on the server each time the creator loads, saves or deletes. Players without it get You do not have permission to use the electrician placer.
maxDistance0 lets admins place boxes anywhere. Any other value is the most metres a player may stand away from a box when saving or deleting it. Further away they get Move closer to the placement before saving.

Your character stays where you opened the placement camera, so with maxDistance set you have to walk to the area first. Give the ACE in server.cfg, see Installation.


Work outfit

LUA
Config.WorkOutfit = {
    enabled = true,
    male = {
        components = {
            [3] = { 64, 0 }, -- arms and gloves
            [4] = { 38, 2 }, -- coverall pants
            [6] = { 12, 0 }, -- boots
            [8] = { 15, 0 }, -- undershirt
            [9] = { 0, 0 }, -- vest
            [10] = { 0, 0 }, -- decals
            [11] = { 65, 2 }, -- coverall top
        },
        props = {
            [0] = { 145, 0 }, -- hard hat
        },
    },
    female = {
        components = {
            [3] = { 75, 0 },
            [4] = { 38, 2 },
            [6] = { 68, 0 },
            [8] = { 15, 0 },
            [9] = { 0, 0 },
            [10] = { 0, 0 },
            [11] = { 59, 2 },
        },
        props = {
            [0] = { 144, 0 },
        },
    },
}

Work clothes that crew members wear while their crew has a work order. They are put on when the work order starts and the player’s own clothes are put back when it is finished or cancelled, or when they leave the crew. See Work Outfit.

OptionDescription
enabledfalse leaves every player in their own clothes.
male, femaleThe outfit for the male (mp_m_freemode_01) and the female (mp_f_freemode_01) freemode character. Other peds keep their clothes.
componentsClothing: [slot] = { drawable, texture }.
propsHats, glasses and other props: [slot] = { drawable, texture }. A drawable of -1 takes the prop off.

Only the slots you list are changed. The slot numbers are the ones of GTA:

ComponentsSlot
Mask1
Arms and gloves3
Legs4
Bags5
Shoes6
Accessories7
Undershirt8
Body armour9
Decals10
Top11
PropsSlot
Hats0
Glasses1
Ears2
Watches6
Bracelets7

Theme

LUA
Config.Theme = {
    accent = '#7aadff',
    accentDark = '#5596ff',
    accentSoft = '#d9e8ff',
    accentText = '#0e0f11',
    panel = '#0e0f11',
    panelOpacity = 0.95,
    text = '#fafafa',
    mutedText = '#afafaf',
    border = '#ffffff',
    borderOpacity = 0.10,
    row = '#ffffff',
    rowOpacity = 0.02,
    success = '#a4ff7a',
    danger = '#ff7a7a',
}

The colours of the work order menu, the invitation pop-up, the mission panel, the tips and the route creator. Colours are written as #RRGGBB or #RGB, opacities from 0 to 1. What each colour is used for is on Theme.


Effects

LUA
Config.Effects = {
    soundGain = 0.55,
    soundDistance = 12.0,
    smokeMs = 6500,
    smokeDistance = 35.0,
}

Sound and smoke at the boxes. Everyone nearby hears and sees them, not only the technician.

OptionDescription
soundGainVolume of the box sounds: breaker switches, the main switch, fuses and the test relays.
soundDistancePlayers further away than this many metres hear nothing. The sound gets quieter with distance.
smokeMsHow long smoke rises from a box after a shock, in milliseconds.
smokeDistancePlayers within this many metres see the smoke.

Job

Config.Job holds the rules of the job, the depot, the van and the default routes. It is split into parts below, in the same order as the file. Every option on this part of the page is inside Config.Job = { ... }. Times are in milliseconds (1000 = 1 second) and distances in metres.

Crews and distances

LUA
Config.Job = {
    maxMembers = 4,
    inviteMs = 30000,
    leaseMs = 300000,
    inviteDistance = 15.0,
    repairDistance = 3.0,
    depotDistance = 12.0,
    returnRadius = 15.0,
    -- ...
}
OptionDescription
maxMembersThe most players in one crew, the leader included. Use 1 to 4. The limit is checked on the server; the menu always counts a crew out of four and stops offering invitations at four members. A higher value works like 4. With a lower value, the menu still offers invitations, and the server answers The crew is full.
inviteMsHow long an invitation stays open. The pop-up counts it down.
leaseMsTime limit for one repair. When it runs out, the repair stops and the box has to be opened again from the start. Every finished round at a breaker cabinet gives a fresh time limit.
inviteDistanceHow close another player has to stand to show under Players nearby and to be invited, also by ID. To accept, the invited player has to be this close to the crew leader.
repairDistanceHow close a player has to stand to open a box or to help at one. A technician who moves more than 1 metre further away loses the repair, and a helper stops helping. Keep it at 2.5 or more, the distance of the target options.
depotDistancePlayers within this many metres of the depot count as being at the depot. Starting a crew, inviting without a crew, starting a work order, collecting the van and returning it only work there.
returnRadiusThe van counts as returned when it stands within this many metres of the van spot. The leader also has to be this close to the van.

See Crews & Invites and Helping a Crewmate.

Payout

LUA
Config.Job = {
    -- ...
    crewBonusPercent = { [1] = 0, [2] = 10, [3] = 20, [4] = 30 },
    defaultRoutePayout = 1500, -- routes built with the creator
    -- ...
}
OptionDescription
crewBonusPercentExtra percent on top of the route payout, by the number of players in the crew when the work order starts. Use 0 to 100. A crew size that is not listed, or a value outside that range, gets no bonus.
defaultRoutePayoutThe payout of a route the creator names by itself (Name it automatically under Build a service route). Use a whole number from 0 to 100000; a value outside that range gives 1000. A route you name yourself gets the payout you type in Route payout.

The route payout plus the bonus is split evenly over the crew that started the work order, rounded down. With a 1500 route that is 1500 for one player, 825 each for two, 600 each for three and 487 each for four. Every member who is still in the crew is paid when the leader returns the van, into Config.Currency.account. See Payouts.

Dispatch

LUA
Config.Job = {
    -- ...
    dispatch = {
        maxOffers = 5, -- routes on the board at once, 0 = all
        refreshMs = 10 * 60 * 1000,
        completedCooldownMs = 10 * 60 * 1000,
        unloadedGraceMs = 15000,
    },
    -- ...
}

The work order board in the menu. See Work Orders.

OptionDescription
maxOffersHow many routes the board offers at once. 0 offers every free route. When a route is taken, a waiting route takes its place.
refreshMsHow often the board picks a new set of routes. Routes that have waited longest come first. The menu counts down to it: New dispatch in …
completedCooldownMsA finished route is kept off the board for this long. A cancelled route can be offered again right away.
unloadedGraceMsA crew member whose character is logged out for this long is taken out of the crew. A player who switches to another character is taken out within a few seconds, and a player who leaves the server straight away.

A route that another crew is working on is never offered.

Repair timings

LUA
Config.Job = {
    -- ...
    openMs = 3000,
    diagnoseMs = 2000,
    verifyMs = 2200,
    closeMs = 3000,
    -- ...
}
OptionDescription
openMsHow long opening a breaker cabinet takes. A fuse box opens straight away.
diagnoseMsNot read by the script. Reading the cabinet screen takes as long as the player needs.
verifyMsHow long the test runs after the power is switched back on, at both kinds of box.
closeMsHow long closing a breaker cabinet takes after its last round.

See Cabinet Repair and Fuse Box Repair.

Shocks

LUA
Config.Job = {
    -- ...
    shockFailures = 2, -- mistakes in a row before a shock, 0 = off
    shockMs = 4000,
    -- ...
}
OptionDescription
shockFailuresMistakes in a row before the technician gets a shock. At a breaker cabinet a mistake is a wrong switch, at a fuse box a test that trips. A correct step resets the count. 0 turns shocks off.
shockMsHow long the shock lasts. Then the repair ends and the box has to be opened again from the start.

At a breaker cabinet the technician is also knocked back. Smoke rises from the box for smokeMs, see Effects. The breaker cabinet tip tells players how many mistakes in a row give a shock.

Fuse boxes

LUA
Config.Job = {
    -- ...
    fuseChance = 0,
    fuseTurnClicks = 6,
    fuseTurnMs = 240,
    fuseMouseTurns = 4,
    serviceFuseMs = 2400,
    serviceTerminalMs = 2000,
    -- ...
}
OptionDescription
fuseChanceNot read by the script. Whether a box is a fuse box or a breaker cabinet is set per box, see Sites.
fuseTurnClicksHow many clicks it takes to screw a fuse fully in or out (2 to 12). Each click is checked by the server and makes a sound.
fuseTurnMsHow long a fuse takes to settle after its last click.
fuseMouseTurnsHow many full circles with the mouse it takes to screw a fuse fully in or out (0.5 to 4).
serviceFuseMs, serviceTerminalMsNot read by the script.

See Fuse Box Repair.

Depot

LUA
Config.Job = {
    -- ...
    depot = vector4(735.28, 130.74, 80.71 - .97, 239.76),
    -- ...
}

Where the dispatcher stands, as vector4(x, y, z, heading). The depot blip is placed here, and players count as being at the depot within depotDistance of this point. The default takes .97 off the height so the dispatcher’s feet stand on the ground.

Dispatcher

LUA
Config.Job = {
    -- ...
    dispatcher = 's_m_m_dockwork_01',
    -- ...
}

The ped model of the dispatcher. The dispatcher stands still at the depot with a clipboard and cannot be hurt. Players use three options on the dispatcher:

OptionWho sees it
Electrician work ordersEveryone. Opens the work order menu.
Collect work vanThe crew leader, after starting a work order, while the crew has no van yet.
Return van and get paidThe crew leader, after every box of the route is repaired.

Depot blip

LUA
Config.Job = {
    -- ...
    depotBlip = { enabled = true, sprite = 354, colour = 3, scale = 0.75, shortRange = true },
    -- ...
}
OptionDescription
enabledfalse shows no depot blip.
spriteThe blip icon.
colourThe blip colour.
scaleThe blip size.
shortRangetrue only shows the blip on the minimap when you are close. false always shows it.

Two more options can be added: label gives the blip its own name (without it, the blip is named after Config.Brand), and display sets the GTA blip display mode.

Van

LUA
Config.Job = {
    -- ...
    van = {
        model = 'burrito3',
        coords = vector4(743.58, 131.81, 80.07, 241.38),
        spawnOnStart = true,
        spawnSide = 'server', -- server or client
    },
    -- ...
}

The work van of a crew. See Work Van.

OptionDescription
modelSpawn name of the van.
coordsWhere the van is parked out and has to be returned, as vector4(x, y, z, heading). While the crew collects or returns the van, its blip and waypoint point here.
spawnOnStarttrue parks the van out as soon as the leader starts a work order. false makes the leader collect it at the dispatcher with Collect work van.
spawnSideserver lets the server create the van. client lets the leader’s game create it; the server then checks the model, that the leader owns it and that it stands within 25 metres of the spot.

When another vehicle stands within 4 metres of coords, the van cannot be parked out and the leader gets The van bay is occupied. Clear it and try again. The leader can then use Collect work van once the spot is free.

The van has to be within 150 metres of a box before that box can be opened. If the van disappears from the world during the work order, the work order is cancelled: Your work van was lost. Select a new order at the depot.

Zone regions

LUA
Config.Job = {
    -- ...
    zoneRegions = {
        PALETO = 'paleto',
        PROCOB = 'paleto',
        -- ...
        SANDY = 'sandy',
        GRAPES = 'sandy',
        -- ...
    },
    -- ...
}

Which region a route gets when the creator names it by itself (Name it automatically). The key is a GTA zone name, the value is city, sandy or paleto. Zones that are not listed count as paleto from y 5400 north, as sandy from y 1200 north and as city everywhere else.

The region decides under which filter a route shows in the menu: City, Sandy or Paleto. Routes you name yourself get the region you pick in the creator.

Orders

LUA
Config.Job = {
    -- ...
    -- Default routes; routes made with the in-game creator are saved in data/placements.json
    orders = {
        {
            id = 'la_mesa',
            title = 'La Mesa service round',
            area = 'La Mesa',
            region = 'city',
            description = 'Restore two distribution cabinets and replace the damaged fuses in a wall box.',
            difficulty = 'Routine',
            duration = '10-15 min',
            payout = 2400,
            sites = { 'supply_01', 'supply_02', 'fuse_01' },
        },
        {
            id = 'cypress',
            title = 'Cypress Flats outage',
            area = 'Cypress Flats',
            region = 'city',
            description = 'Trace an intermittent supply fault and restore the local service cabinet.',
            difficulty = 'Routine',
            duration = '5-8 min',
            payout = 1000,
            sites = { 'supply_03' },
        },
    },
    -- ...
}

The default routes. Routes saved with the creator are added to these.

FieldDescription
idUnique name of the route.
titleThe route name on the work order board.
areaName of the area, for your own overview. The menu does not show it.
regioncity, sandy or paleto: the filter the route shows under. Left out, it counts as city.
descriptionThe text on the route card.
difficultyShown on the route card as written.
durationThe estimated time shown next to the payout, as written.
payoutThe total route payout before the crew bonus and the split.
sitesThe ids of the boxes on this route, from Sites.

A route without any box is not offered.

The routes and boxes here are only defaults. A box that is saved in data/placements.json always uses the saved version, also when it is deleted there, so editing that box here does nothing. The data/placements.json that ships with the resource deletes the four example boxes (supply_01, supply_02, fuse_01 and supply_03), so the two example routes above are not on the board; the ready-made routes in that file are offered instead. Give boxes you add here ids of your own, or build them with the route creator.

Sites

LUA
Config.Job = {
    -- ...
    sites = {
        supply_01 = {
            id = 'supply_01',
            title = 'Distribution cabinet LS-014',
            x = 734.21,
            y = -1063.44,
            z = 22.16,
            h = 180.0
        },
        fuse_01 = {
            id = 'fuse_01',
            title = 'Fuse box LS-019',
            x = 787.56,
            y = -1109.58,
            z = 21.684,
            h = 90.0,
            repairKind = 'fuse'
        },
        -- ...
    },
}

The default boxes. The server places a prop at every box when the resource starts.

FieldDescription
key, idUnique name of the box. Use the same name for both. Don’t use return_depot.
titleThe box name, shown on its map blip and as a step in the mission panel.
x, y, zWhere the box stands.
hThe heading the box faces.
repairKind'fuse' makes it a small wall fuse box. Left out, it is a large breaker cabinet.

Placing boxes by hand is fiddly, because the box has to sit exactly on the ground or against a wall. The Route Creator finds the surface for you and shows the box before you save it.