> For the complete documentation index, see [llms.txt](https://docs.tworst.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tworst.com/scripts/scrapyard-job/configuration.md).

# Configuration

{% hint style="success" %}
**Your settings survive updates.** In 3.0 every value you change is saved by tw-lib in the database (`tw_lib_settings`). When you install an update, tw-lib writes your values back into the new config file. You never have to back up or merge a config again.
{% endhint %}

***

## Three Ways to Change a Setting

| Way                                                        | Best for                                                                                                                                                                               |
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **In game: `/twlib` → Settings**                           | Pay, XP, bonus, cooldown, crew size, level rules, reward split, interaction style. Saved values apply when the job restarts: use the **Restart** button in the menu.                   |
| **Edit `defaults/config.lua` / `defaults/coordinate.lua`** | Everything else. Save the file and restart `tw-scrapyard`: tw-lib notices your edit and stores it.                                                                                     |
| **Server console: `twlib set`**                            | Quick changes without opening a file: `twlib set tw-scrapyard Config.MaxPlayersInLobby 3`, then `restart tw-scrapyard`. Undo with `twlib unset tw-scrapyard Config.MaxPlayersInLobby`. |

{% hint style="info" %}
After tw-lib stores a value, the line in the config file shows the shipped default next to it, for example `Config.MaxPlayersInLobby = 3 --[[twlib:4]]`. That marker is how tw-lib tells your value from ours. Leave it there.
{% endhint %}

***

## Configuration Files

| File                      | What is inside                                                                                                      |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `defaults/config.lua`     | General settings, lobby, commands, UI colours, regions & rewards, daily missions, sell NPCs, door lock, levels      |
| `defaults/coordinate.lua` | Scrap areas, machines (press, shredder, furnace, rail), vehicle rental, items, sell prices, craft recipes, controls |
| `defaults/locales/*.lua`  | Texts in 7 languages                                                                                                |
| `hooks/*.lua`             | Your own functions (start/end hooks, notifications, prompts)                                                        |

{% hint style="info" %}
There is no `Config.Framework`, `Config.Inventory` or `Config.SQL` anymore: tw-lib detects them. The old key, fuel and skin functions are gone too; `Config.Vehiclekey`, `Config.Removekeys` and `Config.ChangeClothesSystem` still switch those features off.
{% endhint %}

***

## General

```lua
Config.Locale             = TwLibLocale or 'en' -- Language: en, tr, de, fr, pt, ru, ar
Config.CurrencyUnit       = '$'
Config.InventoryImagePath = "nui://qb-inventory/html/images/" -- Where your inventory keeps item images
Config.DefaultItemImage   = "nui://tw-scrapyard/html/img/gun.png"
Config.ServerName         = "TWORST"                           -- Max 10 characters
Config.MoneyType2         = "bank"                             -- Reward account: 'bank' or 'cash'
```

| Inventory     | `Config.InventoryImagePath`       |
| ------------- | --------------------------------- |
| qb-inventory  | `nui://qb-inventory/html/images/` |
| ox\_inventory | `nui://ox_inventory/web/images/`  |

### Language

Default is English. To change it, run `twlib set tw-scrapyard Config.Locale tr` in the server console and restart the job, or change `'en'` in the `Config.Locale` line and restart the job. Both are kept across updates.

***

## Interaction

```lua
Config.InteractionHandler = 'default' -- 'default' | 'drawtext' | 'ox-target' | 'qb-target' | 'auto'
Config.DrawTextUI         = 'twlib'   -- 'twlib' (Tworst prompt) | '3dtext'
Config.InteractionKeyColor = "~g~"
```

| Value                         | Meaning                                                                                                                          |
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `'default'`                   | Use the choice made once for **all** Tworst jobs in `/twlib` → Settings → All jobs (or `twlib set tw-lib interaction ox-target`) |
| `'drawtext'`                  | Tworst prompt with **E**                                                                                                         |
| `'ox-target'` / `'qb-target'` | Target eye                                                                                                                       |
| `'auto'`                      | ox\_target if running, else qb-target, else the Tworst prompt                                                                    |

***

## Lobby & Job

```lua
Config.MaxPlayersInLobby    = 4     -- Crew size
Config.LetOwnerSplitRewards = true  -- The owner sets each member's share of the money reward
Config.jobCoolDownHours     = 0     -- Hours before the same player can work again (0 = none); every crew member counts
Config.jobLevelCheck        = false -- true: everyone in the lobby needs the region's level
Config.ChangeClothesSystem  = true  -- Job uniform on start; the player's own clothes come back at the end
Config.Vehiclekey           = true  -- Give keys for the rented truck
Config.Removekeys           = true  -- Take them back on return
Config.Debug                = false
```

### Who Can Take the Job

```lua
Config.Job = {
    ['job'] = 'all', -- 'all', a job name ('mechanic') or a list ({ 'mechanic', 'police' })
    ...
}
```

The job rule is checked on the server when a lobby is opened **and** when an invite is accepted. On frameworks without jobs (standalone, vRP, TMC) everyone can join.

### Commands

```lua
Config.Command = {
    jobReset     = "jobresetscrapyard",
    jobLeave     = "jobleavescrapyard",
    openTutorial = "openTutorialscrapyard",
}
```

### Tutorial

```lua
Config.AutoOpenTutorialOnJobStart = false -- Open the tutorial for everyone when the job starts
Config.ShowTutorialKeyHint        = false -- Show a small [L] Help chip while working
Config.TutorialDefaultKey         = 'L'   -- Players can rebind it in FiveM key bindings
```

***

## Job Menu Look

The job menu is the shared Tworst job UI inside tw-lib. Scrapyard's colours and pictures:

```lua
Config.UI = {
    primary            = 'rgba(191, 144, 120, 1)', -- Accent: buttons, titles, bars
    primaryHover       = 'rgb(152, 132, 89)',
    primaryTransparent = 'rgba(142, 124, 79, 0.1)',
    background         = 'rgba(24, 22, 21, 0.94)',
    titleBg            = 'rgba(33, 30, 28, 1)',
    titleFont          = 'Nature',
    logo               = 'img/newLogo.png',   -- Path inside html/ or an https:// link
    scoreIcon          = 'img/teamScoreImg.png',
    regionImage        = 'img/region.png',
    scriptName         = 'Scrapyard',
}
```

`Config.DefaultUIPositions` sets where the crew list, score, invite and notification boxes sit on screen. Players can also move them in game.

***

## Job Location & Blips

```lua
Config.Job = {
    ['coords'] = {
        ['intreactionCoords'] = vector3(1213.85, -1251.17, 36.32),
        ['ped'] = true,
        ['pedCoords'] = vector3(1213.85, -1251.17, 36.32),
        ['pedHeading'] = 87.43,
        ['pedHash'] = 0xC5FEFADE,
    },
    ['blip'] = { show = true, blipType = 317, blipColor = 17, blipScale = 0.70 },
    ...
}
```

`['missionBlips']` holds the blips of each task step, the truck and the delivery point.

***

## Regions & Rewards

```lua
['regionData'] = {
    {
        regionID = 1,
        regionInfo = {
            regionName = "El Burro Heights",
            regionImage = "region.png",
            regionMinimumLevel = 0,
        },
        regionAwards = {
            money = 5000,             -- Paid to the crew at the end
            xp = 1000,
            onlineJobExtraAwards = 1, -- Multiplier per extra crew member
            bonusExtraMoney = 500,    -- Bonus task pay
            bonusExtraXP = 200,
        },
        missioncompletedItems = { giveItemPlayer = false, dropMode = "weightedPool", itemList = { ... } },
        regionJobTask = { ... },   -- The task steps (rent, collect, press, shred, melt, fill moulds)
    },
},
```

{% hint style="info" %}
Your changes to a region are saved against its `regionID`. If a later update adds, moves or reorders regions, your money and XP stay with the right region. Keep `regionID` values unique and do not reuse them.
{% endhint %}

### Reward Split

With `Config.LetOwnerSplitRewards = true` the lobby owner sets each member's share in the lobby menu: the crew's total (the reward per player × the members online at the payout) is shared by those percentages. With `false` every member gets the same reward.

### Mission Completion Items

`missioncompletedItems` gives extra items at the end of a region. `dropMode = "perItem"` rolls each item on its own; `"weightedPool"` gives one item from the pool.

***

## Daily Missions

```lua
['dailyMission'] = {
    { name = 'jobtask_one',   count = 50,    xp = 2500, money = 1000 },
    { name = 'jobtask_two',   count = 10,    xp = 1000, money = 3000 },
    { name = 'jobtask_three', count = 10000, xp = 2000, money = 3000 },
    { name = 'jobtask_four',  count = 20,    xp = 2000, money = 3000 },
},
```

{% hint style="info" %}
Changes to a daily mission are saved against its `name`. Keep the names unique.
{% endhint %}

***

## Vehicle Rental

In `defaults/coordinate.lua`:

```lua
Config.VehicleRental = {
    rentalMode = 'spawn_point',   -- 'spawn_point' (fixed trucks) or 'npc' (rent from an NPC)
    depositAmount = 10000,        -- Taken on rent, paid back on return, reset or when the renter leaves
    deliveryCoord = vector4(1204.5, -1302.63, 35.16, 352.7),
    finishJobOnReturn = true,     -- Returning the truck finishes the job
    giveMoneyReward = true,       -- false = only scrap, no money
    lockUntilRented = true,
    npcRental = {                 -- Only with rentalMode = 'npc'
        tiers = {
            cheap = { price = 1000, deposit = 500,  models = { 'sadler' } },
            mid   = { price = 2000, deposit = 1000, models = { 'pony' } },
            pro   = { price = 3000, deposit = 1500, models = { 'mule4' } },
        },
        onePerPlayer = true,
        requireJob = true,
    },
}
```

`Config.VehicleSettings` lists the spawn-point trucks, `Config.VehicleTiers` their capacity.

***

## Selling

In `defaults/coordinate.lua`. Items sell only next to the matching NPC.

```lua
Config.LegalSellableItems = {
    { name = 'iron',      label = 'Iron',      image = 'iron.png',      price = 150 },
    { name = 'gold_dust', label = 'Gold Dust', image = 'gold_dust.png', price = 400 },
}
Config.IllegalSellableItems = {
    { name = 'pistol_part1', label = 'Pistol Part 1', image = 'pistol_part1.png', price = 2500 },
    -- ... parts 2 to 4
}
```

The NPCs themselves (position, model, blip, on/off) are in `defaults/config.lua` under `Config.Job['sellNPCs']`.

***

## Crafting

```lua
Config.Job['craftWeaponEnabled'] = true  -- Illegal weapon crafting (black market)
Config.Job['craftLegalEnabled']  = false -- Legal item crafting
```

Recipes are in `defaults/coordinate.lua`:

```lua
Config.IllegalCraftRecipes = {
    {
        id = 1, name = 'weapon_pistol', label = 'Pistol', image = 'gun.png',
        craftTime = 1200,    -- Seconds
        craftCost = 5000,    -- Taken whole when crafting starts, or not at all
        successChance = 50,
        requiredItems = { { name = 'pistol_part1', amount = 1 }, ... },
        rewardItems   = { { name = 'weapon_pistol', amount = 1 } },
    },
}
Config.CraftTimeMode = {
    OnlineOnly = false,     -- true = the timer only runs while the server is online
    OfflineProgress = true, -- true = the timer runs while the player is offline
}
```

If the reward does not fit the player's inventory, it waits and can be collected later.

***

## Illegal Area Door

```lua
['illegalDoor'] = {
    enabled = false,
    coords = vector3(1163.42, -1251.99, 34.57),
    locked = true,
    interactionKey = 47,       -- G
    authorizedJobs = {},       -- Empty = everyone
    checkRequiredItem = false,
    requiredItem = 'iron',
    requiredAmount = 1,
},
```

***

## Levels

`Config.RequiredXP` holds the XP needed for each of the 70 levels. XP above the requirement carries over to the next level.

***

## Machines, Scrap & Controls

`defaults/coordinate.lua` also holds the scrap areas (`Config.scrapArea`, `Config.ScrapItemList`), the machines (`Config.PressMachines`, `Config.ShreddingMachines`, `Config.Furnaces`, `Config.Rail`, `Config.CrucibleSystem`), timings (`Config.Timing`), the mould rewards (`Config.MoldRewards`) and the keys (`Config.Controls`). Change these only if you move the scrapyard.

***

## Texts

All texts are in `defaults/locales/<language>.lua`. Edit the file and restart the job: tw-lib keeps your edited texts across updates like any other setting. A text missing in a language falls back to English.

***

## Hooks

Functions cannot be stored in the database, so they live in `hooks/`. Copy `hooks/hooks.example.lua` to `hooks/my-hooks.lua` and edit it there. An update replaces only the example; your file is never touched, and it is loaded after the settings, so it wins.

```lua
-- Runs for every player in the lobby before the job starts. Return false to stop that player.
Config.startJobFunction = function(source, owneridentifier)
    local job = exports['tw-lib']:GetPlayerJob(source) -- { name, label, grade }; nil on standalone / vRP / TMC
    return job ~= nil and job.name == 'mechanic'
end

-- Runs for every player when the job is finished.
Config.endJobFunction = function(source, owneridentifier, scoreAmount)
end

-- Your own notification system.
Config.sendNotification = function(messageData)
    local text = type(messageData) == 'table' and messageData.text or messageData
    exports['my-notify']:Send(text)
end
```

***

## Need Help?

{% hint style="info" %}
Join our [Discord](https://discord.gg/tworst) and open a ticket.
{% endhint %}
