Hunting
Configurables
All config & open sourced files included within this script.
Config Files
--[[
BY RX Scripts © rxscripts.xyz
--]]
--[[
HUNTING ZONES CAN BE FOUND IN config/zones.lua
ANIMALS CAN BE FOUND IN config/animals.lua
CUT WEAPONS CAN BE FOUND IN config/cutweapons.lua
LEVELS CAN BE FOUND IN config/levels.lua
BAITS CAN BE FOUND IN config/usables.lua
MISSIONS CAN BE FOUND IN config/missions.lua
OUTFITS CAN BE FOUND IN config/outfits.lua
TRANSLATIONS CAN BE FOUND IN locales/*.lua
IN HERE YOU CAN FIND THE MORE GENERIC / NOT VERY LONG LISTS CONFIGURATIONS
--]]
Config = {}
Config.SaveInterval = 10 -- Minutes (Set to 'false' to disable saving on interval, only on server shutdown, or important reached levels)
Config.Locale = 'en'
Config.CutType = 'target' -- 'melee' or 'keybind' or 'target'
Config.CutKeyMap = { map = 'keyboard', key = 'r' } -- key to start cut if CutType is 'keybind'
Config.CutCooldown = 0 -- Cooldown of cutting in seconds for when you're using CutType 'keybind'
Config.HuntingLicense = {
enabled = true, -- Set to false to disable the whole hunting license
buyable = true, -- Set to false to disable buying the license, use exports to give the license to a player
price = 1500,
moneyType = 'bank',
restricts = {
cutting = true, -- If true, you need a hunting license to cut animals, if false, you can cut animals without a license
killing = true, -- If true, killing without a license will notify the police and killing will give no benefits
shopNPC = true, -- If true, you need a hunting license to open the shop NPC
sellNPC = true, -- If true, you need a hunting license to open the sell NPC
huntingNPC = true, -- If true, you need a hunting license to open the hunting NPC
},
}
Config.HuntingNPC = { -- NPC to buy hunting license (if enabled) & see routes, level etc..
enabled = true, -- Set to false to disable the hunting NPC
coords = vector3(-1101.1428, 4940.5693, 217.3545),
heading = 246.7530,
model = 's_m_y_ammucity_01',
blip = {
enabled = true,
sprite = 141,
color = 73,
label = 'Hunter',
display = 2,
scale = 0.7,
shortrange = true,
},
}
Config.WeaponBlock = { -- These weapons will be blocked for using on other players (to create specifical hunting weapons)
enabled = true,
weapons = {
'WEAPON_MUSKET',
'WEAPON_DBSHOTGUN',
'WEAPON_MARKSMANPISTOL',
'WEAPON_MARKSMANRIFLE',
},
}
Config.ShopNPC = { -- NPC that opens a shop
enabled = true, -- Set to false to disable the shop npc
route = true, -- If true, the shop NPC will have a route in the hunting npc
label = 'Hunting Shop',
moneyType = 'bank',
model = 's_m_y_ammucity_01',
coords = vector3(-1075.3329, 4898.0054, 213.2714),
heading = 357.4609,
blip = {
enabled = true,
sprite = 141,
color = 73,
display = 2,
scale = 0.7,
shortrange = true,
},
categories = {
['Baits'] = {
{ item = 'boar_meat', amount = 1, price = 2500, label = 'Dead Boar Bait', requiredLevel = 1, mystery = false },
{ item = 'deer_horn', amount = 1, price = 1500, label = 'Deer Horn', requiredLevel = 2, mystery = false },
{ item = 'meat_stand', amount = 1, price = 5000, label = 'Meat Stand Bait', requiredLevel = 2, mystery = false },
{ item = 'deer', amount = 1, price = 7500, label = 'Dead Deer Bait', requiredLevel = 3, mystery = true },
},
['Cut Weapons'] = {
{ item = 'WEAPON_HATCHET', amount = 1, price = 1000, label = 'Hatchet', requiredLevel = 0, mystery = false },
{ item = 'WEAPON_SWITCHBLADE', amount = 1, price = 2000, label = 'Switchblade', requiredLevel = 1, mystery = false },
{ item = 'WEAPON_KNIFE', amount = 1, price = 3000, label = 'Knife', requiredLevel = 3, mystery = true },
{ item = 'WEAPON_BATTLEAXE', amount = 1, price = 7000, label = 'Battleaxe', requiredLevel = 6, mystery = true },
},
['Hunting Weapons'] = {
{ item = 'WEAPON_MARKSMANPISTOL', amount = 1, price = 5000, label = 'Marksman Pistol', requiredLevel = 0, mystery = false },
{ item = 'WEAPON_MUSKET', amount = 1, price = 10000, label = 'Musket', requiredLevel = 3, mystery = true },
{ item = 'WEAPON_DBSHOTGUN', amount = 1, price = 15000, label = 'Double Barrel Shotgun', requiredLevel = 4, mystery = true },
{ item = 'WEAPON_MARKSMANRIFLE', amount = 1, price = 20000, label = 'Marksman Rifle', requiredLevel = 6, mystery = true },
{ item = 'ammo-22', amount = 20, price = 1000, label = 'Marksman Pistol Ammo', requiredLevel = 0, mystery = false },
{ item = 'ammo-musket', amount = 20, price = 2000, label = 'Musket Ammo', requiredLevel = 3, mystery = true },
{ item = 'ammo-shotgun', amount = 20, price = 3000, label = 'Shotgun Ammo', requiredLevel = 4, mystery = true },
{ item = 'ammo-sniper', amount = 20, price = 5000, label = 'Sniper Ammo', requiredLevel = 6, mystery = true },
},
},
}
Config.SellNPC = { -- NPC that opens a shop to sell hunting stuff
enabled = true, -- Set to false to disable the selling shop npc
route = true, -- If true, the sell NPC will have a route in the hunting npc
label = 'Hunt Selling',
moneyType = 'bank',
model = 's_m_y_ammucity_01',
coords = vector3(-1112.9452, 4903.7397, 217.5952),
heading = 310.2702,
blip = {
enabled = true,
sprite = 141,
color = 73,
display = 2,
scale = 0.7,
shortrange = true,
},
categories = { -- Price is per 1
['Animals Loot'] = {
{ item = 'animal_fat', price = 30, label = 'Animal Fat', requiredLevel = 0, mystery = false },
{ item = 'bone_fragments', price = 50, label = 'Bone Fragments', requiredLevel = 0, mystery = false },
{ item = 'raw_pork', price = 40, label = 'Raw Pork', requiredLevel = 0, mystery = false },
{ item = 'cloth', price = 80, label = 'Cloth', requiredLevel = 0, mystery = false },
{ item = 'leather', price = 200, label = 'Leather', requiredLevel = 0, mystery = false },
},
},
}
Config.VehicleRentals = {
['Hunter Vehicle Rental'] = {
model = 's_m_y_ranger_01',
locations = {
{
coords = vector3(-1134.2738, 4948.8364, 221.2687),
heading = 250.0,
spawnCoords = vector4(-1123.0931, 4938.5078, 218.9916, 182.0102),
returnCoords = vector3(-1125.8119, 4951.6187, 220.3517),
},
},
moneyType = 'bank',
vehicles = {
{ model = 'bodhi2', label = 'Bodhi', rentInterval = 5, intervalPrice = 50, deposit = 500, requiredLevel = 0, mystery = false },
{ model = 'bifta', label = 'Bifta', rentInterval = 5, intervalPrice = 75, deposit = 750, requiredLevel = 1, mystery = false },
{ model = 'dloader', label = 'Duneloader', rentInterval = 5, intervalPrice = 100, deposit = 1000, requiredLevel = 2, mystery = false },
{ model = 'rebel', label = 'Rebel', rentInterval = 5, intervalPrice = 100, deposit = 1000, requiredLevel = 2, mystery = false },
{ model = 'sandking', label = 'Sandking', rentInterval = 5, intervalPrice = 125, deposit = 1250, requiredLevel = 3, mystery = false },
{ model = 'hellion', label = 'Hellion', rentInterval = 5, intervalPrice = 150, deposit = 1500, requiredLevel = 4, mystery = false },
{ model = 'caracara2', label = 'Caracara 4x4', rentInterval = 5, intervalPrice = 175, deposit = 1750, requiredLevel = 5, mystery = true },
{ model = 'terminus', label = 'Terminus', rentInterval = 5, intervalPrice = 200, deposit = 2000, requiredLevel = 6, mystery = true },
},
blip = {
enabled = true,
sprite = 226, -- Car rental blip
color = 25, -- Green color
display = 2,
scale = 0.7,
shortrange = true,
},
},
}
--[[
ONLY CHANGE THIS PART IF YOU HAVE RENAMED SCRIPTS SUCH AS FRAMEWORK, TARGET, INVENTORY ETC
RENAME THE SCRIPT NAME TO THE NEW NAME
--]]
---@type table Only change these if you have changed the name of a resource
Resources = {
FM = { name = 'fmLib', export = 'new' },
OXTarget = { name = 'ox_target', export = 'all' },
QBTarget = { name = 'qb-target', export = 'all' },
}
IgnoreScriptFoundLogs = false
--[[
BY RX Scripts © rxscripts.xyz
--]]
Config.OnlySpawned = true -- If true, only animals spawned by the script can be used for our features (true is recommended)
Config.AnimalCleanup = false -- If true, animals spawned by the script will be deleted when getting out of the hunting zone
Config.CutOutsideZone = true -- If true, you can cut animals outside of the hunting zones
Config.AnimalProofs = {
bullet = false,
fire = false,
explosion = false,
collision = true,
melee = false,
steam = false,
drown = false,
}
Config.Animals = {
['Pig'] = { -- Must be unique
label = 'Pig',
model = 'a_c_pig', -- We suggest making this unique if using Config.OnlySpawned = false
attacker = false, -- If the animal should attack the player instead of running away, only works for animals that are attackers by GTA already
spawnChance = 30, -- Recommended to keep between 1 - 100 (individual chance, no need to sum all animals up to 100)
requiredLevel = 0, -- Required level to cut the animal
cutTimes = 3, -- Amount of times the animal can be cut (in total, so if multiple players are cutting the animal, it will be cut faster)
lootLoop = 2, -- Amount of times something out of the loot table will be given each cut (e.g. 1x animal_fat, 1x bone_fragments)
loot = {
{ item = 'animal_fat', min = 1, max = 3, chance = 40 },
{ item = 'bone_fragments', min = 1, max = 3, chance = 25 },
{ item = 'cloth', min = 1, max = 2, chance = 15 },
{ item = 'leather', min = 1, max = 1, chance = 5 },
{ item = 'raw_pork', min = 1, max = 3, chance = 10 },
},
xp = {
cutGain = 5, -- XP gained from cutting the animal
killGain = 10, -- XP gained from killing the animal
},
weapons = { -- Weapons that can be used to cut the animal, can be found in config/cutweapons.lua
Config.CutWeapons['WEAPON_HATCHET'],
Config.CutWeapons['WEAPON_SWITCHBLADE'],
Config.CutWeapons['WEAPON_KNIFE'],
Config.CutWeapons['WEAPON_BATTLEAXE'],
},
},
['Cow'] = {
model = 'a_c_cow',
label = 'Cow',
attacker = false,
spawnChance = 20,
requiredLevel = 0,
cutTimes = 4,
lootLoop = 3,
loot = {
{ item = 'animal_fat', min = 1, max = 3, chance = 40 },
{ item = 'bone_fragments', min = 1, max = 3, chance = 25 },
{ item = 'cloth', min = 1, max = 2, chance = 15 },
{ item = 'leather', min = 1, max = 1, chance = 5 },
{ item = 'raw_pork', min = 1, max = 3, chance = 10 },
},
xp = {
cutGain = 10,
killGain = 15,
},
weapons = {
Config.CutWeapons['WEAPON_HATCHET'],
Config.CutWeapons['WEAPON_SWITCHBLADE'],
Config.CutWeapons['WEAPON_KNIFE'],
Config.CutWeapons['WEAPON_BATTLEAXE'],
},
},
['Boar'] = {
model = 'a_c_boar',
label = 'Boar',
attacker = false,
spawnChance = 20,
requiredLevel = 1,
cutTimes = 4,
lootLoop = 2,
loot = {
{ item = 'animal_fat', min = 1, max = 3, chance = 40 },
{ item = 'bone_fragments', min = 1, max = 3, chance = 25 },
{ item = 'cloth', min = 1, max = 2, chance = 15 },
{ item = 'leather', min = 1, max = 1, chance = 5 },
{ item = 'raw_pork', min = 1, max = 3, chance = 10 },
},
xp = {
cutGain = 15,
killGain = 25,
},
weapons = {
Config.CutWeapons['WEAPON_HATCHET'],
Config.CutWeapons['WEAPON_SWITCHBLADE'],
Config.CutWeapons['WEAPON_KNIFE'],
Config.CutWeapons['WEAPON_BATTLEAXE'],
},
},
['Deer'] = {
model = 'a_c_deer',
label = 'Deer',
attacker = false,
spawnChance = 15,
requiredLevel = 2,
cutTimes = 4,
lootLoop = 3,
loot = {
{ item = 'animal_fat', min = 1, max = 3, chance = 40 },
{ item = 'bone_fragments', min = 1, max = 3, chance = 25 },
{ item = 'cloth', min = 1, max = 2, chance = 15 },
{ item = 'leather', min = 1, max = 1, chance = 5 },
{ item = 'raw_pork', min = 1, max = 3, chance = 10 },
},
xp = {
cutGain = 25,
killGain = 40,
},
weapons = {
Config.CutWeapons['WEAPON_HATCHET'],
Config.CutWeapons['WEAPON_SWITCHBLADE'],
Config.CutWeapons['WEAPON_KNIFE'],
Config.CutWeapons['WEAPON_BATTLEAXE'],
},
},
['Coyote'] = {
model = 'a_c_coyote',
label = 'Coyote',
attacker = true,
spawnChance = 10,
requiredLevel = 3,
cutTimes = 3,
lootLoop = 2,
loot = {
{ item = 'animal_fat', min = 1, max = 3, chance = 40 },
{ item = 'bone_fragments', min = 1, max = 3, chance = 25 },
{ item = 'cloth', min = 1, max = 2, chance = 15 },
{ item = 'leather', min = 1, max = 1, chance = 5 },
{ item = 'raw_pork', min = 1, max = 3, chance = 10 },
},
xp = {
cutGain = 30,
killGain = 60,
},
weapons = {
Config.CutWeapons['WEAPON_HATCHET'],
Config.CutWeapons['WEAPON_SWITCHBLADE'],
Config.CutWeapons['WEAPON_KNIFE'],
Config.CutWeapons['WEAPON_BATTLEAXE'],
},
},
['Lion'] = {
model = 'a_c_mtlion',
label = 'Lion',
attacker = true,
spawnChance = 5,
requiredLevel = 6,
cutTimes = 5,
lootLoop = 4,
loot = {
{ item = 'animal_fat', min = 1, max = 3, chance = 40 },
{ item = 'bone_fragments', min = 1, max = 3, chance = 25 },
{ item = 'cloth', min = 1, max = 2, chance = 15 },
{ item = 'leather', min = 1, max = 1, chance = 5 },
{ item = 'raw_pork', min = 1, max = 3, chance = 10 },
},
xp = {
cutGain = 50,
killGain = 100,
},
weapons = {
Config.CutWeapons['WEAPON_BATTLEAXE'],
},
},
}
--[[
BY RX Scripts © rxscripts.xyz
--]]
Config.HuntingZones = {
['Zone Box'] = {
maxAnimals = 50,
spawnInterval = 1,
zone = {
type = 'box',
coords = vector3(-909.0355, 4788.1802, 200.0),
size = vector3(150.0, 150.0, 600.0),
rotation = 0,
debug = false,
},
animals = {
'Pig',
'Cow',
'Boar',
'Deer',
'Coyote',
'Lion',
},
route = {
enabled = true,
coords = { x = -909.0355, y = 4788.1802},
},
blip = {
enabled = true,
sprite = 141,
color = 31,
display = 2,
scale = 0.7,
shortrange = true,
label = 'Hunting - Zone Box',
},
},
['Zone Sphere'] = {
maxAnimals = 50,
spawnInterval = 1,
zone = {
type = 'sphere',
coords = vector3(-689.2698, 3632.1519, 294.9303),
radius = 150,
debug = false,
},
animals = {
'Pig',
'Pig',
'Cow',
'Boar',
'Deer',
'Coyote',
'Lion',
},
route = {
enabled = true,
coords = { x = -689.2698, y = 3632.1519},
},
blip = {
enabled = true,
sprite = 141,
color = 31,
display = 2,
scale = 0.7,
shortrange = true,
label = 'Hunting - Zone Sphere',
},
radiusBlip = {
enabled = true,
radius = 150.0,
color = 25,
alpha = 80,
shortrange = true,
},
}
}
--[[
BY RX Scripts © rxscripts.xyz
--]]
Config.MaxMissions = 6 -- Max amount of missions that can be active at the same time (make sure its 1 less than the amount of missions in the table below so it can rotate)
Config.Missions = {
["Kill 5x Pig"] = {
endTime = 12, -- Time in hours to complete the mission (after this a random other mission will start)
type = 'kills', -- 'kills' or 'cuts'
amount = 5, -- Amount of kills or cuts required
animal = 'Pig', -- Animal to kill or cut (key from config/animals.lua)
rewards = {
xp = 50, -- Set to 0 to disable
money = 1000, -- Set to 0 to disable
moneyType = 'bank',
items = { -- Empty table to disable
{ item = 'boar_meat', amount = 1 },
{ item = 'meat_stand', amount = 1 },
}
}
},
["Kill 3x Lion"] = {
endTime = 24,
type = 'kills',
amount = 3,
animal = 'Lion',
rewards = {
xp = 100,
money = 2000,
moneyType = 'bank',
items = {
{ item = 'meat_stand', amount = 2 },
{ item = 'deer_horn', amount = 1 },
}
}
},
["Cut 15x Coyote"] = {
endTime = 24,
type = 'cuts',
amount = 15,
animal = 'Coyote',
rewards = {
xp = 100,
money = 1500,
moneyType = 'bank',
items = {
{ item = 'meat_stand', amount = 1 },
{ item = 'deer', amount = 1 },
}
},
},
["Cut 15x Cow"] = {
endTime = 12,
type = 'cuts',
amount = 15,
animal = 'Cow',
rewards = {
xp = 100,
money = 1000,
moneyType = 'bank',
items = {
{ item = 'meat_stand', amount = 1 },
{ item = 'boar', amount = 2 },
}
},
},
["Cut 15x Lion"] = {
endTime = 48,
type = 'cuts',
amount = 15,
animal = 'Lion',
rewards = {
xp = 200,
money = 1500,
moneyType = 'bank',
items = {
{ item = 'deer_horn', amount = 1 },
{ item = 'meat_stand', amount = 1 },
{ item = 'deer', amount = 2 },
}
},
},
["Cut 10x Boar"] = {
endTime = 24,
type = 'cuts',
amount = 10,
animal = 'Boar',
rewards = {
xp = 100,
money = 1000,
moneyType = 'bank',
items = {
{ item = 'boar_meat', amount = 1 },
{ item = 'meat_stand', amount = 1 },
{ item = 'deer', amount = 1 },
}
},
},
["Kill 5x Deer"] = {
endTime = 48,
type = 'cuts',
amount = 5,
animal = 'Deer',
rewards = {
xp = 100,
money = 1000,
moneyType = 'bank',
items = {
{ item = 'deer', amount = 2 },
{ item = 'deer_horn', amount = 1 },
}
},
},
}
--[[
BY RX Scripts © rxscripts.xyz
--]]
Config.Baits = {
['boar_meat'] = { -- Item name to place the bait
requiredLevel = 1, -- Required level to use this bait
prop = 'rx_meat_big', -- Prop to place on the ground
maxAttracts = 5, -- Max amount of animals that will be attracted
onlyZone = true, -- Can only be used in hunting zones
attractTime = { min = 3, max = 5 }, -- Random time in minutes the bait will attract animals
removal = { minutes = 15, afterMaxAttracts = true }, -- Time in minutes the bait will be removed, after attracting max animals, or just always
attracts = { -- Animals that will be attracted by this bait (key from config/animals.lua)
'Pig',
'Cow',
}
},
['meat_stand'] = {
requiredLevel = 2,
prop = 'rx_standmeat',
maxAttracts = 8,
onlyZone = true,
attractTime = { min = 2, max = 3 },
removal = { minutes = 15, afterMaxAttracts = true },
attracts = {
'Cow',
'Pig',
'Boar',
'Deer',
'Coyote',
'Lion',
}
},
['deer'] = {
requiredLevel = 4,
prop = 'rx_deerdead',
maxAttracts = 5,
onlyZone = true,
attractTime = { min = 3, max = 5 },
removal = { minutes = 15, afterMaxAttracts = true },
attracts = {
'Coyote',
'Lion',
}
}
}
Config.Calls = { -- Shows animals on the map
['deer_horn'] = { -- Item name to use the call
label = "Deer Call",
requiredLevel = 2, -- Required level to use this call
radius = 200, -- Radius in meters the call will show animals
remove = true, -- Remove the call after using it
duration = 60, -- Duration in seconds the call will show animals
onlyZone = true, -- Can only be used in hunting zones
shows = { -- Animals that will be shown by this call (key from config/animals.lua)
'Deer',
},
blip = { -- Blip that will be shown on the map
sprite = 141,
color = 73,
label = 'Deer',
display = 2,
scale = 0.7,
shortrange = false,
},
}
}
--[[
BY RX Scripts © rxscripts.xyz
--]]
Config.OnlyCheckInventory = false -- Only checks if weapon is in inventory instead of hand
Config.CutWeapons = {
['WEAPON_HATCHET'] = {
itemName = 'WEAPON_HATCHET', -- Item name to check if player has it if OnlyCheckInventory is true
hash = joaat('WEAPON_HATCHET'),
requiredLevel = 0, -- Level required to use this weapon for cutting
multipliers = {
lootAmount = 1, -- 1x loot amount
xpGain = 1.0, -- 0% more xp on cutting (1.0 is 100%)
},
},
['WEAPON_SWITCHBLADE'] = {
itemName = 'WEAPON_SWITCHBLADE',
hash = joaat('WEAPON_SWITCHBLADE'),
requiredLevel = 1,
multipliers = {
lootAmount = 1,
xpGain = 1.1,
},
},
['WEAPON_KNIFE'] = {
itemName = 'WEAPON_KNIFE',
hash = joaat('WEAPON_KNIFE'),
requiredLevel = 3,
multipliers = {
lootAmount = 2,
xpGain = 1.2,
},
},
['WEAPON_BATTLEAXE'] = {
itemName = 'WEAPON_BATTLEAXE',
hash = joaat('WEAPON_BATTLEAXE'),
requiredLevel = 6,
multipliers = {
lootAmount = 3,
xpGain = 1.3,
},
},
}
--[[
BY RX Scripts @ rxscripts.xyz
--]]
Config.Outfits = {
[0] = { -- Level 0 outfit - Basic Hunter
male = {
['mask_1'] = 0,
['mask_2'] = 0,
['arms'] = 41,
['tshirt_1'] = 15,
['tshirt_2'] = 0,
['torso_1'] = 56,
['torso_2'] = 0,
['bproof_1'] = 0,
['bproof_2'] = 0,
['decals_1'] = 0,
['decals_2'] = 0,
['chain_1'] = 0,
['chain_2'] = 0,
['pants_1'] = 9,
['pants_2'] = 0,
['shoes_1'] = 12,
['shoes_2'] = 6,
['helmet_1'] = -1,
['helmet_2'] = 0,
['glasses_1'] = 0,
['glasses_2'] = 0,
['bag'] = 0,
['bag_color'] = 0,
},
female = {
['mask_1'] = 0,
['mask_2'] = 0,
['arms'] = 28,
['tshirt_1'] = 32,
['tshirt_2'] = 0,
['torso_1'] = 34,
['torso_2'] = 79,
['bproof_1'] = 0,
['bproof_2'] = 0,
['decals_1'] = 0,
['decals_2'] = 0,
['chain_1'] = 0,
['chain_2'] = 0,
['pants_1'] = 38,
['pants_2'] = 2,
['shoes_1'] = 24,
['shoes_2'] = 0,
['helmet_1'] = -1,
['helmet_2'] = 0,
['glasses_1'] = 0,
['glasses_2'] = 0,
['bag'] = 0,
['bag_color'] = 0,
},
},
}
--[[
BY RX Scripts © rxscripts.xyz
--]]
Config.Levels = { -- Levels must be incremental by 1, starting from 1
-- level 0 is the default starter level everyone has
[1] = 100, -- 100 xp needed to reach level 1
[2] = 350,
[3] = 650,
[4] = 1100,
[5] = 1900,
[6] = 2800,
[7] = 4000,
}
Opensource Files
All script-related open source code is contained within these files. Third-party components, including frameworks, inventory systems, and other external code, are separately maintained & open sourced in our fmLib repository.
--[[
BY RX Scripts © rxscripts.xyz
--]]
local cutTargetLabel = 'Cut'
function InitAnimalTargets(animals)
local opts = {
{
label = cutTargetLabel,
icon = 'fas fa-cut',
}
}
if OXTarget then
opts[1].name = 'cut' -- don't change this
opts[1].onSelect = function(data)
CutAnimal(data.entity)
end
opts[1].canInteract = function(entity, distance, coords, name, bone)
local netId = NetworkGetNetworkIdFromEntity(entity)
local canCutSpawned = (ZoneInside or Config.CutOutsideZone) and Animals[netId] ~= nil
return not CutOnCd and IsEntityDead(entity) and (not Config.OnlySpawned or canCutSpawned)
end
opts[1].distance = 2.5
OXTarget:addModel(animals, opts)
elseif QBTarget then
opts[1].action = function(entity)
CutAnimal(entity)
end
opts[1].canInteract = function(entity, distance, data)
local netId = NetworkGetNetworkIdFromEntity(entity)
local canCutSpawned = (ZoneInside or Config.CutOutsideZone) and Animals[netId] ~= nil
return not CutOnCd and IsEntityDead(entity) and (not Config.OnlySpawned or canCutSpawned)
end
QBTarget:AddTargetModel(animals, {
options = opts,
distance = 2.5,
})
end
end
function RemoveAnimalTargets(animals)
if OXTarget then
OXTarget:removeModel(animals, 'cut')
elseif QBTarget then
QBTarget:RemoveTargetModel(animals, cutTargetLabel)
end
end
function AddHuntingNPCTarget(ped)
if OXTarget then
OXTarget:addLocalEntity(ped, {
{
label = 'Open Hunter',
name = 'openHuntingNPC',
icon = 'fas fa-hiking',
distance = 2.5,
onSelect = function(data)
OpenHuntingUI()
end,
}
})
elseif QBTarget then
QBTarget:AddTargetEntity(ped, {
options = {
{
label = 'Open Hunter',
icon = 'fas fa-hiking',
targeticon = 'fas fa-hiking',
action = function(entity)
OpenHuntingUI()
end,
}
},
distance = 2.5,
})
end
end
function AddShopNPCTarget(npc)
if OXTarget then
OXTarget:addLocalEntity(npc, {
{
label = 'Open Hunting Shop',
name = 'openHuntingShop',
icon = 'fas fa-shopping-cart',
distance = 2.5,
onSelect = function(data)
OpenShopNPC()
end,
}
})
elseif QBTarget then
QBTarget:AddTargetEntity(npc, {
options = {
{
label = 'Open Hunting Shop',
icon = 'fas fa-shopping-cart',
targeticon = 'fas fa-shopping-cart',
action = function(entity)
OpenShopNPC()
end,
}
},
distance = 2.5,
})
end
end
function AddSellNPCTarget(npc)
if OXTarget then
OXTarget:addLocalEntity(npc, {
{
label = 'Open Hunting Selling',
name = 'openHuntingSelling',
icon = 'fas fa-shopping-cart',
distance = 2.5,
onSelect = function(data)
OpenSellNPC()
end,
}
})
elseif QBTarget then
QBTarget:AddTargetEntity(npc, {
options = {
{
label = 'Open Hunting Selling',
icon = 'fas fa-shopping-cart',
targeticon = 'fas fa-shopping-cart',
action = function(entity)
OpenSellNPC()
end,
}
},
distance = 2.5,
})
end
end
function RemoveShopNPCTarget(ped)
if OXTarget then
OXTarget:removeLocalEntity(ped, 'openHuntingShop')
elseif QBTarget then
QBTarget:RemoveTargetEntity(ped, 'Open Hunting Shop')
end
end
function RemoveSellNPCTarget(ped)
if OXTarget then
OXTarget:removeLocalEntity(ped, 'openHuntingSelling')
elseif QBTarget then
QBTarget:RemoveTargetEntity(ped, 'Open Hunting Selling')
end
end
function RemoveHuntingNPCTarget(ped)
if OXTarget then
OXTarget:removeLocalEntity(ped, 'openHuntingNPC')
elseif QBTarget then
QBTarget:RemoveTargetEntity(ped, 'Open Hunter')
end
end
function AddVehicleRentalNPCTarget(npc, rentalName, locIndex)
if OXTarget then
OXTarget:addLocalEntity(npc, {
{
label = _L('rent_vehicle_label'),
name = 'hunting_vehicle_rental_' .. rentalName .. '_' .. locIndex,
icon = 'fas fa-car',
distance = 2.5,
onSelect = function(data)
OpenVehicleRentalUI(rentalName, locIndex)
end,
}
})
elseif QBTarget then
QBTarget:AddTargetEntity(npc, {
options = {
{
label = _L('rent_vehicle_label'),
icon = 'fas fa-car',
targeticon = 'fas fa-car',
action = function(entity)
OpenVehicleRentalUI(rentalName, locIndex)
end,
}
},
distance = 2.5,
})
end
end
function StartCutProgress(animalNetId, weaponHash)
if FM.progress.start({
label = 'Cutting..',
time = 1000,
canCancel = true,
type = 'circle',
failedLabel = 'Cutting failed!',
completedLabel = 'Cutting completed!',
anim = {
dict = 'melee@knife@streamed_core',
anim = 'ground_attack_on_spot',
},
}) then
CutAnimalByProgress(animalNetId, weaponHash)
else
CutOnCd = false
end
end
function GetFullPlayerName()
return FM.callback.sync('hunting:getFullPlayerName')
end
function GetPlacingBaitCoords()
local coords = GetEntityCoords(PlayerPedId())
local forward = GetEntityForwardVector(PlayerPedId())
coords = coords + forward
local ret, z = GetGroundZFor_3dCoord(coords.x, coords.y, coords.z, 0, false)
coords = vector3(coords.x, coords.y, z)
local heading = GetEntityHeading(PlayerPedId())
return coords, heading
end
function PlayPlaceBaitAnim()
FM.anim.play({
anim = 'base',
dict = 'amb@world_human_gardener_plant@male@base',
duration = 3000,
})
end
function GetItemsAmounts()
return FM.inventory.getItemsAmounts()
-- Remove above line and uncomment below if your inventory script doesnt sync the items correctly
-- return FM.callback.sync('hunting:getItemsAmounts')
end
RegisterNetEvent('hunting:notifyPolice', function(coords, msg)
NotifyPolice(coords, msg)
end)
---@param type 'return_rental'
function ShowMarker(type, coords)
if type == 'return_rental' then
DrawMarker(1, coords.x, coords.y, coords.z - 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 5.0, 5.0, 1.0, 34, 197, 94, 150, false, true, 2, false, nil, nil, false)
end
end
--[[
EVENTS
--]]
RegisterNetEvent('rxhunting:onZoneEntered', function(zoneName)
-- Triggered when the player enters a hunting zone
end)
RegisterNetEvent('rxhunting:onZoneLeft', function(zoneName)
-- Triggered when the player leaves a hunting zone
end)
--[[
BY RX Scripts © rxscripts.xyz
--]]
Config.DiscordWebhook = '' -- Discord webhook to send important logs (Set to '' to disable)
function GetPoliceSources()
local players = FM.utils.getPlayers()
local policeSources = {}
for src, p in pairs(players) do
if p.getJob().name == 'police' then
policeSources[#policeSources+1] = src
end
end
return policeSources
end
function GetPlayerFullName(src)
local p = FM.player.get(src)
return p and p.getFullName() or 'Mr. Nobody'
end
function HasHuntingLicense(src)
local hunter = GetOrCreateHunter(src)
if not hunter then return false end
return hunter.license
end
--[[
esx_licenses INTEGRATION FOR CHECKING HUNTING LICENSE
UNCOMMENT FUNCTION BELOW
RENAME 'hunting_license_name_here' TO YOUR HUNTING LICENSE NAME
REMOVE/COMMENT THE FUNCTION ABOVE: function HasHuntingLicense(src) ...... end
]]
-- function HasHuntingLicense(src)
-- local hasLicense = promise.new()
-- TriggerEvent('esx_license:checkLicense', src, 'hunting_license_name_here', function(bool)
-- hasLicense:resolve(bool)
-- end)
-- return Citizen.Await(hasLicense)
-- end
FM.callback.register('hunting:getFullPlayerName', function(src)
return GetPlayerFullName(src)
end)
FM.callback.register('hunting:getItemsAmounts', function(src)
local p = FM.player.get(src)
if not p then return end
local items = p.getItems()
local amounts = {}
for _, item in pairs(items) do
if amounts[item.name] then
amounts[item.name] = amounts[item.name] + item.amount
else
amounts[item.name] = item.amount
end
end
return amounts
end)
--[[
LOGGING
You can customize this function to send logs to different services
Example: Replace ToDiscord with your own logging implementation
]]
---@param title string The title of the log message
---@param fields table Array of {name: string, value: string, inline?: boolean}
---@param color? number The embed color (optional, defaults to 10027059)
function Log(title, fields, color)
ToDiscord(title, fields, color)
end
--[[
XP & LEVEL FUNCTIONS
These wrapper functions allow you to interact with the hunting XP/level system
]]
---@param src number Player server id
---@param xp number Amount of XP to add
---@return boolean success
function AddHunterXP(src, xp)
local hunter = GetOrCreateHunter(src)
if not hunter then return false end
hunter:addXP(xp)
return true
end
---@param src number Player server id
---@return number|boolean level
function GetHunterLevel(src)
local p = FM.player.get(src)
if not p then return false end
local hunter = Hunters[p.getIdentifier()]
if not hunter then return false end
return hunter.level
end
---@param src number Player server id
---@return number|boolean xp
function GetHunterXP(src)
local p = FM.player.get(src)
if not p then return false end
local hunter = Hunters[p.getIdentifier()]
if not hunter then return false end
return hunter.xp
end
---@param src number Player server id
---@param level number Level to set
---@return boolean success
function SetHunterLevel(src, level)
local hunter = GetOrCreateHunter(src)
if not hunter then return false end
hunter:update({ level = level }, true)
return true
end
---@param src number Player server id
---@param xp number XP to set (not add)
---@return boolean success
function SetHunterXP(src, xp)
local hunter = GetOrCreateHunter(src)
if not hunter then return false end
hunter:update({ xp = xp }, true)
hunter:checkLevel()
return true
end
--[[
EVENTS
--]]
RegisterNetEvent('rxhunting:onLicenseBought', function(playerId)
-- Triggered when a player purchases a hunting license
end)
RegisterNetEvent('rxhunting:onItemBought', function(playerId, itemData, amount, price)
-- Triggered when a player buys an item from the hunting shop
end)
RegisterNetEvent('rxhunting:onItemSold', function(playerId, itemData, amount, totalPrice)
-- Triggered when a player sells an item at the hunting shop
end)
RegisterNetEvent('rxhunting:onAnimalCut', function(playerId, animalData, cutWeapon)
-- Triggered when a player cuts an animal
end)
RegisterNetEvent('rxhunting:onAnimalKilled', function(playerId, animalData)
-- Triggered when a player kills an animal
end)
RegisterNetEvent('rxhunting:onXpGained', function(playerId, xpGained, newTotalXP, hunter)
-- Triggered when a player gains XP
end)
RegisterNetEvent('rxhunting:onLevelUp', function(playerId, newLevel, hunter)
-- Triggered when a player levels up
end)
RegisterNetEvent('rxhunting:onMissionClaimed', function(playerId, missionKey, rewards)
-- Triggered when a player claims mission rewards
end)
RegisterNetEvent('rxhunting:onBaitPlaced', function(playerId, baitId, baitData)
-- Triggered when a player places a bait
end)
RegisterNetEvent('rxhunting:onBaitRemoved', function(baitId, baitData, reason)
-- Triggered when a bait is removed (expired or max attracts reached)
end)
RegisterNetEvent('rxhunting:onBaitAttracted', function(baitId, animalKey, playerId)
-- Triggered when a bait attracts an animal
end)
RegisterNetEvent('rxhunting:onLicenseRevoked', function(playerId)
-- Triggered when a player's hunting license is revoked
end)
RegisterNetEvent('rxhunting:onVehicleRented', function(playerId, rentalName, vehicleData, totalCost)
-- Triggered when a player rents a vehicle
end)
RegisterNetEvent('rxhunting:onVehicleReturned', function(playerId, rentalName, vehicleData, depositReturned)
-- Triggered when a player returns a rented vehicle
end)
RegisterNetEvent('rxhunting:onAnimalSpawned', function(animalData, zoneName, netId)
-- Triggered when an animal is spawned in a zone
end)
Events
All client- & serversided events included within this script. Events serve as listeners that capture and respond to actions executed by this script.
Logs
All logs included within this script. Logs are sent to the configured Discord webhook URL by default, but can be customized to send to other services.
