Check whether a player is working as a gardener, read their level, and run your own code when a job is paid. Everything here is server side. Cuxial Gardener has no client exports and no public events.
Server exports
IsInCrew
Tells whether a player is in a gardener crew. A crew exists from the moment the player opens the job panel, so this does not mean a job is in progress.
exports.cuxial_gardener:IsInCrew(source)| Parameter | Type | Description |
|---|---|---|
source | number | Server id of the player. |
Returns: boolean.
if exports.cuxial_gardener:IsInCrew(source) then
-- the player is at the gardener job
endGetProfile
Returns the gardener level and XP of a character. Works with offline characters too.
exports.cuxial_gardener:GetProfile(identifier)| Parameter | Type | Description |
|---|---|---|
identifier | string | Character identifier of your framework (the citizenid on QBox and QBCore). |
Returns: { level: number, xp: number }, or nil when the character has no gardener profile or the database is not ready.
local profile = exports.cuxial_gardener:GetProfile(citizenid)
if profile and profile.level >= 10 then
-- unlock something for experienced gardeners
endHook: onFinish
server/hooks.lua is an open file. Its onFinish function runs once for each connected crew member when a job is paid. Write your code inside it: add reputation, give an extra reward, send your own log.
function CuxialGardener.hooks.onFinish(src, data)
-- your code
end| Parameter | Type | Description |
|---|---|---|
src | number | Server id of the player who was paid. |
data.runId | number | Id of the job in cuxial_jobs_runs. 0 if it could not be saved. |
data.region | number | Region id from data/regions.lua. |
data.score | number | Tasks done by this player (mowing, pruning, branches, flowers). |
data.bonus | number | Bonus tasks done by this player (watering, loading branches). |
data.money | number | Money paid to this player. |
data.xp | number | XP given to this player. |
data.owner | string | Character identifier of the crew owner. |
function CuxialGardener.hooks.onFinish(src, data)
if data.region == 5 and data.score >= 20 then
exports.ox_inventory:AddItem(src, 'water', 1)
end
endAn error inside the hook is caught and printed to the server console. The payment is not affected.
Database
Read-only queries are safe on these tables. Rows of this job have job = 'gardener'.
| Table | Content |
|---|---|
cuxial_jobs_players | One row per character: level, xp, daily progress. |
cuxial_jobs_runs | Finished jobs: region, owner, crew_size, outcome (done, reset, abandoned), start and end time. |
cuxial_jobs_run_members | What each member did and earned in a job: score, bonus, money, xp. |
cuxial_jobs_audit | Audit rows: job finished, job reset, staff actions. |
