Complete Scripts
  • 📖COMPLETE DOCS
  • 💻SCRIPTS
    • Complete Carplay
      • Installation
      • Changelog
      • Config
      • Common errors
      • Exports
    • Complete Vision
      • Installation
      • How to use it
      • Common errors
      • Updates
    • Complete Hud
      • Config
      • Common errors
      • Exports
      • Update
    • Complete Hunting
      • Config
      • Common errors
      • Updates
    • Complete Importexport
      • Config
      • Common errors
    • Complete Speedometer
      • Config
      • Common errors
      • Update
      • Exports
    • Complete Daily Bonus
      • Github
      • Common errors
      • Exports
Powered by GitBook
On this page

Was this helpful?

  1. SCRIPTS
  2. Complete Hunting

Config

Check out the default ESX and QBCore config file.

ESX
Config = {}

-- === VERSION 2.4.0 ===

Config.Debug = false

-- [GENERAL]:
Config.EnableFootprints     = true
Config.PNearAnimalToEscape  = 20      -- if the distance between a player and the animal is less than this value, it will run away (not for native animals)
Config.CarryAnimals         = true
Config.CarryAnimalsKey      = "G"
Config.WeaponsOnlyHunting   = false   -- if TRUE when you get out of a hunting zone you won't be able to use the weapons
                                      -- only if Config.HuntAllMap FALSE
Config.UseTarget            = false

-- [HARVESTING]:
Config.HeadshotForPerfect = true      -- In order to receve the perfect item, you will need to get perfect in Config.WeaponDamages and also kill the animal with an headshot 
Config.TimeToHarvest      = 15000     -- number of milliseconds to complete harvesting
Config.CameraMovement     = true      -- if true camera animation when harvesting animals
Config.MinLeather         = 1         -- the minimum number of leather you can drop
Config.MaxLeather         = 1         -- the maximum number of leather you can drop 
Config.CanDropMeat        = true      -- false if you don't want that animals can drop meat
Config.MeatOfAnimals      = false     -- if true the meat will be different for each animal (see Config.Animals) and not Config.MeatItem, if false it will be Config.MeatItem and the same for all animals
Config.MeatItem           = "meat"    -- item name for meat
Config.MeatCost           = 20        -- price for Config.MeatItem
Config.MinMeat            = 2         -- the minimum number of meat you can drop
Config.MaxMeat            = 3         -- the maximum number of meat you can drop
Config.CanDropSpecial     = true      -- false if you don't want that animals can drop special items (see Config.Animals)
Config.SpecialProb        = 96        -- probability, example: the script generates a random number from 1 to 100, if the random number is higher (>) than this one it will drop (so 10% probability)

-- [BAIT]:
Config.EnableBait           = true
Config.BlipOnBaitAnimal     = true
Config.BaitPlacingTime      = 15000     -- milliseconds
Config.BaitItemName         = "animal_bait"
Config.BaitAnimals          = {"a_c_deer", "a_c_boar", "a_c_mtlion", "a_c_coyote"}  -- animal that can spawn when placing a bait (need to be also in Config.Animals)
Config.TimeForAnimalToLeave = 10000     -- animal once reached bait will wait this time before walking away milliseconds
Config.BaitSpawnRadious     = 200        -- when you place a bait, the animal will spawn in this radious (I raccomend 200) 
Config.TimeBetween          = 120       -- IN SECONDS, time you need to wait before placing another bait


-- [ANIMALS / WEAPONS]:
    -- MODEL: the model of animal you want to spawn / hunt 
    -- BAD/GOOD/PERFECT: the item dropped when harvesting that animal
    -- DIMENSION: size of the animal, you need this with Config.WeaponDamages
    -- MEAT: the meat dropped when harvesting that animal

Config.Animals = {
    {dimension = "big", meat = "deer_meat", meatCost = 100, model = "a_c_deer", bad = "leather_deer_bad", badCost = 100, good = "leather_deer_good", goodCost = 420, perfect = "leather_deer_perfect", perfectCost = 890, hash = -664053099, specialItem = "deer_horn", specialItemCost = 630, isIllegal = false},
    {dimension = "medBig", meat = "boar_meat", meatCost = 100, model = "a_c_boar", bad = "leather_boar_bad", badCost = 100, good = "leather_boar_good", goodCost = 420, perfect = "leather_boar_perfect", perfectCost = 890, hash = -832573324, specialItem = "", specialItemCost = 0, isIllegal = false},
    {dimension = "medBig", meat = "mtlion_meat", meatCost = 100, model = "a_c_mtlion", bad = "leather_mlion_bad", badCost = 100, good = "leather_mlion_good", goodCost = 420, perfect = "leather_mlion_perfect", perfectCost = 890, hash = 307287994, specialItem = "", specialItemCost = 0, isIllegal = true, illegalBadCost = 50, illegalGoodCost = 190, illegalPerfectCost = 430},
    {dimension = "medium", meat = "coyote_meat", meatCost = 100, model = "a_c_coyote", bad = "leather_coyote_bad", badCost = 100, good = "leather_coyote_good", goodCost = 420, perfect = "leather_coyote_perfect", perfectCost = 890, hash = 1682622302, specialItem = "", specialItemCost = 0, isIllegal = true, illegalBadCost = 50, illegalGoodCost = 190, illegalPerfectCost = 430},
    {dimension = "small", meat = "rabbit_meat", meatCost = 100, model = "a_c_rabbit_01", bad = "leather_rabbit_bad", badCost = 100, good = "leather_rabbit_good", goodCost = 420, perfect = "leather_rabbit_perfect", perfectCost = 890, hash = -541762431, specialItem = "", specialItemCost = 0, isIllegal = false},
    {dimension = "medium", meat = "cormorant_meat", meatCost = 100, model = "a_c_cormorant", bad = "leather_cormorant_bad", badCost = 100, good = "leather_cormorant_good", goodCost = 420, perfect = "leather_cormorant_perfect", perfectCost = 890, hash = 1457690978, specialItem = "", specialItemCost = 0, isIllegal = true, illegalBadCost = 50, illegalGoodCost = 190, illegalPerfectCost = 430},
    {dimension = "small", meat = "chickenhawk_meat", meatCost = 100, model = "a_c_chickenhawk", bad = "leather_chickenhawk_bad", badCost = 100, good = "leather_chickenhawk_good", goodCost = 420, perfect = "leather_chickenhawk_perfect", perfectCost = 890, hash = -1430839454, specialItem = "", specialItemCost = 0, isIllegal = true, illegalBadCost = 50, illegalGoodCost = 190, illegalPerfectCost = 430}
}   -- IMPORTANT: dimension name must be one of these "small" / "medium" / "medBig" / "big"
    -- IMPORTANT: you don't have to change hash numbers
    -- IMPORTANT: you need to have bad / good / perfect items in your items database
    -- IMPORTANT: if Config.MeatOfAnimals is true you need to have the meat item in your items database

Config.WeaponDamages = {
    -- According to the type of weapon (category) used to kill the animal, it will drop a certain type of skin based on his size (Config.Animals dimension)
    -- EXAMPLE: if i kill with a sniper a big animal in this case it will give me perfect item
    {category = "unarmed", small = "bad", medium = "bad", medBig = "bad", big = "bad"},
    {category = "melee", small = "bad", medium = "bad", medBig = "bad", big = "bad"},
    {category = "pistol", small = "good", medium = "good", medBig = "bad", big = "bad"},
    {category = "subgun", small = "bad", medium = "bad", medBig = "good", big = "bad"},
    {category = "shootgun", small = "bad", medium = "bad", medBig = "good", big = "bad"},
    {category = "rifle", small = "bad", medium = "bad", medBig = "bad", big = "bad"},
    {category = "snip", small = "bad", medium = "good", medBig = "perfect", big = "perfect"}
}   -- IMPORTANT: you don't have to change category names

Config.NativeAnimal      = true   -- false if you want to spawn your animals (modify AnimalModels) and not use native ones
Config.SpawnAnimalNumber = 10     -- number of animal to spawn if you aren't using native animals
Config.KnifesForHarvest  = {'WEAPON_KNIFE', 'WEAPON_SWITCHBLADE', 'WEAPON_DAGGER'}  -- you can harvest an animal only with these knifes

-- #####################################################################################################################################################################################################################################
-- Before opening a ticket on the server, if the animals don't spawn check this: https://complete-scripts.gitbook.io/complete-scripts/scripts/complete-hunting/common-errors#animals-not-spawning-or-you-dont-see-any-blips-in-the-zone
-- #####################################################################################################################################################################################################################################

-- [HUNTING ZONES]:
Config.huntAllMap  = true   -- true if you want to enable hunting in all the map
                            -- if not using native animals set it to FALSE (if you are using native animals you can still set it to FALSE)
Config.huntPoint   = {
    {id = 0, x = -1133.44, y = 4605.55, z = 144.96},
    {id = 1, x = 1996.02, y = 4982.71, z = 40.63}
}   -- if Config.huntAllMap false you have to decide a point in the map and the radious where you can hunt
    -- !! do not insert the same id twice !!

Config.huntRadious = 300


-- [CAMPFIRE]:
Config.EnableCampfire       = true
Config.UseNativeCampfire    = false
Config.CampfireTimeBetween  = 25         -- IN SECONDS, time you need to wait before cooking again meat (cooking time + time to wait)
Config.CampfireCommand      = "campfire" -- don't put the slash before
Config.CampfireProp         = "prop_beach_fire" -- name for the prop to spawn
Config.CampfireNameItem1    = "coal"     -- name for item1 in crafting
Config.CampfireCountItem1   = 2          -- number of pieces you need for item1
Config.CampfireNameItem2    = "wood"     -- name for item2 in crafting
Config.CampfireCountItem2   = 4          -- number of pieces you need for item2
Config.CampPlacingTime      = 15000      -- milliseconds
Config.KeyCampfireMenu      = "E"        -- ["E"]
Config.CookingTime          = 20000      -- milliseconds
Config.CookedMeatName       = "cookedMeat"
Config.KeyDestroyCampfire   = "G"        -- ["G"]
Config.noCampfireZoneRadious = 1000
Config.noCampfireZone       = {
    {x = -259.24, y = -1900.51, z = 27.76}
}   --you can add multiple of them (remember ",")


-- [SELLING ITEMS]:
Config.MoneyType = 'money' -- money / bank 
Config.illegalNpcModel = "a_m_m_og_boss_01"
Config.legalNpcModel = "s_m_m_ammucountry"
-- see also Config.Animals for prices


-- [BLIPS]:
Config.BlipOnEntity = true  -- if not using native animals 
Config.Blips = {
    {coords = vector3(1190.43, -3226.84, 4.55), name = "Hunting selling zone", sprite = 442, colour = 27},
    {coords = vector3(-1133.44, 4605.55, 144.96), name = "Hunting", sprite = 161, colour = 27},
    {coords = vector3(-1133.44, 4605.55, 144.96), name = "Hunting Zone", sprite = 442, colour = 27}
}
Config.BlipAnimalName = "Animal"
Config.BlipBaitAnimalName = "Bait animal"


-- [LOCATIONS]:
Config.Locations = {
    SellZone = { x = 1190.43, y = -3226.84, z = 5.0, h = 100.0 },
    IllegalNPC = { x = 1996.02, y = 4982.71, z = 40.63, h = 219.41}
}


-- [LANGUAGE]:
Config.Text = {
    ['before_harvest']   = 'Press [~g~E~w~] to harvest, [~g~G~w~] to carry',
	['harvesting']       = 'Harvesting animal...',
    ['need_knife']       = 'You need a knife to harvest',
    ['receved_leather']  = 'You receaved leather',
	['ruined_leather']   = 'The leather is too ruined',
	['receved_meat']     = 'You receaved meat',
	['special_item']     = 'You recived a special item',
    ----
    ['campfire']         = 'Press [~g~E~w~] to cook, [~g~G~w~] to remove',
    ['campfire2']        = 'Press [~g~E~w~] to cook',
    ['cooking']          = 'Cooking meat',
    ['placing_campfire'] = 'Placing campfire...',
    ['cant_place_camp']  = "You can't place your campfire here",
    ----
    ['cant_place_bait']  = "You can't place your bait here",
    ['placing_bait']     = 'Placing bait...',
    ['between_bait']     = 'You need to wait before use it again',
	['no_effects_bait']  = 'Your bait had any effects',
    ----
    ['sell_items']       = 'Press [~g~E~w~] to sell',
	['sold']             = 'Successfully sold',
	----
	['no_material']      = "You don't have enough material",
    ['you_didnt_kill_it'] = "You didn't kill the animal",
    ['already_harvesting'] = "You are already harvesting"
}
Config.FontType = 4

-- === DISPLAY TEXT ===
-- === Only change if you know what you're doing! === 
RegisterNetEvent('complete_hunting:notify')
AddEventHandler('complete_hunting:notify', function(msg, msgType)
    if not msgType then
        ESX.ShowNotification(msg, "info", 3000)
    else
        ESX.ShowNotification(msg, msgType, 3000)
    end
end)

Config.Progressbar = function(cb, text, time, anim_type, anim_dict, anim_lib)
    if anim_type ~= nil then
        local ped = PlayerPedId()
        if anim_type == "anim" then
            RequestAnimDict(anim_dict)
            while not HasAnimDictLoaded(anim_dict) do
                Citizen.Wait(1)
            end
            TaskPlayAnim(ped, anim_dict, anim_lib, -1, -1, -1, 1)
        elseif anim_type == "Scenario" then
            TaskStartScenarioInPlace(ped, anim_dict, 0, true)
        end
    end

    ESX.Progressbar(text, time,{
        FreezePlayer = true, 
        onFinish = function()
            cb("ok")
        end
    })
    
    -- OX
    /*
    if lib.progressBar({
        duration = time,
        label = text,
        useWhileDead = false,
        canCancel = false,
        disable = {
            move = true,
            car = true,
            combat = true,
        }
    }) then cb("ok") else cb("error") end
    */
end

function InitializeTarget()
    local targetModels = {}

    for _,v in ipairs(Config.Animals) do
        table.insert(targetModels, v.model)
    end
    
    exports.ox_target:addModel(targetModels, {
        {
            name = 'ox:option1',
            event = "complete_hunting:harvestAnimal",
            icon = "fa-solid fa-cut",
            label = "Harvest",
            canInteract = function(entity, distance, coords, name, bone)
                if IsEntityDead(entity) then
                    return true
                else
                    return false
                end
            end
        },
        {
            name = 'ox:option2',
            event = "complete_hunting:carryAnimal",
            icon = "fa-solid fa-people-carry",
            label = "Carry",
            canInteract = function(entity, distance, coords, name, bone)
                if IsEntityDead(entity) then
                    return true
                else
                    return false
                end
            end
        }
    })

    local campProp = {
        `prop_beach_fire`,
    }

    if Config.EnableCampfire then
        exports.ox_target:addModel(campProp, {
            {
                name = 'ox:option1',
                event = "complete_hunting:cookMenu",
                icon = "fa-solid fa-hamburger",
                label = "Cook meat",
            }
        })
    end
    
    local illegalSeller = {
        Config.illegalNpcModel,
    }
    
    exports.ox_target:addModel(illegalSeller, {
        {
            name = 'ox:option1',
            event = "complete_hunting:btTargetIllegalSell",
            icon = "fa-solid fa-store",
            label = "Sell",
        }
    })

    local legalSeller = {
        Config.legalNpcModel,
    }

    exports.ox_target:addModel(legalSeller, {
        {
            name = 'ox:option1',
            event = "complete_hunting:btTargetLegalSell",
            icon = "fa-solid fa-store",
            label = "Sell",
        }
    })
end
QBCORE
-- === VERSION 2.4.0 ===

local QBCore = exports['qb-core']:GetCoreObject()
Config = {}

Config.Debug = false

/*
    Add this in qb-cityhall config.lua to add the hunting license

    ["hunting_license"] = {
        label = "Hunting License",
        cost = 50,
        metadata = "hunting"
    }

	['huntinglicense'] 				 = {['name'] = 'huntinglicense',				    ['label'] = 'Hunting License',			['weight'] = 0,			['type'] = 'item',		['image'] = 'hunting_license.png',		['unique'] = true,		['useable'] = true,		['shouldClose'] = true,    ['combinable'] = nil,   ['description'] = 'Hunting License'},

	["leather_deer_bad"]					= {['name'] = 'leather_deer_bad', 						['label'] = 'Bad deer leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_deer_bad.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
	["leather_deer_good"]					= {['name'] = 'leather_deer_good', 						['label'] = 'Good deer leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_deer_good.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
	["leather_deer_perfect"]				= {['name'] = 'leather_deer_perfect', 					['label'] = 'Perfect deer leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_deer_perfect.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
        ["leather_boar_bad"]					= {['name'] = 'leather_boar_bad', 						['label'] = 'Bad boar leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_boar_bad.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
	["leather_boar_good"]					= {['name'] = 'leather_boar_good', 						['label'] = 'Good boar leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_boar_good.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
	["leather_boar_perfect"]				= {['name'] = 'leather_boar_perfect', 					['label'] = 'Perfect boar leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_boar_perfect.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
        ["leather_mlion_bad"]					= {['name'] = 'leather_mlion_bad', 						['label'] = 'Bad mountain lion leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_mlion_bad.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'}, 
	["leather_mlion_good"]					= {['name'] = 'leather_mlion_good', 					['label'] = 'Good mountain lion leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_mlion_good.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'}, 
	["leather_mlion_perfect"]				= {['name'] = 'leather_mlion_perfect', 					['label'] = 'Perfect mountain lion leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_mlion_perfect.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'}, 
        ["leather_coyote_bad"]					= {['name'] = 'leather_coyote_bad', 					['label'] = 'Bad coyote leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_coyote_bad.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
	["leather_coyote_good"]					= {['name'] = 'leather_coyote_good', 					['label'] = 'Good coyote leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_coyote_good.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'}, 
	["leather_coyote_perfect"]				= {['name'] = 'leather_coyote_perfect', 				['label'] = 'Perfect coyote leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_coyote_perfect.png', 					['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
  	["leather_rabbit_bad"]					= {['name'] = 'leather_rabbit_bad', 					['label'] = 'Bad rabbit leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_rabbit_bad.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
	["leather_rabbit_good"]					= {['name'] = 'leather_rabbit_good', 					['label'] = 'Good rabbit leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_rabbit_good.png', 					['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
	["leather_rabbit_perfect"]				= {['name'] = 'leather_rabbit_perfect', 				['label'] = 'Perfect rabbit leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_rabbit_perfect.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
 	["leather_cormorant_bad"]				= {['name'] = 'leather_cormorant_bad', 					['label'] = 'Bad cormorant leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_cormorant_bad.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
	["leather_cormorant_good"]				= {['name'] = 'leather_cormorant_good', 				['label'] = 'Good cormorant leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_cormorant_good.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
	["leather_cormorant_perfect"]			= {['name'] = 'leather_cormorant_perfect',				['label'] = 'Perfect cormorant leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_cormorant_perfect.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'}, 
	["leather_chickenhawk_bad"]				= {['name'] = 'leather_chickenhawk_bad', 				['label'] = 'Bad chickenhawl leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_chickenhawk_bad.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
        ["leather_chickenhawk_good"]			= {['name'] = 'leather_chickenhawk_good', 				['label'] = 'Good chickenhawk leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_chickenhawk_good.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},  
        ["leather_chickenhawk_perfect"]			= {['name'] = 'leather_chickenhawk_perfect', 			['label'] = 'Perfect chickenhawk leather', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'leather_chickenhawk_perfect.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},
	["deer_horn"]							= {['name'] = 'deer_horn', 								['label'] = 'Deer Horn', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'deer_horn.png', 									['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},
	["animal_bait"]							= {['name'] = 'animal_bait', 							['label'] = 'Animal bait', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'animal_bait.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},
	["cookedMeat"]							= {['name'] = 'cookedMeat', 							['label'] = 'Cooked Meat', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'cookedMeat.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'},
	["meat"]								= {['name'] = 'meat', 									['label'] = 'Fresh meat', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'meat.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'}
	you can add other meat items for each animals if you want them
        ["coal"]								= {['name'] = 'coal', 									['label'] = 'Coal', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'coal.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'}
	["wood"]								= {['name'] = 'wood', 									['label'] = 'Wood', 					['weight'] = 1000, 		['type'] = 'item', 		['image'] = 'wood.png', 				['unique'] = false, 	['useable'] = false, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = '...'}
*/

-- [GENERAL]:
Config.EnableFootprints     = true
Config.PNearAnimalToEscape  = 20      -- if the distance between a player and the animal is less than this value, it will run away (not for native animals)
Config.CarryAnimals         = true
Config.CarryAnimalsKey      = "G"
Config.WeaponsOnlyHunting   = false   -- if TRUE when you get out of a hunting zone you won't be able to use the weapons
                                      -- only if Config.HuntAllMap FALSE
Config.UseQbTarget          = true

-- [HARVESTING]:
Config.HeadshotForPerfect = true      -- In order to receve the perfect item, you will need to get perfect in Config.WeaponDamages and also kill the animal with an headshot 
Config.TimeToHarvest      = 15000     -- number of milliseconds to complete harvesting
Config.CameraMovement     = true      -- if true camera animation when harvesting animals
Config.MinLeather         = 1         -- the minimum number of leather you can drop
Config.MaxLeather         = 1         -- the maximum number of leather you can drop 
Config.CanDropMeat        = true      -- false if you don't want that animals can drop meat
Config.MeatOfAnimals      = false     -- if true the meat will be different for each animal (see Config.Animals) and not Config.MeatItem, if false it will be Config.MeatItem and the same for all animals
Config.MeatItem           = "meat"    -- item name for meat
Config.MeatCost           = 20        -- price for Config.MeatItem
Config.MinMeat            = 2         -- the minimum number of leather you can drop
Config.MaxMeat            = 3         -- the maximum number of leather you can drop
Config.CanDropSpecial     = true      -- false if you don't want that animals can drop special items (see Config.Animals)
Config.SpecialProb        = 96        -- probability, example: the script generates a random number from 1 to 100, if the random number is higher (>) than this one it will drop (so 10% probability)

-- [BAIT]:
Config.EnableBait           = true
Config.BlipOnBaitAnimal     = true
Config.BaitPlacingTime      = 15000     -- milliseconds
Config.BaitItemName         = "animal_bait"
Config.BaitAnimals          = {"a_c_deer", "a_c_boar", "a_c_mtlion", "a_c_coyote"}  -- animal that can spawn when placing a bait (need to be also in Config.Animals)
Config.TimeForAnimalToLeave = 10000     -- animal once reached bait will wait this time before walking away milliseconds
Config.BaitSpawnRadious     = 200        -- when you place a bait, the animal will spawn in this radious (I raccomend 200) 
Config.TimeBetween          = 120       -- IN SECONDS, time you need to wait before placing another bait


-- [ANIMALS / WEAPONS]:
    -- MODEL: the model of animal you want to spawn / hunt 
    -- BAD/GOOD/PERFECT: the item dropped when harvesting that animal
    -- DIMENSION: size of the animal, you need this with Config.WeaponDamages
    -- MEAT: the meat dropped when harvesting that animal

Config.Animals = {
    {dimension = "big", meat = "deer_meat", meatCost = 100, model = "a_c_deer", bad = "leather_deer_bad", badCost = 100, good = "leather_deer_good", goodCost = 420, perfect = "leather_deer_perfect", perfectCost = 890, hash = -664053099, specialItem = "deer_horn", specialItemCost = 630, isIllegal = false},
    {dimension = "medBig", meat = "boar_meat", meatCost = 100, model = "a_c_boar", bad = "leather_boar_bad", badCost = 100, good = "leather_boar_good", goodCost = 420, perfect = "leather_boar_perfect", perfectCost = 890, hash = -832573324, specialItem = "", specialItemCost = 0, isIllegal = false},
    {dimension = "medBig", meat = "mtlion_meat", meatCost = 100, model = "a_c_mtlion", bad = "leather_mlion_bad", badCost = 100, good = "leather_mlion_good", goodCost = 420, perfect = "leather_mlion_perfect", perfectCost = 890, hash = 307287994, specialItem = "", specialItemCost = 0, isIllegal = true, illegalBadCost = 50, illegalGoodCost = 190, illegalPerfectCost = 430},
    {dimension = "medium", meat = "coyote_meat", meatCost = 100, model = "a_c_coyote", bad = "leather_coyote_bad", badCost = 100, good = "leather_coyote_good", goodCost = 420, perfect = "leather_coyote_perfect", perfectCost = 890, hash = 1682622302, specialItem = "", specialItemCost = 0, isIllegal = true, illegalBadCost = 50, illegalGoodCost = 190, illegalPerfectCost = 430},
    {dimension = "small", meat = "rabbit_meat", meatCost = 100, model = "a_c_rabbit_01", bad = "leather_rabbit_bad", badCost = 100, good = "leather_rabbit_good", goodCost = 420, perfect = "leather_rabbit_perfect", perfectCost = 890, hash = -541762431, specialItem = "", specialItemCost = 0, isIllegal = false},
    {dimension = "medium", meat = "cormorant_meat", meatCost = 100, model = "a_c_cormorant", bad = "leather_cormorant_bad", badCost = 100, good = "leather_cormorant_good", goodCost = 420, perfect = "leather_cormorant_perfect", perfectCost = 890, hash = 1457690978, specialItem = "", specialItemCost = 0, isIllegal = true, illegalBadCost = 50, illegalGoodCost = 190, illegalPerfectCost = 430},
    {dimension = "small", meat = "chickenhawk_meat", meatCost = 100, model = "a_c_chickenhawk", bad = "leather_chickenhawk_bad", badCost = 100, good = "leather_chickenhawk_good", goodCost = 420, perfect = "leather_chickenhawk_perfect", perfectCost = 890, hash = -1430839454, specialItem = "", specialItemCost = 0, isIllegal = true, illegalBadCost = 50, illegalGoodCost = 190, illegalPerfectCost = 430}
}   -- IMPORTANT: dimension name must be one of these "small" / "medium" / "medBig" / "big"
    -- IMPORTANT: you don't have to change hash numbers
    -- IMPORTANT: you need to have bad / good / perfect items in your items database
    -- IMPORTANT: if Config.MeatOfAnimals is true you need to have the meat item in your items database

Config.WeaponDamages = {
    -- According to the type of weapon (category) used to kill the animal, it will drop a certain type of skin based on his size (Config.Animals dimension)
    -- EXAMPLE: if i kill with a sniper a big animal in this case it will give me perfect item
    {category = "unarmed", small = "bad", medium = "bad", medBig = "bad", big = "bad"},
    {category = "melee", small = "bad", medium = "bad", medBig = "bad", big = "bad"},
    {category = "pistol", small = "good", medium = "good", medBig = "bad", big = "bad"},
    {category = "subgun", small = "bad", medium = "bad", medBig = "good", big = "bad"},
    {category = "shootgun", small = "bad", medium = "bad", medBig = "good", big = "bad"},
    {category = "rifle", small = "bad", medium = "bad", medBig = "bad", big = "bad"},
    {category = "snip", small = "bad", medium = "good", medBig = "perfect", big = "perfect"}
}   -- IMPORTANT: you don't have to change category names

Config.NativeAnimal      = false  -- false if you want to spawn your animals (modify AnimalModels) and not use native ones
Config.SpawnAnimalNumber = 10     -- number of animal to spawn if you aren't using native animals
Config.KnifesForHarvest  = {'WEAPON_KNIFE', 'WEAPON_SWITCHBLADE', 'WEAPON_DAGGER'}  -- you can harvest an animal only with these knifes

-- #####################################################################################################################################################################################################################################
-- Before opening a ticket on the server, if the animals don't spawn check this: https://complete-scripts.gitbook.io/complete-scripts/scripts/complete-hunting/common-errors#animals-not-spawning-or-you-dont-see-any-blips-in-the-zone
-- #####################################################################################################################################################################################################################################

-- [HUNTING ZONES]:
Config.huntAllMap  = false  -- TRUE if you want to enable hunting in all the map
                            -- if not using native animals set it to FALSE (if you are using native animals you can still set it to FALSE)
Config.huntPoint   = {
    {id = 0, x = -1133.44, y = 4605.55, z = 144.96},
    {id = 1, x = 1996.02, y = 4982.71, z = 40.63}
}   -- if Config.huntAllMap false you have to decide a point in the map and the radious where you can hunt
    -- !! do not insert the same id twice !!
                            
Config.huntRadious = 300


-- [CAMPFIRE]:
Config.EnableCampfire       = true
Config.UseNativeCampfire    = false
Config.CampfireTimeBetween  = 25         -- IN SECONDS, time you need to wait before cooking again meat (cooking time + time to wait)
Config.CampfireCommand      = "campfire" -- don't put the slash before
Config.CampfireProp         = "prop_beach_fire" -- name for the prop to spawn
Config.CampfireNameItem1    = "coal"     -- name for item1 in crafting
Config.CampfireCountItem1   = 2          -- number of pieces you need for item1
Config.CampfireNameItem2    = "wood"     -- name for item2 in crafting
Config.CampfireCountItem2   = 4          -- number of pieces you need for item2
Config.CampPlacingTime      = 15000      -- milliseconds
Config.KeyCampfireMenu      = "E"        -- ["E"]
Config.CookingTime          = 20000      -- milliseconds
Config.CookedMeatName       = "cookedMeat"
Config.KeyDestroyCampfire   = "G"        -- ["G"]
Config.noCampfireZoneRadious = 1000
Config.noCampfireZone       = {
    {x = -259.24, y = -1900.51, z = 27.76}
}   --you can add multiple of them (remember ",")


-- [SELLING ITEMS]:
Config.MoneyType        = 'cash'                 -- legal items: "cash" or "bank" (see Qb-core config file)
Config.BlackMoneyName   = "markedbills"          -- illegal items: see Qb-core config file
Config.BlackMoneyItem   = false                   -- illegal items: see Qb-core config file
Config.illegalNpcModel  = "a_m_m_og_boss_01"
Config.legalNpcModel    = "s_m_m_ammucountry"
-- see also Config.Animals for prices


-- [BLIPS]:
Config.BlipOnEntity = true  -- if not using native animals 
Config.Blips = {
    {coords = vector3(1208.43, -3228.84, 4.55), name = "Hunting selling zone", sprite = 442, colour = 27},
    {coords = vector3(-1133.44, 4605.55, 144.96), name = "Hunting Zone Radius", sprite = 161, colour = 27},
    {coords = vector3(-1133.44, 4605.55, 144.96), name = "Hunting Zone", sprite = 442, colour = 27}
}
Config.BlipAnimalName = "Animal"
Config.BlipBaitAnimalName = "Bait animal"


-- [LOCATIONS]:
Config.Locations = {
    SellZone = { x = 1208.35, y = -3228.84, z = 5.0 },
    IllegalNPC = { x = 1996.02, y = 4982.71, z = 40.63, h = 219.41}
}


-- [LANGUAGE]:
Config.Text = {
    ['before_harvest']   = 'Press [~g~E~w~] to harvest, [~g~G~w~] to carry',
	['harvesting']       = 'Harvesting animal...',
    ['need_knife']       = 'You need a knife to harvest',
    ['receved_leather']  = 'You receaved leather',
	['ruined_leather']   = 'The leather is too ruined',
	['receved_meat']     = 'You receaved meat',
	['special_item']     = 'You recived a special item',
    ----
    ['campfire']         = 'Press [~g~E~w~] to cook, [~g~G~w~] to remove',
    ['campfire2']        = 'Press [~g~E~w~] to cook',
    ['cooking']          = 'Cooking meat',
    ['placing_campfire'] = 'Placing campfire...',
    ['cant_place_camp']  = "You can't place your campfire here",
    ----
    ['cant_place_bait']  = "You can't place your bait here",
    ['placing_bait']     = 'Placing bait...',
    ['between_bait']     = 'You need to wait before use it again',
	['no_effects_bait']  = 'Your bait had any effects',
    ----
    ['sell_items']       = 'Press [~g~E~w~] to sell',
	['sold']             = 'Successfully sold',
	----
	['no_material']      = "You don't have enough material",
    ['you_didnt_kill_it'] = "You didn't kill the animal"
}
Config.FontType = 4

-- === DISPLAY TEXT ===
-- === Only change if you know what you're doing! === 
RegisterNetEvent('qb_complete_hunting:notify')
AddEventHandler('qb_complete_hunting:notify', function(msg, msgType)
    if not msgType then
        QBCore.Functions.Notify(msg, "inform", 5000)
    else
        QBCore.Functions.Notify(msg, msgType, 5000)
    end
end)

Config.Progressbar = function(cb, text, time, anim_type, anim_dict, anim_lib)
    if anim_type ~= nil then
        local ped = PlayerPedId()
        if anim_type == "anim" then
            RequestAnimDict(anim_dict)
            while not HasAnimDictLoaded(anim_dict) do
                Citizen.Wait(1)
            end
            TaskPlayAnim(ped, anim_dict, anim_lib, -1, -1, -1, 1)
        elseif anim_type == "Scenario" then
            TaskStartScenarioInPlace(ped, anim_dict, 0, true)
        end
    end

    -- QBCORE
    QBCore.Functions.Progressbar('Progress', text, time, false, false, {
        disableMovement = true,
        disableCarMovement = true,
        disableMouse = false,
        disableCombat = true
    }, {}, {}, {}, function() 
        cb("ok")
    end, function() 
        cb("error")
    end)
end

function InitializeTarget()
    /* CODE FOR QB-TARGET */
    local targetModels = {}

    for _,v in ipairs(Config.Animals) do
        table.insert(targetModels, v.model)
    end
    
    exports['qb-target']:AddTargetModel(targetModels, {
        options = {
            {
                num = 1,
                type = "client",
                event = "qb_complete_hunting:harvestAnimal",
                icon = "fas fa-cut",
                label = "Harvest",
            },
            {
                num = 2,
                type = "client",
                event = "qb_complete_hunting:carryAnimal",
                icon = "fas fa-people-carry",
                label = "Carry",
            }
        },
        distance = 2.5
    })

    local campProp = {
        `prop_beach_fire`,
    }

    if Config.EnableCampfire then
        exports['qb-target']:AddTargetModel(campProp, {
            options = {
                {
                    num = 1,
                    type = "client",
                    event = "qb_complete_hunting:cookMenu",
                    icon = "fas fa-hamburger",
                    label = "Cook meat",
                }
            },
            distance = 3.0
        })
    end
    
    local illegalSeller = {
        `a_m_m_og_boss_01`,
    }
    
    exports['qb-target']:AddTargetModel(illegalSeller, {
        options = {
            {
                num = 1,
                type = "client",
                event = "qb_complete_hunting:qbTargetIllegalSell",
                icon = "fas fa-store",
                label = "Sell",
            }
        },
        distance = 3.0
    })

    local legalSeller = {
        `s_m_m_ammucountry`,
    }

    exports['qb-target']:AddTargetModel(legalSeller, {
        options = {
            {
                num = 1,
                type = "client",
                event = "qb_complete_hunting:qbTargetLegalSell",
                icon = "fas fa-store",
                label = "Sell",
            }
        },
        distance = 3.0
    })

    /* CODE FOR OX-TARGET */
    
    --[[ local targetModels = {}

    for _,v in ipairs(Config.Animals) do
        table.insert(targetModels, v.model)
    end
    
    exports.ox_target:addModel(targetModels, {
        {
            name = 'ox:option1',
            event = "qb_complete_hunting:harvestAnimal",
            icon = "fa-solid fa-cut",
            label = "Harvest",
            canInteract = function(entity, distance, coords, name, bone)
                if IsEntityDead(entity) then
                    return true
                else
                    return false
                end
            end
        },
        {
            name = 'ox:option2',
            event = "qb_complete_hunting:carryAnimal",
            icon = "fa-solid fa-people-carry",
            label = "Carry",
            canInteract = function(entity, distance, coords, name, bone)
                if IsEntityDead(entity) then
                    return true
                else
                    return false
                end
            end
        }
    })

    local campProp = {
        `prop_beach_fire`,
    }

    if Config.EnableCampfire then
        exports.ox_target:addModel(campProp, {
            {
                name = 'ox:option1',
                event = "qb_complete_hunting:cookMenu",
                icon = "fa-solid fa-hamburger",
                label = "Cook meat",
            }
        })
    end
    
    local illegalSeller = {
        Config.illegalNpcModel,
    }
    
    exports.ox_target:addModel(illegalSeller, {
        {
            name = 'ox:option1',
            event = "qb_complete_hunting:qbTargetIllegalSell",
            icon = "fa-solid fa-store",
            label = "Sell",
        }
    })

    local legalSeller = {
        Config.legalNpcModel,
    }

    exports.ox_target:addModel(legalSeller, {
        {
            name = 'ox:option1',
            event = "qb_complete_hunting:qbTargetLegalSell",
            icon = "fa-solid fa-store",
            label = "Sell",
        }
    }) ]]
    
end
```
PreviousComplete HuntingNextCommon errors

Last updated 1 year ago

Was this helpful?

💻