Documentation › Hunting System › Integrations › Hooks & Events

Hooks & Events

React to hunting events from your own code.

Every important moment fires a server event and calls a function in bridge/server/hooks.lua. Use whichever you prefer.

lua
AddEventHandler('smilescripts_hunting:harvested', function(src, data)
    print(('%s skinned a %s of %.1f kg'):format(GetPlayerName(src), data.model, data.weight or 0))
end)
lua
function Hooks.OnHarvest(src, data)
    exports['my-battlepass']:AddProgress(src, 'hunting', 1)
end

Events

Event Hook Data
smilescripts_hunting:harvested OnHarvest model, quality, headshot, weight, weightClass, loot, xp, coords
smilescripts_hunting:sold OnSale item, amount, price, market, account
smilescripts_hunting:purchased OnPurchase item, amount, price
smilescripts_hunting:poaching OnPoaching model, reason, coords, reported
smilescripts_hunting:legendReleased OnLegendReleased id, label, model, zone (no player)
smilescripts_hunting:legendHunted OnLegendHunted id, label, model, weight, money, xp
smilescripts_hunting:record OnRecord model, weight, previous, scope
smilescripts_hunting:contractClaimed OnContractClaimed id, period, reward
smilescripts_hunting:levelUp OnLevelUp level, previous
smilescripts_hunting:licenseGiven OnLicenseGiven expiresAt, provider, by
smilescripts_hunting:licenseRevoked OnLicenseRevoked provider, by

Blocking actions

Return false from a gate to stop the action:

lua
function Hooks.CanSell(src, item, market)
    -- e.g. no black market sales during a server event
    if market == 'illegal' and GlobalState.cityLockdown then return false end
    return true
end
Gate Arguments
Hooks.CanHarvest src, model
Hooks.CanSell src, item, market
Hooks.CanBuy src, item, amount