Koja Scripts

Admin panel

Every page of the /invadmin panel: Home, Addon Management, World containers, Items, Rarity, Crafting benches, Players, History, Security, Clothing, Shops, Stashes, Permissions and Locales.

Admin panel

The admin panel is built into the inventory. Everything you change there is saved in the database and applied live for every player — no restart.

Opening it

  • Type /invadmin (the command name is admin.command in data/koja/admin.lua).
  • Or click the Admin panel tab in the inventory. The tab is only shown to staff.
  • Optional keybind: set admin.key (for example 'F10').

/invadmin takes an optional page: /invadmin items, /invadmin shops, /invadmin createItem... and deep links such as /invadmin item:water, shop:General, stash:police, bench:workshop, player:12, rarity:rare or track:<serial or item>.

Home

Home

Live server stats: online players, loaded and open inventories, item definitions (file + admin), registered shops and stashes, actions logged today and security reports. Quick links jump to the most used tools (create item, shop or stash, inspect players, history, security, locales, permissions).

Addon Management

Switch every feature on or off for all players: clothing as items, backpacks, mini stashes, throwing, weight effects, plate armour, item discovery, trading, hover & give, 3D shop interaction, weapon 3D attachments, multi-select, rename & describe and inventory history. Disabled features fall back to stock ox_inventory behaviour.

Ped preview mode switches the ped in Your clothes between Clone ped and Pause menu ped.

World containers

SectionWhat it does
Dumpster lootLoot table of dumpsters: item, min, max, chance %. Empty = dumpsters stay empty
Vehicle lootLoot of the trunks and gloveboxes of vehicles nobody owns, filled the first time they are opened
Search animationPlayers rummage in the dumpster / at the trunk while its inventory is open
ox_target options"Search dumpster", "Open trunk", stashes and evidence on ox_target (servers without inventory:target)

Each search rolls up to 3 rows; a row drops with its chance and a random amount between min and max. Dumpsters already searched keep their contents until the server restarts.

Items

Create Item / Edit Item

The item list has search, filters (rarity, source: data/items.lua or admin created), column picker, and actions Edit, Duplicate, Track item and Delete (admin created items only).

The editor:

SectionFields
IdentityItem name (cannot be renamed later), display label, description (Markdown in the tooltip), image (filename, HTTPS URL or nui:// path), rarity
Inventory rulesWeight, stackable, close inventory on use, unique, consume, degrade (minutes), durability, decay, hidden / disabled
Use experienceUse time, animation and prop preset (key or JSON), status change (hunger, thirst, stress), success notification, cancelable, block movement / vehicle / combat, usable while armed
Special behaviourThrowable, world prop, mini stash (slots, max weight, whitelist), backpack (extra slots, extra weight), plate armour
Weapon definitionRuntime fields of weapons from data/weapons.lua (read only where it applies)

Saving updates loaded inventories immediately. Custom Lua functions in data/items.lua stay untouched. Hidden / disabled keeps the definition but blocks creating and using the item.

Edit Rarity

Name, label, colour, Discovery time (seconds an item stays "Discovering..." in other inventories) and Enable reveal timer (countdown on the slot). Deleting a rarity makes its items common.

Crafting benches

A list of every bench (from data/crafting.lua or created in the panel) and an editor:

SectionFields
Basic propertiesBench id (cannot be changed later), display name
AccessOptional job / group restriction with a minimum grade
RecipesResult item, count, max count (random amount), duration (ms), metadata (JSON), ingredients. Ingredients below 1 are tools that lose that fraction of durability
LocationsPoints with a marker and [E]. Add my position fills your coords
Target zonesox_target box zones (size, rotation, distance). Empty = one zone at every location
Map blipSprite, colour, scale

Saved benches apply live (recipes, markers, zones, blip). A bench from the file is overridden by the saved version; Restore file version brings the file definition back. Deleted file benches stay deleted after restarts until restored.

Players

A live list of online players (search by name, identifier or server id, auto refresh) and their inventory. Select an item to:

  • see and edit the instance — its metadata as JSON (label, description, durability, serial, ammo, components...),
  • remove it (with an amount),
  • track it in the history.

Inspect in game opens the player's inventory read-only in your own inventory window.

History

The audit log of every inventory action, stored in SQL, so it survives restarts.

  • Filters: action, free search (player, identifier, item, serial, inventory) and paging.
  • Actions: transfer / move, give, drop, pickup, purchase, craft, use, trade, throw, rename, clothing, stash, open, close and admin add / edit / remove.
  • Track item: enter a serial number or an item name to see Live locations (where it is now in loaded inventories) and its recorded movement.

Rows older than history.retentionDays (30) are removed automatically.

Security

SectionWhat it shows
StatsOnline players, loaded / open inventories, drops, blocked, critical and warnings
ReportsRejected or flagged inventory operations, filterable by kind
EventsNet events the inventory exposes
Hooksexports.ox_inventory:registerHook callbacks registered by other resources
Startup convarsWeapon mismatch, suppress pickups, disable weapons, network dumpsters, target — read only

Settings (applied live and saved):

SettingWhat it does
Emergency inventory lockBlocks every new inventory open. Not saved after a restart
Auto-kick severe violationsDrops players triggering malformed or exploit-looking requests
Distance validationRejects opens and drops from too far away
Log hook rejectionsPrints registered hook rejections to the console
Trim vehicle platesNormalises plates before resolving trunk and glovebox ids
Log level0 disables transfer logs; higher levels add detail
Evidence gradeMinimum police grade for evidence lockers
Event retentionRecent security events kept in memory
Allowed remote image hostsHosts accepted for metadata image URLs

Clothing

SettingWhat it does
Enable clothing inventoryPlayers undress into items and wear items from the inventory
Image resourceResource exporting getClothingImage (illenium-appearance / Koja Appearance). Empty = generic icons only
Generic slot icons fallbackItems without metadata.imageurl fall back to web/images/clothing_<slot>.png or an icon
Hidden slotsSlots tracked as worn but not shown in Your clothes

Shops

Create Shop / Edit Shop

SectionFields
Basic propertiesShop type key (used with exports.ox_inventory:openInventory('shop', { type = key })), display name, label
Payment methodsCash (inventory money) and / or Card (bank account)
AccessOptional job / group restriction with a minimum grade
ProductsItem, price, currency (money or any item), stock count (empty = unlimited, shared by every player), licence, minimum grade, metadata (JSON)
LocationsWorld points (markers / 3D prompt). Use my position fills your coords
Built-in interactionFloating key prompt at every point: on / off, distance, key, optional label
Target zonesox_target box zones and the interaction icon
Map blipSprite, colour, scale

Changes apply live. Shops from data/shops.lua are overridden by the saved definition; deleting one restores the file version after a restart.

Stashes

Create Stash / Edit Stash

FieldWhat it does
Stash idUnique, cannot be changed later
Display label, Slots, Max weightAs in RegisterStash
OwnershipShared, one copy per player, or a fixed owner identifier
Access groupsJobs / groups with a minimum grade
World locationOptional point; Built-in interaction shows a floating key prompt there

Stashes are registered live with exports.ox_inventory:RegisterStash. Players who have the stash open keep their view until they reopen it. Deleting a stash keeps its items in the database.

Permissions

Roles have a checkbox per section: View Home, Manage Addons, Items, Rarities, Players, History, Security, Clothing, Shops, Stashes, Permissions and Locales (plus Attachments for weapon marker offsets). Grant all / Revoke all set every box.

The default roles (owner, admin, moderator, support) come from data/koja/admin.lua on first start.

Staff lists identifiers with a role. Add one with an identifier (license:..., discord:..., fivem:...) or the server id of an online player. The ace group.admin always has full access.

Locales

Edit every string of the inventory and the admin panel live, per language.

  • Search keys or text, show Only changed, Reset to default per key.
  • Add language starts as a copy of the defaults; save to create it.
  • Import JSON / Export JSON with a flat { "key": "text" } object.
  • Saved strings are pushed to all players at once and stored in koja_inv_locales.

See Translations.