Exports

Client

GetPlayerData() - Get all or some of player's data

local data = exports.lation_meth:GetPlayerData()
print(data.level) -- Level
print(data.exp) -- Experience
print(data.total_produced) -- Total meth produced
print(data.total_supply_runs) -- Total supply runs completed
print(data.inside) -- The warehouse ID player was in when last disconnected
print(data.ammonia) -- Players specific "perfect" ammonia input (if unique = true)
print(data.iodine) -- Players specific "perfect" iodine input (if unique = true)
print(data.acetone) -- Players specific "perfect" acetone input (if unique = true)

-- If only looking for a specific data type, can also be used like so:
local playerLevel = exports.lation_meth:GetData('level')
print('Player is currently level: ' ..playerLevel)

GetTableData(tableId) - Get a specific table's data

local data = exports.lation_meth:GetTableData(tableId)
print(data.id) -- number: Table ID
print(data.x) -- number: Table X coordinate
print(data.y) -- number: Table Y coordinate
print(data.z) -- number: Table Z coordinate
print(data.heading) -- number: Table heading
print(data.stage) -- number: Table's current cooking stage
print(data.heating) -- boolean: If table is in the heating stage
print(data.cooling) -- boolean: If table is in the cooling stage
print(data.remaining) -- number: Time in ms remaining for current stage
print(data.purity) -- number: The current purity level of meth being produced
print(data.bucket) -- number: The routing bucket the table exists in
print(data.owner) -- string: The owner of this table's identifier

GetWarehouseData(warehouseId) - Get a specific warehouse's data

local data = exports.lation_meth:GetTableData(tableId)
print(data.owner) -- string: The owner of this warehouse identifier
print(data.id) -- number: The warehouse ID
print(data.style) -- string: The interior "style" of the warehouse
print(data.security) -- string: The interior "security" of the warehouse
print(data.pin) -- number|nil: The stash PIN if one exists
print(data.locked) -- string: The doorlock status ('locked' or 'unlocked')
print(data.remaining) -- number: Time in ms remaining until upgrade completes
print(data.upgrade) -- string: The upgrade type to be applied when remaining ends
print(data.ammonia) -- number: The current ammonia level available
print(data.iodine) -- number: The current iodine level available
print(data.acetone) -- number: The current acetone level available
print(data.stage) -- number: The current cooking stage
print(data.purity) -- number: The purity of meth being produced if in progress
print(data.duration) -- number: Time in ms remaining until current stage ends
print(data.efficiency) -- number: Player who started the production's efficiency percentage
print(data.inputs) -- table: Table containing players panel inputs (data.inputs.ammonia, etc)
print(data.users) -- table: Table containing authorized users to this warehouse (contains name & identifier of each authorized user)

IsWarehouseOwner(warehouseId) - Returns boolean if player is the warehouse owner

local isOwner = exports.lation_meth:IsWarehouseOwner(warehouseId)
if isOwner then
    print('This player IS the owner of the warehouse!')
else
    print('This player is NOT the owner of the warehouse.')
end

IsInsideWarehouse() - Returns two parameters: first a boolean (true if player is inside a warehouse, false if not) and second a number (returns the warehouse ID they are currently in)

local isInside, warehouseId = exports.lation_meth:IsInsideWarehouse()
if isInside then
    print('This player IS inside a warehouse, the warehouseId is: ' ..warehouseId)
else
    print('This player is NOT inside any warehouse right now.')
end

WarehouseShop() - Opens the warehouse shop menu showing available warehouses for sale

exports.lation_meth:WarehouseShop()

IsViewingCamera() - Returns boolean if player is currently viewing security camera

local viewingCamera = exports.lation_meth:IsViewingCamera()
if viewingCamera then
    print('The player is currently looking at their security camera')
else
    print('The player is NOT currently looking at their security camera')
end

Server

GetPlayerData(source) - Get all or some of player's data

-- source: Player ID
-- type: optional: Data type
local data = exports.lation_meth:GetPlayerData(source)
print(data.level) -- Level
print(data.exp) -- Experience
print(data.total_produced) -- Total meth produced
print(data.total_supply_runs) -- Total supply runs completed
print(data.inside) -- The warehouse ID player was in when last disconnected
print(data.ammonia) -- Players specific "perfect" ammonia input (if unique = true)
print(data.iodine) -- Players specific "perfect" iodine input (if unique = true)
print(data.acetone) -- Players specific "perfect" acetone input (if unique = true)

-- If only looking for a specific data type, can also be used like so:
local playerLevel = exports.lation_meth:GetData(source, 'level')
print('Player is currently level: ' ..playerLevel)

GetTableData(tableId) - Get a specific table's data

local data = exports.lation_meth:GetTableData(tableId)
print(data.id) -- number: Table ID
print(data.x) -- number: Table X coordinate
print(data.y) -- number: Table Y coordinate
print(data.z) -- number: Table Z coordinate
print(data.heading) -- number: Table heading
print(data.stage) -- number: Table's current cooking stage
print(data.heating) -- boolean: If table is in the heating stage
print(data.cooling) -- boolean: If table is in the cooling stage
print(data.remaining) -- number: Time in ms remaining for current stage
print(data.purity) -- number: The current purity level of meth being produced
print(data.bucket) -- number: The routing bucket the table exists in
print(data.owner) -- string: The owner of this table's identifier

GetWarehouseData(warehouseId) - Get a specific warehouse's data

local data = exports.lation_meth:GetTableData(tableId)
print(data.owner) -- string: The owner of this warehouse identifier
print(data.id) -- number: The warehouse ID
print(data.style) -- string: The interior "style" of the warehouse
print(data.security) -- string: The interior "security" of the warehouse
print(data.pin) -- number|nil: The stash PIN if one exists
print(data.locked) -- string: The doorlock status ('locked' or 'unlocked')
print(data.remaining) -- number: Time in ms remaining until upgrade completes
print(data.upgrade) -- string: The upgrade type to be applied when remaining ends
print(data.ammonia) -- number: The current ammonia level available
print(data.iodine) -- number: The current iodine level available
print(data.acetone) -- number: The current acetone level available
print(data.stage) -- number: The current cooking stage
print(data.purity) -- number: The purity of meth being produced if in progress
print(data.duration) -- number: Time in ms remaining until current stage ends
print(data.efficiency) -- number: Player who started the production's efficiency percentage
print(data.inputs) -- table: Table containing players panel inputs (data.inputs.ammonia, etc)
print(data.users) -- table: Table containing authorized users to this warehouse (contains name & identifier of each authorized user)

GetPlayerWarehouses(source) - Returns table containing all warehouses owned by player & each warehouses data

local warehouses = exports.lation_meth:GetPlayerWarehouses(source)
print('All warehouses owned by player: ' ..json.encode(warehouses, {indent = true})

GetPlayersInWarehouse(warehouseId) - Returns table containing all players currently inside a specific warehouse

local players = exports.lation_meth:GetPlayersInWarehouse(warehouseId)
print('All players currently in warehouse: ' ..json.encode(players, {indent = true})

IsWarehouseOwner(source, warehouseId) - Returns boolean if player is the warehouse owner

local isOwner = exports.lation_meth:IsWarehouseOwner(source, warehouseId)
if isOwner then
    print('This player IS the owner of the warehouse!')
else
    print('This player is NOT the owner of the warehouse.')
end

IsWarehouseAvailable(warehouseId) - Returns boolean if warehouse is currently for sale or not

local isForSale = exports.lation_meth:IsWarehouseAvailable(warehouseId)
if isForSale then
    print('This warehouse is currently available for sale and not owned by anyone')
else
    print('This warehouse has an owner and is NOT available for sale')
end

IsUpgradeActive(warehouseId) - Returns boolean if warehouse is currently being upgraded

local isUpgradeActive = exports.lation_meth:IsUpgradeActive(warehouseId)
if isUpgradeActive then
    print('This warehouse is currently being upgraded!')
else
    print('This warehouse is NOT being upgraded right now')
end

AddPlayerData(source, type, amount) - Add new data to player

-- source: Player ID
-- type: Data type to add ('level', 'exp', 'total_produced', 'total_supply_runs')
-- amount: Amount (number) to add
exports.lation_meth:AddPlayerData(source, 'exp', 100)
-- Adds 100XP to players experience

Last updated