lation scripts
scriptsmembershipdocs
see the scripts
Skip to Content
lation ui
lation interact
lation banking
lation shops
lation jobs
lation weed
lation chop shop

classics

money laundering
drug sales
coke processing
Making cokeConfigurationDevelopersChangelog
meth crafting
metal detecting
scuba diving
coke processing

Developers

The coke processing client and server exports, the notify event, the hooks in its open files, custom cooking steps and the shapes of its player, plant, table and lab data.

Exports, events and hooks for connecting coke processing to other resources. Every export is called on exports.lation_coke. A player is their server id (source), and a lab is its number in labs in config/shared.lua, which is also the routing bucket players are in while inside it.

Client exports

ExportReturns
getPlayerData(type?)This player's data, or one field of it. See player data.
getLevelData()The experience table: the XP each level needs
getPlantData(plantId)A plant, or nil
getTableData(tableId)A table, or nil
getLabData(labId)An owned lab, or nil
getAllLabs()Every owned lab, keyed by lab id
isLabAvailable(labId)true when nobody owns the lab
isOwner(labId)true when this player owns the lab
isAuthUser(labId)true when this player is one of the lab's authorized users
getUserPermissions(labId)This player's permissions in the lab, or false
isInsideLab()Whether this player is inside a lab, and which
openLabShop()Opens Lab Availability

Every client export except getLevelData and isInsideLab waits for the server, so call it where code can wait, such as an event handler or a CreateThread.

isInsideLab

Client export

local inside, labId = exports.lation_coke:isInsideLab()

Returns

boolean, number
true and the lab id while inside a lab; false and 0 otherwise
client.lua
local inside, labId = exports.lation_coke:isInsideLab()
if inside then
    print(('in lab %d'):format(labId))
end

openLabShop

Client export

exports.lation_coke:openLabShop()

Opens Lab Availability for this player, as the lab dealer does: every unowned lab their level allows. It refuses a player below dealer.level. Use it to sell labs from your own ped, phone or laptop, with dealer.enable off.

Server exports

ExportReturns
getPlayerData(source, type?)A player's data, or one field of it
addPlayerData(source, dataType, amount)Nothing
getLevelData()The experience table
getPlantData(plantId)A plant, or nil
getTableData(tableId)A table, or nil
getLabData(source, labId)An owned lab, or nil
getAllLabs()Every owned lab, keyed by lab id
isLabAvailable(_, labId)true when nobody owns the lab
isOwner(source, labId)true when the player owns the lab
isAuthUser(source, labId)true when the player is an authorized user
getUserPermissions(source, labId)The player's permissions in the lab, or false
buyLab(source, labId)Nothing

The tables these hand out are the script's own, not copies: read them, don't change them.

getPlayerData

Server export

exports.lation_coke:getPlayerData(source, type)

Parameters

sourcenumber
The server id of an online player
typestringoptionaldefault nil
One field, such as level, exp, leaves, grown, cement or bricks; the whole record when left out

Returns

table | any
The player's data, or that one field. nil when the player has no character loaded.

A player with no record yet gets one, with their own gasoline and cement windows. The client export takes only type.

server.lua
local level = exports.lation_coke:getPlayerData(source, 'level')
if level and level >= 3 then
    -- let them into your own coke heist
end

addPlayerData

Server export

exports.lation_coke:addPlayerData(source, dataType, amount)

Parameters

sourcenumber
The server id of an online player
dataTypestring
exp, or a stat: leaves, grown, cement or bricks
amountnumber
How much to add. Must be more than 0.

Adds to a player's XP or a lifetime stat. XP raises the level as it crosses each threshold, up to the top level; nothing takes XP or levels away. The change is saved when the player leaves or the resource stops.

server.lua
-- 250 XP for finishing a coke delivery in your own script
exports.lation_coke:addPlayerData(source, 'exp', 250)

getLabData

Server export

exports.lation_coke:getLabData(source, labId)

Parameters

sourcenumber | nil
Not used, but taken first: pass nil or a player
labIdnumber
The lab's id

Returns

table | nil
The lab, or nil when nobody owns it

isLabAvailable

Server export

exports.lation_coke:isLabAvailable(nil, labId)

Parameters

_any
Not used, but taken first
labIdnumber
The lab's id

Returns

boolean
true when nobody owns the lab

buyLab

Server export

exports.lation_coke:buyLab(source, labId)

Parameters

sourcenumber
The server id of an online player
labIdnumber
The lab's id

Buys a lab for a player as the lab dealer does: it checks their level, their balance in settings.accounts.purchase, the lab limit and the CanBuyLab hook, charges the lab's price, and tells every player the lab is owned. A purchase refused for the level, the money or the limit tells the player why. Check isLabAvailable first: the export doesn't, and buying a lab someone owns fails on the database.

server.lua
if exports.lation_coke:isLabAvailable(nil, 3) then
    exports.lation_coke:buyLab(source, 3)
end

Events

lation_coke:notify

Client event

TriggerClientEvent('lation_coke:notify', source, message, type)

Parameters

messagestring
The text
typestring
success, error, info or warning, as your notification system takes them

Shows a notification through the system set in setup.notify. The script sends its own messages this way, and any server script can too.

Hooks

Hooks are plain functions in the two open functions.lua files. Edit them in place.

Server hooks

In server/functions.lua.

HookCalledBy default
CanPlacePlant(source)When a player uses a seed. Return false to refuse.Checks the pot, the plant limit, the blocked and allowed areas and the police count, and tells the player why it refuses
CanPlaceTable(source)When a player uses the table item. Return false to refuse.Checks the table limit, the restricted areas and the police count
CanBuyLab(source, labId)Before a lab is bought, after the level, money and limit checks. Return false to refuse.true
CocaPlantSearched(source, farmId, plantId)After a wild plant pays outNothing
CementCollected(source, zoneId, cementId)After a player takes cementNothing
CocaSeedPlanted(source, plantId)After a plant goes downNothing
CocaPlantWatered(source, plantId)After a plant is wateredNothing
CocaPlantFertilized(source, plantId)After a plant is fertilizedNothing
CocaPlantHarvested(source, plantId)After a harvest pays out, before the plant is removedNothing
CokeTablePlaced(source, tableId)After a table goes downNothing
CompletedCook(source, cookType, data)When a brick is taken from a table or a lab stationNothing

plantId is a key in the global Plants, and tableId in Tables. farmId and zoneId are positions in farms and cement.zones.

CompletedCook

Server hook

function CompletedCook(source, cookType, data) end

Parameters

sourcenumber
The player who took the brick
cookTypestring
table or lab
data.itemstring
The brick, such as ls_cocaine_brick or ls_crack_brick
data.quantitynumber
How many
data.puritynumber
Its purity, 1 to 100
data.tableIdnumberoptional
The table, when cookType is table
data.labIdnumberoptional
The lab, when cookType is lab
server/functions.lua
function CompletedCook(source, cookType, data)
    if data.purity == 100 then
        TriggerClientEvent('lation_coke:notify', source, 'A perfect batch.', 'success')
    end
end

Client hooks

In client/functions.lua. They run on the player's client.

HookCalledBy default
CanSearchCoca(farmId)Before a wild plant is searched. Return false to refuse.Checks the farm's required items and level
CanUseCokeTable(tableId)Before a table's menu opensChecks table.police.use
CanTakeCement(zoneId)Before cement is takentrue
CanEnterLab(labId)Before a player goes into a labtrue
CanOpenSupplyShop()Before Rusty's Shop openstrue
StartedPlacement(), StoppedPlacement()When placing a plant starts and endsLocks and unlocks the inventory

Custom steps

Each step in cooking.table and cooking.lab runs the event in its event. Point a step at your own event to add a step of your own:

config/shared.lua
[8] = {
    title = 'Press Brick',
    description = 'Press a brick for a buyer',
    icon = 'fas fa-compress',
    iconColor = '',
    event = { name = 'my_script:pressBrick', server = true }
},
WhereArguments
A table stepstepId, tableId
A lab steplabId, stationId, stepId

Without server = true, the event is triggered on the client. Your handler does the whole step: checks, progress bar and items. Steps are read in order, so number a new one after the last.

server.lua
RegisterNetEvent('my_script:pressBrick', function(stepId, tableId)
    local data = exports.lation_coke:getTableData(tableId)
    if not data then return end
    -- your step
end)

Data

Player data

{
    identifier = 'ABC12345',              -- the character's framework identifier
    level = 2,
    exp = 7600,
    gas_inputs = '{"min":37,"max":41}',   -- JSON: this player's gasoline window
    cement_inputs = '{"min":62,"max":66}', -- JSON: this player's cement window
    inside = 0,                           -- the lab they are in, or 0
    leaves = 340,                         -- lifetime stats
    grown = 6,
    cement = 18,
    bricks = 4,
}

Plant data

{
    id = 1234567890,
    x = 2101.5, y = 4830.2, z = 41.3,
    thirst = 78.4,      -- water, 0 to 100
    hunger = 81.9,      -- fertilizer, 0 to 100
    yield = 100,
    growth = 62.7,
    stage = 2,          -- 1 to 3
    bucket = 0,         -- the routing bucket it was planted in
    owner = 'ABC12345', -- the planter's identifier
}

Table data

{
    id = 987654321,
    x = 1501.2, y = 3601.8, z = 34.4, heading = 90.0,
    stage = 4,          -- the timed step on it, 0 when empty
    duration = 23,      -- minutes left
    purity = 87,        -- purity of the batch on it
    bucket = 0,
    owner = 'ABC12345',
}

Lab data

{
    id = 3,
    owner = 'ABC12345',
    style = 'upgrade',        -- equipment: 'basic' or 'upgrade'
    security = 'upgrade',     -- 'basic' or 'upgrade'
    locked = 'locked',        -- 'locked' or 'unlocked'
    passcode = '4821',        -- or nil
    upgrade = nil,            -- { type = 'style' | 'security', duration = ms left } while one runs
    users = {                 -- authorized users
        { identifier = 'DEF67890', name = 'Jane Doe', permissions = { true, false, false } },
    },                        -- permissions: lock/unlock door, view camera, manage users
    stations = {              -- by station number
        [1] = { stage = 4, duration = 12, purity = 92 },
    },
    last_activity = 1762886400, -- os.time() of the last use
}

Open files

These ship unescrowed:

FileHolds
config/*.luaEvery option. See configuration.
locales/*.jsonEvery string players see
bridge/client.lua, bridge/server.luaFramework and inventory calls: players, jobs, money, items and usable items. Add another framework or inventory here.
client/functions.luaThe client hooks, the notification, text UI, progress bar, menu, dialog and skill check calls, the target calls, stash opening and the dispatch calls
server/functions.luaThe server hooks, item metadata, stashes, consumables, logging and /resetbucket

On ox_inventory, server/functions.lua also merges the durability of stacked watering cans, fertilizer, gasoline and cement. The gasoline and cement names are written in its itemFilter, so rename them there too if you change those items.

Still stuck? Ask in our Discord: the people who write the scripts answer.

Last updated November 11, 2026

Configuration

Every coke processing option in config/shared.lua, config/client.lua, config/server.lua and config/icons.lua with its default, plus the text UI and language files.

Changelog

Every coke processing release, newest first, with what it added, changed and fixed.

On this page

Client exportsisInsideLabopenLabShopServer exportsgetPlayerDataaddPlayerDatagetLabDataisLabAvailablebuyLabEventslation_coke:notifyHooksServer hooksCompletedCookClient hooksCustom stepsDataPlayer dataPlant dataTable dataLab dataOpen files
lation scripts

FiveM scripts for Qbox, QBCore and ESX servers, made to look and work like one product.

store

  • all scripts
  • membership
  • classics

help

  • docs
  • discord
  • email support

legal

  • terms
  • refunds
  • privacy
© 2026 Lation Labslationscripts.com
  • home
  • scripts
  • membership
  • docs