Swarm Electrician
An electrician and power-grid job: on-duty electricians repair faulted or sabotaged substations, criminals can sabotage them with a hacking device, and enough downed substations black out the whole city.
New to Swarm scripts? Read Getting started first. It covers Swarm Bridge, install order and the licence.
Requirements
Frameworks: Qbox, QBCore, ESX, standalone.
| Requirement | What it's for | Included |
|---|---|---|
swarm_bridge | Talks to your framework, inventory, target and so on. Included with every Swarm script. | Yes |
ox_lib | Shared library (callbacks, progress bars, text UI). | No |
oxmysql | Saves player stats and progress. | No |
| ox_target or qb-target | Substation repair and sabotage are target zones, and the depot clerk is a target NPC. | No |
| A supported inventory | The hacking_device item is needed for sabotage (and wrench if you require a tool for repairs). | No |
Install
- Copy the folders
swarm_electrician,swarm_bridgeinto your server'sresourcesfolder. Already haveswarm_bridgefrom another Swarm script? Keep just one copy, the newest. - Add them to
server.cfg, dependencies first:ensure ox_lib ensure oxmysql ensure ox_target ensure ox_inventory ensure swarm_bridge ensure swarm_electrician - Database: tables are created automatically the first time the script starts. If you prefer, import
install/swarm_electrician.sqlyourself first. - Items: add the item definitions for your inventory from
install/items/:ox_inventory.items.luafor ox_inventory (any framework)qbcore.items.luafor QBCore or Qbox with qb-inventoryesx.items.sqlfor legacy ESX
Then copy
install/images/*.pnginto your inventory's image folder (ox_inventory/web/images/orqb-inventory/html/images/). Icons are namedSS_<item>.pngso they never overwrite another resource's images. Every item has an icon included.Items added (2)
hacking_devicewrenchMany servers already have both items. Skip any you already have.
wrenchis only needed if you setConfig.Repair.requireTool = true. - Licensed edition only: put your ServerSecret in
swarm_bridge/licence/private_config.lua. One secret unlocks every Swarm script you own. How to get it. The Source Code edition has no licence check, so skip this. - Start the server and check the console for errors.
Configuration
Open config.lua and check these before going live. Anything marked as a placeholder should be moved to a spot that suits your map.
| Setting | What it does |
|---|---|
Config.DepotPed.coords | Where the power company clerk stands. Placeholder near City Hall. |
Config.Grid.substations | The six substations. Set noProps = true for any spot inside an MLO. |
Config.Grid.blackoutThreshold | How many downed substations cause a city blackout (3 by default). |
Config.Grid.autoFaults | Random faults every faultInterval (300 s, 35% chance). Set false for sabotage-only. |
Config.Sabotage.minCops | Police that must be online before anyone can sabotage (0 = none needed). |
Config.Sabotage.dispatch | Sends a dispatch alert to police and sheriff when a substation is sabotaged. |
Config.Sabotage.item | The sabotage item, 'hacking_device'. Match your server's hacking item. |
Config.Repair.requireTool | false by default. true requires Config.Repair.tool ('wrench'). |
Config.SubstationProps.build | Builds a fenced prop compound at each substation. Set false if your map already has one. |
Config.Locale | 'auto' follows the language set in Swarm Bridge. Set a code such as 'de' to force this script into another language. See Languages. |
Commands & permissions
| Command | Who | What it does |
|---|---|---|
/electrician | Everyone | Opens the hub (clock in, grid board, upgrades) from anywhere. |
/elecpos | Debug mode only | Prints and copies your position as a vec3. Only exists while Config.Debug = true. |
Debug helpers only exist while Config.Debug = true in config.lua. Leave debug off on a live server.
No ACE permissions are needed.
Keys
- Target your substations and the depot clerk. No extra keys.
Good to know
- Sabotage only needs the item, not a job or clock-in.
- The grid isn't saved, so a restart brings every substation back online.
Need help?
Ask in the Swarm Scripts Discord and we'll help you get set up.
Swarm Scripts
Nyxia Development