Studios
Craftinghouse-3.jpg

Commands & Exports

SoonCraftingQBCore · Qbox · ESX
PAGE 06 OF 07  ·  TROUBLESHOOTING → COMMANDS & EXPORTS → ROBBERY REWARDSdocs.glitchstudios.dev
Browse docs

Commands#

Command Who What
/craftadmin ServerConfig.AdminGroup with ServerConfig.AdminAce Edit recipes and benches, set access and opening hours, manage players' blueprints, items and queues
/blueprints Everyone List the character's learned blueprints. Uses glitch-uiElements, or an ox_lib menu without it.
/craftstyle Everyone Pick a bench look, when Config.WorldUi.allowPlayerChoice is on

The command names come from ServerConfig.AdminCommand, Config.BlueprintsCommand and Config.StyleCommand.

Client exports#

None.

Server exports#

Blueprints#

Export What it does
CreateBlueprint(src, recipeId) Gives a blueprint item. Returns true on success. Alias: GiveBlueprint.
LearnBlueprint(src, recipeId) Learns the recipe straight away, plus any recipes it teaches
KnowsBlueprint(src, recipeId) True if the character has learned it
BlueprintMetadata(recipeId, unlockId) Metadata a blueprint or unlock item needs, for scripts that add the item themselves
CreateUnlock(src, unlockId) Gives an unlock item from ServerConfig.Unlocks
KnownBlueprintValue(src) Count and value of blueprints the player carries for recipes they already know
SellKnownBlueprints(src) Takes those blueprints. The caller pays the player.

Loot#

Export What it does
RollJobLoot(src, jobId) Rolls every reward table for that job, plus the guaranteed blueprints
RollBlueprint(src, jobId) Rolls BlueprintDrops only
RollComponents(src, jobId, quiet) Rolls ComponentDrops only
RollCache(src, jobId, quiet) Rolls CacheDrops only
RollCases(src, jobId, quiet) Rolls CaseDrops only

Recipes and benches#

Export What it does
GetRecipeBook() Every active recipe and the salvage table, read only
CrewBlueprints() Every blueprint recipe, for a crew panel
GetTiers() Config.Tiers
SetExternalBench(id, data) Adds a bench owned by another resource, kept in memory. data is { label, tier, x, y, z, h, model, ui, access }. Pass nil to remove it.
GetBenchPosition(id) Where a bench is now, after any move in the admin panel
GetTabletPlaces() Fixed public benches, for a map
GetTabletContents(benchId, src) What a bench makes, for a map card
BucketChanged(src) Pushes the player's bench list at once after a script moves them to another routing bucket

Staff and character tools#

These trust the caller. Check permissions before you call them.

Export What it does
AdminGetCharacter(cid) Blueprints, queue and recent crafts of a character, online or offline
AdminSetCharacter(cid, change) change is { learn = recipeId or 'all' }, { forget = recipeId or 'all' }, { finishQueue = true } or { removeJob = id }. Returns ok, message.
WipeCharacter(cid) Deletes everything crafting keeps for a character

Item exports#

useBlueprint, useBench and useScratcher are the ox_inventory item exports. install/ox_inventory_items.lua already sets them.

Events#

Event Side What it does
glitch_criminaltablet:reportJobComplete Server, listened to { jobId, participants = { src, ... }, lootRolled = { src, ... }, lootOnSite }. Rolls the rewards once per participant. Players in lootRolled were already rolled with RollJobLoot and are skipped. With lootOnSite = true nothing is rolled. Server-only, so clients cannot fire it.
glitch-crafting:dbReady Server, fired Tables are ready and saved data is loaded. Send SetExternalBench benches again here.
glitch-crafting:bridgeReady Server, fired The framework and inventory are known

Callbacks#

Every bench action is an ox_lib callback named glitch-crafting:*. The server checks the bench, distance, routing bucket, access and opening hours on each call. These callbacks belong to the bench UI and are not a public API, so use the server exports for integrations.