API Reference
Server exports provided by oxide-meth for integrations.
Server exports provided by oxide-meth, for developers integrating other resources (selling scripts, missions, leaderboards).
Any server resource can call these after oxide-meth has started.
Export List
GetPlayerLevel(source)
Returns the player's meth progression level (1–10 with the default level table).
local level = exports['oxide-meth']:GetPlayerLevel(source)Returns 1 if the player has no character loaded or no meth progression row yet.
GetPlayerProgression(source)
Returns the player's full meth progression stats table.
local progression = exports['oxide-meth']:GetPlayerProgression(source)Shape:
{
level = 1,
xp = 0,
currentLevelXp = 0, -- XP threshold of the current level
nextLevelXp = 100, -- XP threshold of the next level; nil at max level
totalCreated = 0,
totalSold = 0,
purityPenalty = -30,
unlocks = { -- additive unlock groups, ordered by level
{
level = 1,
label = 'Cannabis Leaf, Cough Syrup, Lax to the Max, Pain Killer',
unlocked = true,
},
-- ...
},
}Returns nil if the player's character identifier cannot be resolved (e.g. not fully loaded).
AddXP(source, amount)
Adds meth XP and runs the level-up check.
local ok = exports['oxide-meth']:AddXP(source, 25)Returns true on success, false if the player has no character loaded or amount is missing, non-numeric, or not greater than zero.
AddSold(source, amount)
Adds to the player's total_sold counter for meth. Call this from your selling script so sales show up in /methstats.
local ok = exports['oxide-meth']:AddSold(source, 3)Returns true on success, false if the player has no character loaded or amount is missing, non-numeric, or not greater than zero.
Item Metadata
Finished items carry metadata your scripts can read through your inventory's normal metadata access:
| Item stage | Metadata fields |
|---|---|
liquid_meth_tray, crystallized_meth_tray | variant, variant_name, purity, additives, description |
Shard items (crystal_meth*) | variant, variant_name, purity |
Bag items (meth_baggy*) | variant, variant_name, purity |
Each variant's valueMultiplier in shared/config/additives.lua is intended for pricing in selling scripts.