Exports & API Reference

This guide covers all available exports for integrating with other scripts.


Server-Side Exports

addHuntingXp

Add hunting XP to a player.

exports["cas-hunting"]:addHuntingXp(source, amount)
Parameter
Type
Description

source

number

Player server ID

amount

number

XP amount to add

Example:

-- Give player 50 hunting XP
exports["cas-hunting"]:addHuntingXp(source, 50)

-- Reward for completing another job
RegisterNetEvent("myScript:jobCompleted", function()
    local src = source
    exports["cas-hunting"]:addHuntingXp(src, 25)
end)

removeHuntingXp

Remove hunting XP from a player.

Parameter
Type
Description

source

number

Player server ID

amount

number

XP amount to remove

Example:

Note: XP cannot go below 0.


addTraceXp

Add tracking/trace XP to a player.

Parameter
Type
Description

source

number

Player server ID

amount

number

Trace XP to add

Example:

Level Calculation:

  • Trace Level = floor(TraceXP / 100)

  • Max Level: 5 (configurable)


Client-Side Exports

PlaceBait

Place bait at the player's current location.

Parameter
Type
Description

baitItemName

string

The inventory item name

Example:

Requirements:

  • Player must be in an active hunting area

  • Player must have the bait item in inventory

Available Bait Items:

Item Name
Description

bait_corn

Herbivore bait

bait_apples

Herbivore bait

bait_salt

Premium herbivore bait

bait_meat

Predator bait

bait_blood

Premium predator bait

bait_legendary

Legendary bait

bait_grain

Bird bait

bait_seeds

Bird bait

bait_exotic

Universal premium bait


Integration Examples

Quest System Integration

Job System Integration

Reputation System Integration

Skill Check Integration

Economy Integration


State Bags

The hunting system uses state bags for cross-script communication:

Client State

Server State


Global Variables (Client)

These variables are available in client-side scripts:


Best Practices

Error Handling

Performance

Validation


Last updated