ESX Free-range Hunting. BT-Target/Polyzone system

Simple and Effective system to allow any available animal on the map be subject to skinning, and a baked in method to deal with the aftermath. Features a spawnable ped thanks to @DRKM43 , or a preconfigured location to sell your meat and leather.

Credit due to @qalle for his original script used as inspiration.

Short of the dependencies :

  • PolyZone

  • bt-target

  • mythic_notify

  • mythic_progbar

  • there is an excerpt inside of bt-target you may need to add if wishing to vet the activity through requirement of a knife in hand

locate this block inside of bt-target/client/main.lua and edit

function playerTargetEnable()
    if success then return end
    local playerPed = PlayerPedId()
    if IsPedArmed(playerPed, 4) then return end <---- this line from IsPedArmed(playerPed, 6)
    local nearestVehicle = GetNearestVehicle()

If you do not already have this function/export in bt-target this can be added as well

function AddTargetModel(models, parameteres)
    for _, model in pairs(models) do
        Models[model] = parameteres
    end
end
exports("AddTargetModel", AddTargetModel)

there are no other outside influences required, everything included in the script should work fine out of the box, there is no attached job requirements and you are free to use whatever weaponry you like to dispatch your game, vehicle related death notwithstanding.

Features:

  • Indexed list of available animal peds which are allowed to be targeted and skinned.
  • mythic_progbar prevents execution of multiple attempted interactions at once.
  • Bodies should be synced between players, the player whomst killed, shall be the player whomst ‘loots’
  • Low performance impact; resmon shows 0.00/ms and 0.12% cpu load locally, will spike to normal bt-target load when hovering over an animal in it’s respective resource.
  • Entity checks for selling, you will be required to remain a certain distance from the ped/store location to interact.
  • Immortal god of animal pelts and accessories, so griefing should not be an issue (redundant marker right behind initial location set for sale of items.
  • Predefined interaction requires a WEAPON_KNIFE to be equipped, but this could be changed or disabled depending on your needs and requirements.

Known Issues/Bugs/Scuffiness

  1. The Animations are sort of janky, but serviceable, there could be some more optimizations put forward
  2. If you say run an animal into another object it may not produce the prompt to skin(this is an issue mostly to do with the way it grabs the closest model, in my case I am using a tree modifcation but foliage occasionally makes the script very unhappy)
  3. Alerts when you cannot carry any more are misbehaving, a small issue, but noteable nonetheless.

I do try to stay on top of bugs and address them as I find and squish them. This is currently designed to work with ESX Legacy, but may work for other branches as well, there is an included sql file to choose your poison. If using a version outside of Legacy, the server sided checks may need adjusted to fit your needs I can poke around other versions and see about a config file.





13 Likes

+big REP

Looks amazing! Will defo be using this


this error when trying to skin

managed to fix this but now the game just crashes when i skin the animal also bug with if animal is dead

what ESX are you using, and do you have OneSync Enabled?

Hi I am experiencing an issue where i can click on it to butcher the animal but nothing happens it does not go into my inventory or anything and i have followed the instructions does anyone know what’s wrong.

This animal is not dead or this is not your kill , all the time

There is an updated client file for those not running ESX Legacy (or having issues grabbing the nearest ped). Grab the updated version, select the cliffnoted client file, rename it, or(if you do not want to rename it for some reason) just adjust the fxmanifest to reflect the ~other file~

  • This method will remove kill validation, and uses a workaround to remove the animal after it’s been interacted with in the short term.
  • Both updated client files have the correct playerCoords local placed in the right order, which was causing an issue.

Grab the updated file.

I tried before and after update but its just looping the animation when skinning for me, it doesnt seen to pass function(status)
I’m using linden inv, his esx fork and multi.

Interesting, I haven’t experienced this yet, have you cleared the server sided cache? If so, begin adding prints between each action. preferably one directly after

if not status then
                                                        print('jobs done') -- etc
							ClearPedTasksImmediately(PlayerPedId())
                                                       print('let me go') -- etc
							local AnimalWeight = math.random(200) / 10
							exports['mythic_notify']:SendAlert('inform', 'You have slaughtered an animal yielding a total of ' ..AnimalWeight.. 'kg of meat and leather.', 6500)
							isButchering = false
							TriggerServerEvent('hunting:rewardShit', AnimalWeight) -- Thnx Qalle!
							Citizen.Wait(150)
							TriggerServerEvent('hunting:SkinIt')
							SetEntityAsMissionEntity(closestAnimal, true, true)
							SetEntityAsNoLongerNeeded(closestAnimal)
							DeleteEntity(closestAnimal)

and track down which portion is not firing, and if needed you can set the mythic_progbar bools to false.

It turns out it was the fork of bt-target i was using, i fixed that but had to comment out

   --if success then return end

in bt-target. it was causing a crash, im not sure if it will cause other issues but it works now.
Also when i was testing only lindens branch of mythic_probar seemed to fire for me when skinning.
Apart from my user error this resource is great, thank alot.

still got one issue with the mythic notify

what availabe exports are in your mythic_notify?

if you do not have SendAlert you can either add it

RegisterNetEvent('mythic_notify:client:SendAlert')
AddEventHandler('mythic_notify:client:SendAlert', function(data)
	SendAlert(data.type, data.text, data.length, data.style)
end)
function SendAlert(type, text, length, style)
	SendNUIMessage({
		type = type,
		text = text,
		length = length,
		style = style
	})
end

and edit the resource__ or fxmanifest.lua

here

exports {
	'SendAlert',

Or change the export to one you have already

no worries, you can slot that inside mythic_notify/client/main.lua

let me test to see if it works i am in my server right now give me a sec.

ok getting no errors but still nothing happens no skinning no nothing unsure what the issue is now.

ok it is saying this animal is not dead or is not your kill.

Then you are not using the correct version of ESX for that method, that’s fine, there is a secondary file attached to the github that you can utilize that will bypass some of the limitations of a missing ESX.Game.GetClosestPed(coords,modelFilter)

try renaming the current client/main.lua to something else, and renaming or requesting main-olderesx.lua