API Reference

Server exports provided by oxide-weed for integrations.

Server exports currently provided by oxide-weed.

Any server resource can call these through standard FiveM exports as long as oxide-weed is started first.

Export List

GetPlayerLevel(source)

Returns the player's weed progression level.

local level = exports['oxide-weed']:GetPlayerLevel(source)

Returns 1 if the player has no progression row yet.

GetPlayerProgression(source)

Returns the player's weed progression stats table.

local progression = exports['oxide-weed']:GetPlayerProgression(source)

Current documented shape:

{
    level = 1,
    xp = 0,
    currentLevelXp = 0,
    nextLevelXp = 100,
    totalCreated = 0,
    totalSold = 0,
    unlocks = {},
}

Returns nil if the player has no valid character identifier.

AddXP(source, amount)

Adds weed XP and runs the level-up check.

local ok = exports['oxide-weed']:AddXP(source, 25)

Returns true on success and false if the player is invalid or the amount is not positive.

AddSold(source, amount)

Adds sold-count progress for weed.

local ok = exports['oxide-weed']:AddSold(source, 3)

Returns true on success and false if the player is invalid or the amount is not positive.

GetPlantCount(source)

Returns how many active plants belong to the player.

local count = exports['oxide-weed']:GetPlantCount(source)

GetAllPlants()

Returns the current active plant table.

local plants = exports['oxide-weed']:GetAllPlants()

Each returned entry includes the current public fields:

{
    type = 'cannabis_seed',
    strain = 'og_kush',
    strain_name = 'OG Kush',
    coords = vector3(0.0, 0.0, 0.0),
    water = 50,
    fertilizer = 50,
    lastStage = 1,
    quality = 50,
    gender = 'female',
    generation = 1,
    placedBy = 'char:123',
    bucket = 0,
}

GetPlantData(plantId)

Returns detailed data for a specific plant.

local plant = exports['oxide-weed']:GetPlantData(plantId)

Current documented fields:

{
    type = 'cannabis_seed',
    strain = 'og_kush',
    strain_name = 'OG Kush',
    coords = vector3(0.0, 0.0, 0.0),
    water = 50,
    fertilizer = 50,
    currentStage = 2,
    totalStages = 4,
    quality = 62,
    gender = 'female',
    generation = 1,
    traits = {},
    placedBy = 'char:123',
    bucket = 0,
}

Returns nil if the plant does not exist or the id is invalid.

GetStrainData(strainHash)

Returns a registered strain from the genetics registry.

local strain = exports['oxide-weed']:GetStrainData(strainHash)

This is intended for integrations that need current strain metadata for pricing, effects, or sale logic.

IsPlayerSmoking(source)

Returns whether the player is currently in the active smoking state tracked by the resource.

local smoking = exports['oxide-weed']:IsPlayerSmoking(source)