Studios
Fishing Jobhouse-3.jpg

Examples

SoonFishing JobQbox
PAGE 04 OF 06  ·  CONFIGURATION → EXAMPLES → TROUBLESHOOTINGdocs.glitchstudios.dev
Browse docs

Marked waters only#

The server checks wild casts against the player's own position, but it cannot read water heights. A modified client could claim lake or river water on dry land. If that matters on your server, keep hobby anglers on the marked waters:

-- config/locations.lua
Config.WildWater.enabled = false

To keep the coast open and close inland wild water only:

Config.WildWater.types = { shore = true, offshore = true, lake = false, river = false }

A hidden snap chance#

The server checks the token, the fight length and the position, but it cannot see the minigame itself. serverMiss makes a client that always reports a win still lose some fish:

-- config/main.lua
Config.Landing.serverMiss = { common = 0, uncommon = 0, rare = 0.03, legendary = 0.05 }

Config.Landing.suspectStreak (60) writes a job log entry when a player lands that many fish in a row. It only logs.

Trophy quotas on another time zone#

Config.QuotaDay = { serverClock = false, utcOffset = 1, dst = 'eu' }

A lake order#

The package has no lake order. Copy a template in config/contracts.lua:

{
    id = 'lake_order', label = 'Lake order', waters = { 'lake' },
    desc = 'Perch and catfish for the market.',
    species = { 'perch', 'catfish' }, minFresh = 70,
    mode = 'company', vehicle = 'van', loanRods = true,
    unitsPerWorker = 10, plannedMinutes = 12, minLevel = 1,
},

An order is sent to a marked water of that type, so add a lake water to Config.Locations.waters too, or with /fishingadmin.

Selling licences from another resource#

-- server
local cid = exports.qbx_core:GetPlayer(source).PlayerData.citizenid

if not exports['glitch-fishingJob']:HasLicence(cid, 'boat') then
    exports['glitch-fishingJob']:SetLicence(cid, 'boat', true)
end

kind is 'fishing' or 'boat'. SetLicence returns false for an unknown kind.

Reacting to orders#

-- server
AddEventHandler('glitch-fishingJob:server:orderStarted', function(src, contractId)
    print(('player %d started fishing order %s'):format(src, contractId))
end)

AddEventHandler('glitch-fishingJob:server:orderClosed', function(src, contractId, status)
    if status == 'done' then
        -- quest step, achievement, ...
    end
end)

status is 'done' or 'cancelled'. The events fire once per crew member who is online.

Blocking something while a player fishes#

-- client
if exports['glitch-fishingJob']:IsFishing() then
    return lib.notify({ type = 'error', description = 'Put the rod away first' })
end