Shared
Export(s) available for use on the client & server.
GetPlayerData
Retrieves player data. Optionally, you can pass a string to get a specific piece of data.
Syntax
Client
exports.lation_weed:GetPlayerData(key)
key
(optional, string): The specific player data field you want to retrieve (e.g.,"level"
,"exp"
,"plants_grown"
). If omitted, returns a table with all player data.
Server
exports.lation_weed:GetPlayerData(source, key)
source
(required, number): The player’s sourcekey
(optional, string): The specific player data field you want to retrieve (e.g.,"level"
,"exp"
,"plants_grown"
). If omitted, returns a table with all player data.
Returns
- If key is provided; returns the value of the specified data field.
- If key is not provided; returns a table containing all player data fields.
Examples
client.lua
local data = exports.lation_weed:GetPlayerData()
print('All player data: ', json.encode(data, {indent=true}))
local level = exports.lation_weed:GetPlayerData('level')
print('Player\'s level: ', level)
server.lua
local source = 1 -- Replace with player's source
local data = exports.lation_weed:GetPlayerData(source)
print('All player data: ', json.encode(data, {indent=true}))
local level = exports.lation_weed:GetPlayerData(source, 'level')
print('Player\'s level: ', level)
Client
Export(s) available for use on the client only.
OpenShop
Opens “Smoke on the Water” supply shop.
Syntax
Client
exports.lation_weed:OpenShop()
Examples
client.lua
exports.lation_weed:OpenShop()
print('You opened the supply shop!')
Server
Export(s) available for use on the server only.
AddPlayerData
Adds an amount to a player’s specified data field.
Syntax
exports.lation_weed:AddPlayerData(source, dataType, amount)
source
(required, number): The player’s sourcedataType
(required, string): The data field to modify (e.g.,"exp"
,"joints_rolled"
,"plants_grown"
)amount
(required, number): The amount to add to the specified data field
Examples
server.lua
local source = 1 -- Replace with player's source
exports.lation_weed:AddPlayerData(source, 'exp', 100)
print('Added +100 XP to player!')
exports.lation_weed:AddPlayerData(source, 'plants_grown', 1)
print('Added +1 plants grown to player\'s total plants grown!')