Koja Scripts

Configuration

Every block of shared/config.lua, shared/shops.lua and shared/crafting.lua with defaults and what each option does.

Configuration

The config lives in three files:

FileWhat it holds
shared/config.luaEverything except shops and recipes
shared/shops.luaConfig.Shops
shared/crafting.luaConfig.Recipes and Config.Crafting

General

OptionDefaultDescription
Config.Locale'en'Language file from locales/.
Config.DebugfalseExtra console output.
Config.KeysTAB, Z, EDefault keys for open, hotbar and interact. Players can rebind them.
Config.HotbarSize5Number of hotbar slots.
Config.SaveInterval60Seconds between database saves of changed inventories.
Config.ImagePath'images/'Where item images are loaded from.
Config.InteractDistance3.0Distance for ground items, search and similar.
Config.GiveDistance3.5Max distance to the person you give an item to.
Config.StartItemswater, sandwich, phoneItems a new character gets once.
Config.AdminGroupsadmin, superadmin, godFramework groups with admin access, in addition to the ACE command.koja-inventory-v2.
Config.WebhooksemptyDiscord webhooks for give, drop, admin, shop and craft logs.

Player and equipment

OptionDefaultDescription
Config.Player.width / height10 / 5Pocket grid size in cells.
Config.Player.maxWeight35000Carry limit in grams for pockets, equipment and the worn backpack together.
Config.Slotsbackpack, vest, primary, secondaryBuilt-in equipment slots. An item goes in a slot when its equip matches the slot's accepts.

Cash

Config.Cash.enabled makes money and black_money real items that mirror the framework accounts in both directions. Config.Cash.accounts maps each item to the ESX and QBCore account names.

ox_inventory compatibility

OptionDefaultDescription
Config.Ox.enabledtrueTurns on the ox API, the data import and the migration.
Config.Ox.sourcesox_inventory/data/, then ox/Where the ox items.lua, weapons.lua, shops.lua, stashes.lua and crafting.lua are read from.
importItems, importShops, importStashes, importCraftingtrueWhat to import.
migratePlayerstrueImport a player's ox inventory the first time they join.
exportstrueAlso answer exports.ox_inventory calls.
esxBridgetrueFeed ESX's ox mode (xPlayer.addInventoryItem and so on).
stackSize / ammoStack100 / 250Stack size for imported items and ammo.
scrapItem'scrap_metal'What imported weapons salvage into.

Clothing and gear

OptionDefaultDescription
Config.Clothing.enabledtrueOne slot per clothing piece.
Config.Clothing.appearance'illenium-appearance'Appearance resource to save to and read item names and images from.
Config.Clothing.replaced'storage'Where a piece goes when you put another one on: 'storage' (your pockets) or 'delete'.
Config.Clothing.watchenabled, interval 1000, settle 2000, grace 3000Reads clothes put on by other scripts. A change must stay settle ms before it is synced; nothing syncs in vehicles or ragdoll and for grace ms after.
Config.Clothing.categories11 piecesKey, prop or component id, label, size and weight of each clothing slot.
Config.Clothing.nakedGTA defaultsDrawable that counts as "nothing worn" per component and gender.
Config.Gear.enabledtrueShows the backpack (component 5) and vest (component 9) on the character. The look comes from the item ped field.
Config.Outfitsenabled, nameMax 32, duration 3500Outfit items and outfit bags.

Vehicles

OptionDescription
Config.Trunk.default / classes / modelsTrunk grid and weight by vehicle class (0 to 20) or model. false means no trunk.
Config.Trunk.frontTrunkModels whose trunk is at the front.
Config.GloveboxGlovebox grid and weight, per class.
Config.TrunkPropsTrunk contents shown as props in the car: maxProps, renderDistance, floorDepth, margin, prop models by size, alwaysVisible for pickups.

Drops

Config.Drops controls ground drops: grid size and weight, lifetime (seconds), mergeRadius (drops closer than this merge), maxPerPlayer, renderDistance, physics settling (dropHeight, settleTimeout, settleSpeed) and the pile threshold. Config.DropDots draws the small dots over items on the ground.

Stashes

Config.Stashes is a list of { name, label, coords, radius, width, height, maxWeight, jobs, shared }. shared = false gives every player their own stash at that spot. You can also create stashes in game. See Admin panel.

Search, frisk and give

OptionDescription
Config.SearchJobs that can use /search and whether the target must have hands up or be dead.
Config.FriskFrisking from behind: command, key, target (ox_target option), distance, angle, reveal timing, which states allow it (hands up animations, cuffed, dead).
Config.HandoverThe give flow: offer timeout, cooldowns, hand prop and animations, pickTimeout and pickAngle for choosing the receiver with the camera.

Weapons

OptionDefaultDescription
Config.Weapons.disableWeaponWheeltrueWeapons are drawn from the hotbar only. The radio wheel in vehicles still works.
Config.Weapons.saveAmmoInterval10Seconds between ammo reports from the client.
inVehicle, vehicleDriver, vehiclePassenger, vehicleDenyClassesDrive-by rules. Bicycles are blocked by default.
Config.ThrowThrowing the held weapon: key, charge time, force, max distance, from-vehicle rules and a deny list.
Config.Workshopenabled, fov 38The 3D attachment workshop.

Held items

Config.Hands controls items held in the hand: the keys (E use, right mouse throw, left mouse put down, X put away), hold and carry animations, props per model in props, and items that cannot be held in deny.

Durability

OptionDefaultDescription
Config.Durability.enabledtrueWeapons and tools wear out and can be repaired.
broken'keep'At 0%: 'keep' (unusable until repaired) or 'remove' (the item falls apart).
weapons.perShot0.05Percent lost per shot. weapons.classes overrides it by name pattern (snipers, shotguns, SMGs, pistols...).
toolslockpick 25, fishing_rod 2, shovel 4Percent lost per use.
craftToolslockpick 10, repairkit 8Percent lost when used as a crafting tool.
repairsweapon_kit, repairkit, scrap_metalRepair items: amount, categories or items they can repair, duration.

An item can override all of this with its own durability = { shot, use, craft }. See Items.

Shops

Each entry in shared/shops.lua:

shared/shops.lua
{
    name = 'general',
    label = '24/7 Store',
    blip = { sprite = 52, color = 2, scale = 0.7 },
    width = 8,
    locations = { vec3(25.7, -1347.3, 29.49) },
    jobs = nil,
    items = {
        { name = 'water', price = 6 },
        { name = 'bandage', price = 35, stock = 20 },
    },
}

stock limits how many can be bought until the shop restocks. Shops can also be created in game.

Crafting

shared/crafting.lua
Config.Recipes = {
    lockpick = {
        result = { name = 'lockpick', count = 1 },
        ingredients = { scrap_metal = 2 },
        tools = { 'repairkit' },
        duration = 4000,
    },
}

Config.Crafting = {
    aliases = { scrap_metal = { 'scrapmetal' }, cloth = { 'clothe' } },
    hand = { 'bandage', 'lockpick', 'backpack_small' },
    benches = {
        { name = 'workbench', label = 'Workbench', locations = { vec3(-347.11, -133.33, 39.01) }, recipes = { 'lockpick', 'radio' } },
    },
}
  • tools are needed but not used up (they lose durability if the durability system tracks them).
  • aliases let other item names count as an ingredient, for example the ox item scrapmetal for scrap_metal.
  • hand lists recipes available from the inventory without a bench.
  • Benches can also be created in game.

Other

OptionDescription
Config.ItemNotifyThe item popup on the right when you get or lose items.
Config.SignsThe floating sign over shops, benches and stashes.
Config.DumpstersSearchable dumpsters: models, loot table, refill time, searches per hour.
Config.DummiesTest peds for admins (/invdummy).
Config.DebugKitsItem kits for /invkit.