Overview
The shared library of every TopX script
4 min read · Updated Dec 3, 2026
One shared library for all TopX scripts. It has the framework, inventory, vehicle table, keys, society money, notifications, target, fuel, window helper, Discord logging and the server helpers that every script needs. A script uses it like ox_lib: there are no exports to call, the library is loaded into the script itself.
Install
- Put the folder in your resources.
ensure TopXBridgeafterox_libandoxmysql, and before the TopX scripts.- Edit
config.lua. Everything that was in the config of each script (framework, inventory, target, notify, keys, fuel, society, admin check) is here now, once for all scripts.
In a script
shared_scripts {
'@ox_lib/init.lua',
'@TopXBridge/init.lua',
'config.lua',
}
Then TopX is a global with these modules (loaded the first time they are used):
| Module | Side | What it has |
|---|---|---|
TopX.framework | server | identifier, playerName, job, gang, setJob, getMoney, removeMoney, addMoney, hasGroup, sourceOf, addSociety, onLoaded |
TopX.inventory | server | items, label, canCarry (with metadata), add, remove, count, search (the metadata of an item), useable (the handler of a usable item) |
TopX.points | client | add(entry, action) and remove(point): a prop, a ped or a zone with a target option and a blip, managed(entity) |
TopX.vehicles | server | the vehicle table of your framework (garages and rental) and catalog |
TopX.keys | server | give, remove |
TopX.log | server | Discord logging, TopX.log('event', 'Title', fields) and TopX.log.player(source) |
TopX.util | both | started (client and server). Server: throttled, fail, cleanText, modelName, money, whole, page, lockedCallback, lockedRun, isAdmin |
TopX.textui | client | show(text) ("[E] Open" or show(text, key)), hide, isOpen, and the key list of the placement tool hint(lines, title) / hideHint. The provider is TextUI in config.lua: builtin, ox_lib, qbx, qb, esx, jg, 2d, gta or custom |
TopX.radial | client | add(id, { label, icon, onSelect }), remove(id), has(id): an entry of the radial menu. The provider is Radial in config.lua: auto, ox_lib, qb-radialmenu or custom |
TopX.interact | client | The same zones and entities as TopX.target, but every option has an interaction: target, radial or textui (the prompt and a key, like [E] Open the garage). One place can use two of them. Interaction and InteractKey are in config.lua |
TopX.placement | client | the gizmo tool that places zones (box, sphere, poly), props, peds and spawn points: start, entry, spawn, hint, hideHint, drawZone, drawSphere, drawBox |
TopX.notify | client | send(kind, text). The default card and the placement hints are shown by the window of TopXBridge itself, in the accent colour of the script that asks |
TopX.target | client | the target adapter (ox_target, qb-target, qtarget or your own) |
TopX.fuel | client | set(vehicle, level) and get(vehicle) |
TopX.placement | client | the gizmo tool that places zones, models and spawn points in the world (used by the admin windows) |
TopX.ui | client | show(view, data), hide(), view() for the window of a script |
The money functions use the Config.ChargeAccount of the script that calls them ('cash', 'bank' or 'both') unless a mode is given.
Windows of the bridge
TopXBridge has its own small window (web/) for what every script needs: the notification card and the control hints of the placement tool. The scripts do not have these in their own windows. To change how they look, edit web/src/styles/bridge.css and run npm install and npm run build in web.
Photo studio
One studio takes the pictures for all scripts (vehicle and prop pictures of the rental, the garages and the battle pass, and the clothes pictures of the appearance menu). It needs screenshot-basic or screencapture started. The place, the size and the quality are in config.lua (Studio). TopX.studio.photo frames the whole vehicle (a bus or a plane too) and TopX.studio.thumb(model, callback) takes a vehicle picture and saves it through the callback of the script with TopX.studio.saveThumb. For clothes: studio.begin, studio.aim, studio.shoot, studio.finish. The green is taken out of the edges of the picture, so nothing is left green.
Client:
local data, err = TopX.studio.photo({ kind = "vehicle", model = "sultan" }) -- kind = "prop" for objects
local data, err = TopX.studio.shoot({ size = 384, key = "soft", pad = 0 }) -- the picture of what the camera shows
TopX.studio.world(true, { hour = 18, screen = { center = c, camera = eye, ground = z, span = 3.5 } }) -- your own green screen
TopX.studio.world(false)
Server: TopX.studio.save("thumbs/sultan.webp", data) writes the file in the folder of the script that calls it. Check that the player is an admin first.
Discord logging
The logic is here, the settings are not. Every script has its own server/webhook_config.lua (a server file, players never download it). The library reads the WebhookConfig table of the script that logs.
Your own framework or scripts
Set Framework, Inventory, VehicleKeys or SocietyScript to 'custom' in config.lua and fill in custom.lua (server) and custom_client.lua (client). Only the parts you use are needed.
No database setup by the scripts
No TopX script creates or changes tables. Import the file in INSTALL/sql of each script once.