For the complete documentation index, see llms.txt. This page is also available as Markdown.

Custom Inventory

This guide is for developers who want to use an inventory system that is not natively supported by GKS Tablet (currently ox_inventory is built-in). You need basic Lua knowledge to complete these steps

Overview

GKS Tablet uses an adapter pattern for inventory integration. Adapter files live in:

Side
Path

Server

gks-tablet/server/inventory/

Client

gks-tablet/client/inventory/

These folders are editable in escrow. Files are loaded automatically via fxmanifest.lua (client/inventory/*.lua, server/inventory/*.lua).

When Config.TabletItemRequire = true, the tablet verifies the player owns the configured item before opening. When false, anyone can open the tablet via command/keybind (item use is optional).

1. Configuration

Open gks-tablet/config/config.lua and set your inventory adapter name:

Config.InventoryScript = "custom"   -- must match your adapter file guard
Config.TabletItemRequire = true     -- require tablet item to open
Config.TabletItemName = "tablet"    -- item name in your inventory

InventoryScript options

Value
Behavior

"auto"

Uses ox_inventory if started, otherwise "none"

"ox_inventory"

Built-in ox_inventory adapter (no custom files needed)

"none"

No item check adapter β€” blocks open when TabletItemRequire is true

"custom"

Your adapter in server/inventory/custom.lua + client/inventory/custom.lua

"my-inventory"

Any string β€” guard your files with if Config.InventoryScript ~= "my-inventory" then return end

MDT case evidence stash (optional)

If your inventory supports stashes, configure case evidence storage:

Without RegisterStash / OpenStash, MDT case evidence stash returns "not supported" β€” the rest of the tablet still works.


2. Server-Side Integration

Create gks-tablet/server/inventory/custom.lua:

Required function: HasTabletItem

Called when a player requests to open the tablet (gkstablet:server:requestOpenTablet).

Optional functions: RegisterStash / OpenStash

Required only for MDT case evidence stash (gkstablet:server:mdt:openCaseStash).

Register usable item (framework fallback)

If your inventory does not use a client-side UseTabletItem export, register the item as usable via ESX/QBCore. This is handled automatically by server/inventory/framework_usable.lua when:

  • Config.TabletItemRequire = true

  • Config.Framework is esx, qb, or qbx

For fully custom frameworks, register item use yourself:


3. Client-Side Integration

Create gks-tablet/client/inventory/custom.lua:

Required function: HasTabletItem

Used by CanOpenTablet() for local item checks (command/keybind path).

If your inventory calls a client export on item use (like ox_inventory):

Register in your inventory item definition:

UseTabletItem toggles the tablet UI via internal event gkstablet:client:useTabletItem.

Handle item removal

If the tablet item is removed while the UI is open, close the tablet:

ItemTabletDeleted() is defined in client/tablet.lua β€” do not redefine it.

Handle stash open (optional)

If you implemented server OpenStash, handle the client event:


4. Full Reference Example

Based on the built-in ox_inventory adapter.

Server (server/inventory/custom.lua)

Client (client/inventory/custom.lua)


Last updated