Everything another resource can use. Nothing here can create money or fish from nothing: exports read state or do a bounded, logged action; hooks can only narrow what the script was already going to do.
lualocal fishing = exports.cc_fishing
| Export | Returns | Notes |
|---|
getLevel(src) | integer | Angler level (0 for an unknown / offline player) |
getXp(src) | integer | Total XP |
getLicenceTier(src) | 0..4 | 0 = no licence |
hasLicence(src) | boolean | |
getCatch(src) | { { item, kg, comp }, ... } | comp = 'cooler' | 'pier' |
isFishing(src) | boolean | A cast is out or the player is soaking |
isSoaking(src) | boolean | 2.0.0 |
getRebates(src) | integer | Rebate credits held. 2.0.0 |
getCoolerTier(src) | integer | 1..#tiers, 0 offline. 2.0.0 |
hasCoolerOut(src) | boolean | The character's cooler stands in the world. 2.0.0 |
getPricePerKg(item) | number | This period's $/kg for a species (0 for an unknown item) |
addXp(src, amount, reason) | boolean | 1..100000 XP; logged with your resource's name. Can level the player up |
grantLicence(src, reason) | ok, code | Free tier-1 licence + card (+ starter cooler). Codes: already, no_player, cannot_carry, failed, busy. For welcome kits / events |
getVersion() | string | |
getApi() | table | Every export with its signature |
getHooks() | table | Every hook with its payload |
registerHook(name, fn) | handle | Same as CC.hooks.register from another resource |
removeHook(id) | boolean | Remove a hook you registered (yours are also removed when your resource stops) |
useItem(event, item, inventory) | — | ox_inventory's server.export target for the rods and the cooler. Not for you to call |
Only resources listed in ServerConfig.Supply.buyers may call these (checked with GetInvokingResource). Use them to sell fish somewhere other than this script's market.
| Export | Returns | Notes |
|---|
supplyCatch(src) | fish[], comp | The fish the buyer may read: the player's placed cooler when it stands within Distances.supplyCooler, else their pier catch |
supplyTake(src, ids) | token | nil | Removes exactly those catch ids (all or nothing, max 500) before you pay |
supplyRestore(src, token) | boolean | Your payment failed: put the fish back (once, within 10 minutes) |
lualocal list = exports.cc_fishing:supplyCatch(src)
local ids = {}
for _, f in ipairs(list or {}) do ids[#ids + 1] = f.id end
local token = exports.cc_fishing:supplyTake(src, ids)
if token and not payPlayer(src, total) then exports.cc_fishing:supplyRestore(src, token) end
| Export | Returns | Notes |
|---|
isFishing() | boolean | A session is open or a line is out |
isSoaking() | boolean | |
openRig() | — | Opens Rig Setup with the same checks as using a rod |
stopFishing() | — | Ends the session / stands up from Soak a Line. Call it when your script cuffs, sedates or teleports the player |
| Event | Arguments |
|---|
cc_fishing:server:catchKept | src, item, grams, dest |
cc_fishing:server:fishSold | src, count, kg, total |
cc_fishing:server:licenceBought | src, tier |
cc_fishing:server:purchased | src, shopId, qty, pay, cost |
cc_fishing:server:levelUp | src, from, to |
cc_fishing:server:securityFlag | src, reason, detail |
| Event | Arguments |
|---|
cc_fishing:client:castStarted | — |
cc_fishing:client:landed | item, label, kg |
cc_fishing:client:kept | dest |
cc_fishing:client:lost | reason |
Register in custom/server.lua with CC.hooks.register(name, fn), or from another resource with exports.cc_fishing:registerHook(name, fn). Handlers run in pcall.
| Hook | Kind | Payload / arguments | Rule |
|---|
beforeCast | cancellable | { source, mode, rig, tier } | return false to refuse; the bait is not taken |
afterCatch | informational | { source, item, grams, dest, mode, xp, rebates } | |
beforePurchase | cancellable | { source, what, price / credits, quantity } | return false to refuse |
purchasePrice | filter | (price, { source, what }) | raise only — a lower value is ignored |
beforeSell | cancellable | { source, count, kg, total } | return false to refuse; the fish stay |
saleTotal | filter | (total, { source, count }) | lower only — a higher value is ignored |
afterSell | informational | { source, count, kg, total } | |
afterLevelUp | informational | { source, from, to, xp } | |
Every inbound event goes through CC.security.event with a typed argument spec, a cooldown, an in-flight lock and a liveness check, and takes indices or ids only: cast:start (five Config.Gear indices), cast:result (ticket, passed), cast:keep / cast:release (ticket), shop:buy (shop index, quantity, pay), shop:sell, office:register / replace / upgrade / cooler (account), market:sell (catch id), market:sellAll, market:move, cooler:place (position, heading — distance-checked), cooler:pickup, soak:start, soak:stop, admin:boost (ACE). Calling them from another resource is unsupported; use the exports above.