Koja Scripts

Items

The new item fields (rarity, throwable, prop, unique, isStash, hanger, backpack, clothing, plate, tint), the bundled Koja items and item images.

Items

Items are defined like in ox_inventory: in data/items.lua, or live on the admin Items pages. Koja adds optional fields. An item without them works exactly as before.

New item fields

data/items.lua
['water'] = {
    label = 'Water',
    weight = 500,
    rarity = 'common',              -- key from data/koja/rarity.lua
    throwable = true,               -- can be thrown (weight decides how far)
    prop = 'prop_ld_flow_bottle',   -- world prop for throws
    unique = true,                  -- never stacks, gets a serial number
},
FieldTypeWhat it does
raritystringRarity key (common, uncommon, rare, epic, legendary, mythic or your own). Colours the slot and sets the discovery time. Default common. metadata.rarity overrides it per item
throwablebooleantrue = can be thrown, false = never. Without the field, throw.anyItem decides
propstringModel thrown for this item. Default throw.defaultProp
uniquebooleanNever stacks and gets metadata.serial
isStashtableTurns the item into a mini stash. See below
hangerbooleanMarks a mini stash as a clothing hanger
backpacktable{ slots, weight } unlocked while worn in the bag slot
clothingtableMakes the item wearable. See below
platetable{ armor = n } — an armour plate for a vest
tintnumberWeapon tint index (also read from tintIndex). The item applies that tint in the attachments view

Items with unique, isStash, backpack or plate never stack. unique and isStash items get a serial number.

Mini stashes

data/items.lua
['toolbox'] = {
    label = 'Toolbox',
    weight = 1500,
    isStash = { slots = 6, maxWeight = 8000, whitelist = { 'screwdriver', 'wrench' } },
},
FieldWhat it does
slotsSlots of the container
maxWeightMax weight of the contents in grams
whitelistItem names allowed inside. Without it every item fits

A mini stash cannot hold another mini stash or itself.

Wearable items

data/items.lua
['backpack_large'] = {
    label = 'Large Backpack',
    weight = 1500,
    stack = false,
    rarity = 'rare',
    backpack = { slots = 10, weight = 20000 },
    clothing = { kind = 'component', id = 5, male = { drawable = 82, texture = 0 }, female = { drawable = 82, texture = 0 } },
},

clothing decides which slot the item goes to and what the ped wears:

FieldWhat it is
kindcomponent or prop
idComponent or prop id — it picks the clothing slot (5 = bag, 9 = vest, 11 = torso...)
male, female{ drawable, texture } for each freemode ped

Clothes taken off the ped without their own item become the generic clothing item, whose metadata holds the piece: { kind, id, drawable, texture, gender, category, label, imageurl } — the same shape as Koja Appearance's getClothingMeta.

Bundled items

The shipped data/items.lua contains these Koja items. Keep them when you merge your own file.

ItemWhat it is
clothingGeneric clothing piece (one per undressed piece)
clothing_hangerHanger: a 15 slot mini stash that stores one outfit. Using it swaps outfits
backpack_smallBag, backpack = { slots = 5, weight = 10000 }
backpack_largeBag, backpack = { slots = 10, weight = 20000 }
armor_vestPlate carrier (clothing id 9) that holds plates
plate_light, plate_medium, plate_heavyPlates with 25, 50 and 100 armour
tint_1 … tint_7Weapon tints: green, gold, pink, army, LSPD, orange, platinum

Images

Item images are PNG files named after the item in web/images/ (or the inventory:imagepath convar), like in ox_inventory. An item without an image shows an icon instead.

Clothing items use metadata.imageurl, filled from the getClothingImage export of clothing.imageResource. Without it they fall back to web/images/clothing_<slot>.png and then to an icon.

Items from the admin panel

Items created or edited on the admin Items pages are stored in koja_inv_items and pushed to every player live.

  • Items from data/items.lua can be edited; the saved version overrides the file. Lua functions in the file are left untouched.
  • Hidden / disabled keeps the definition but blocks creating and using the item. Copies already in inventories stay.
  • Only items created in the panel can be deleted.

See Admin panel.