From c5447b28b52f7f6368650c33c405926e779b51b8 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Thu, 7 Sep 2023 22:55:25 +0200 Subject: [PATCH 1/5] chore: (BOBsHunt) initial reconstruction --- .../[esx_addons]/BOBsHunt/client/functions.lua | 10 +++++----- .../[esx_addons]/BOBsHunt/client/main.lua | 16 +++++++--------- .../[esx_addons]/BOBsHunt/items-legacy.sql | 4 +--- .../resources/[esx_addons]/BOBsHunt/items.sql | 4 +--- .../[esx_addons]/BOBsHunt/locales/it.lua | 1 + .../[esx_addons]/BOBsHunt/server/main.lua | 7 ++----- 6 files changed, 17 insertions(+), 25 deletions(-) diff --git a/server-data/resources/[esx_addons]/BOBsHunt/client/functions.lua b/server-data/resources/[esx_addons]/BOBsHunt/client/functions.lua index 20a6450d2..d65430ee9 100644 --- a/server-data/resources/[esx_addons]/BOBsHunt/client/functions.lua +++ b/server-data/resources/[esx_addons]/BOBsHunt/client/functions.lua @@ -1,9 +1,9 @@ drawText3D = function(x, y, z, text) - local onScreen,_x,_y=World3dToScreen2d(x,y,z) - local px,py,pz=table.unpack(GetGameplayCamCoords()) - + local onScreen, _x, _y = World3dToScreen2d(x,y,z) + local _, _, _ = table.unpack(GetGameplayCamCoords()) + local scale = 0.30 - + if onScreen then SetTextScale(scale, scale) SetTextFont(4) @@ -14,7 +14,7 @@ drawText3D = function(x, y, z, text) SetTextCentre(1) AddTextComponentString(text) DrawText(_x,_y) - local factor = (string.len(text)) / 650 + local _ = (string.len(text)) / 650 --DrawRect(_x, _y + 0.0120, 0.030 + factor , 0.030, 66, 66, 66, 100) end end \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua b/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua index 084f958a7..eebde5a8c 100644 --- a/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua +++ b/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua @@ -2,9 +2,7 @@ ESX = nil CreateThread(function() while ESX == nil do Wait(5) - ESX = exports["es_extended"]:getSharedObject(), function(library) - ESX = library - end + ESX = exports["es_extended"]:getSharedObject() end if ESX.IsPlayerLoaded() then ESX.PlayerData = ESX.GetPlayerData() @@ -34,11 +32,11 @@ CreateThread(function() local pos = GetEntityCoords(ped) local distance = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, playerpos.x, playerpos.y, playerpos.z, true) if distance < 2 and CanSlaughterPed(ped) then - drawText3D(pos.x, pos.y, pos.z + 0.6, '⚙️') + drawText3D(pos.x, pos.y, pos.z + 0.6, '⚙️') while IsControlPressed(0, 38) do drawText3D(pos.x, pos.y, pos.z + 0.5, '[H] ~b~Skin Animal~s~') break - end + end if IsControlJustPressed(1,74) then if GetSelectedPedWeapon(PlayerPedId()) == GetHashKey('WEAPON_KNIFE') then oldped = ped @@ -94,19 +92,19 @@ CreateThread(function() local p_name = 'Rabbit meat' TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) end - + Wait(10) SetPedAsNoLongerNeeded(oldped) if DoesEntityExist(ped) then - DeleteEntity(ped) - end + DeleteEntity(ped) + end Wait(1000) break else ESX.showNotification(_U('knife_uses')) end end - end + end until not success EndFindPed(handle) end diff --git a/server-data/resources/[esx_addons]/BOBsHunt/items-legacy.sql b/server-data/resources/[esx_addons]/BOBsHunt/items-legacy.sql index 7b9706b76..a5dfd147f 100644 --- a/server-data/resources/[esx_addons]/BOBsHunt/items-legacy.sql +++ b/server-data/resources/[esx_addons]/BOBsHunt/items-legacy.sql @@ -1,8 +1,6 @@ - - INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('pelt_boar', 'Boar Pelt', 1, 0, 1), ('pelt_mtnlion', 'Mountain Lion Pelt', 1, 0, 1), ('pelt_deer', 'Deer Pelt', 1, 0, 1), ('pelt_coyote', 'Coyote Pelt', 1, 0, 1), -('pelt_rabbit', 'Rabbit Pelt', 1, 0, 1); +('pelt_rabbit', 'Rabbit Pelt', 1, 0, 1); \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/BOBsHunt/items.sql b/server-data/resources/[esx_addons]/BOBsHunt/items.sql index 09825adeb..0b9ad7f3f 100644 --- a/server-data/resources/[esx_addons]/BOBsHunt/items.sql +++ b/server-data/resources/[esx_addons]/BOBsHunt/items.sql @@ -1,8 +1,6 @@ - - INSERT INTO `items` (`name`, `label`, `limit`, `rare`, `can_remove`) VALUES ('pelt_boar', 'Boar Pelt', 10, 0, 1), ('pelt_mtnlion', 'Mountain Lion Pelt', 10, 0, 1), ('pelt_deer', 'Deer Pelt', 10, 0, 1), ('pelt_coyote', 'Coyote Pelt', 10, 0, 1), -('pelt_rabbit', 'Rabbit Pelt', 10, 0, 1); +('pelt_rabbit', 'Rabbit Pelt', 10, 0, 1); \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/BOBsHunt/locales/it.lua b/server-data/resources/[esx_addons]/BOBsHunt/locales/it.lua index 44ffbc1c3..6767cb95d 100644 --- a/server-data/resources/[esx_addons]/BOBsHunt/locales/it.lua +++ b/server-data/resources/[esx_addons]/BOBsHunt/locales/it.lua @@ -1,4 +1,5 @@ Locales['en'] = { ['knife_uses'] = 'Devi usare un coltello', ['you_collected'] = 'Hai raccolto un', + ['deer_meat'] = 'Deer meat', } \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/BOBsHunt/server/main.lua b/server-data/resources/[esx_addons]/BOBsHunt/server/main.lua index 8317f450e..614e3c211 100644 --- a/server-data/resources/[esx_addons]/BOBsHunt/server/main.lua +++ b/server-data/resources/[esx_addons]/BOBsHunt/server/main.lua @@ -1,8 +1,5 @@ ESX = nil - -ESX = exports["es_extended"]:getSharedObject(), function(response) - ESX = response -end +ESX = exports["es_extended"]:getSharedObject() RegisterServerEvent('esx_bobhunt:getPelt') AddEventHandler('esx_bobhunt:getPelt', function(item, p_name) @@ -10,4 +7,4 @@ AddEventHandler('esx_bobhunt:getPelt', function(item, p_name) local xPlayer = ESX.GetPlayerFromId(_source) xPlayer.addInventoryItem(item, 10) TriggerClientEvent('esx:showNotification', source, _U('you_collected') .. p_name) -end) +end) \ No newline at end of file From 0bffa57c1230f1b837b69f2f1a38b02c40e455f2 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Fri, 8 Sep 2023 11:51:25 +0200 Subject: [PATCH 2/5] chore fix error --- .../resources/[esx_addons]/BOBsHunt/client/main.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua b/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua index eebde5a8c..26adc7e35 100644 --- a/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua +++ b/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua @@ -10,13 +10,11 @@ CreateThread(function() end) local oPlayer = false -local InVehicle = false local playerpos = false CreateThread(function() while(true) do oPlayer = PlayerPedId() - InVehicle = IsPedInAnyVehicle(oPlayer, true) playerpos = GetEntityCoords(oPlayer) Wait(500) end @@ -32,14 +30,14 @@ CreateThread(function() local pos = GetEntityCoords(ped) local distance = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, playerpos.x, playerpos.y, playerpos.z, true) if distance < 2 and CanSlaughterPed(ped) then - drawText3D(pos.x, pos.y, pos.z + 0.6, '⚙️') + drawText3D(pos.x, pos.y, pos.z + 0.6, '⚙️') while IsControlPressed(0, 38) do drawText3D(pos.x, pos.y, pos.z + 0.5, '[H] ~b~Skin Animal~s~') break end if IsControlJustPressed(1,74) then if GetSelectedPedWeapon(PlayerPedId()) == GetHashKey('WEAPON_KNIFE') then - oldped = ped + local oldped = ped SetEntityHeading(ped,GetHeadingFromVector_2d(pos.x-playerpos.x,pos.y-playerpos.y)+180) SetEntityHeading(oPlayer,GetHeadingFromVector_2d(pos.x-playerpos.x,pos.y-playerpos.y)) exports.rprogress:Custom({ @@ -81,7 +79,7 @@ CreateThread(function() TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) elseif GetEntityModel(ped) == GetHashKey("a_c_deer") then local item = 'deer_meat' - local p_name = 'deer_meat' + local p_name = 'deer meat' TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) elseif GetEntityModel(ped) == GetHashKey("a_c_coyote") then local item = 'pelt_coyote' @@ -101,7 +99,7 @@ CreateThread(function() Wait(1000) break else - ESX.showNotification(_U('knife_uses')) + ESX.showNotification(_U('knife_uses')) end end end @@ -111,7 +109,7 @@ CreateThread(function() end) function CanSlaughterPed(ped) - if not IsPedAPlayer(ped) and not IsPedInAnyVehicle(ped,false) and not IsPedHuman(ped) and IsEntityDead(ped) and ped ~= oldped and GetEntityModel(ped) == GetHashKey("a_c_boar") or GetEntityModel(ped) == GetHashKey("a_c_coyote") or GetEntityModel(ped) == GetHashKey("a_c_deer") or GetEntityModel(ped) == GetHashKey("a_c_mtlion") or GetEntityModel(ped) == GetHashKey("a_c_rabbit_01") then + if not IsPedAPlayer(ped) and not IsPedInAnyVehicle(ped,false) and not IsPedHuman(ped) and IsEntityDead(ped) and ped ~= oldped and GetEntityModel(ped) == GetHashKey("a_c_boar") or GetEntityModel(ped) == GetHashKey("a_c_coyote") or GetEntityModel(ped) == GetHashKey("a_c_deer") or GetEntityModel(ped) == GetHashKey("a_c_mtlion") or GetEntityModel(ped) == GetHashKey("a_c_rabbit_01") then return true end return false From 851f126f2b61387046606f673a9049232ee794d1 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Fri, 8 Sep 2023 12:12:58 +0200 Subject: [PATCH 3/5] chore: fix hologram drawText3d --- .../[esx_addons]/BOBsHunt/client/main.lua | 53 ++++++++++--------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua b/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua index 26adc7e35..83aca0553 100644 --- a/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua +++ b/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua @@ -30,9 +30,8 @@ CreateThread(function() local pos = GetEntityCoords(ped) local distance = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, playerpos.x, playerpos.y, playerpos.z, true) if distance < 2 and CanSlaughterPed(ped) then - drawText3D(pos.x, pos.y, pos.z + 0.6, '⚙️') - while IsControlPressed(0, 38) do - drawText3D(pos.x, pos.y, pos.z + 0.5, '[H] ~b~Skin Animal~s~') + drawText3D(pos.x, pos.y, pos.z + 0.6, '⚙️ [H] ~b~Skin Animal~s~') + while IsControlPressed(0, 38) do break end if IsControlJustPressed(1,74) then @@ -41,33 +40,35 @@ CreateThread(function() SetEntityHeading(ped,GetHeadingFromVector_2d(pos.x-playerpos.x,pos.y-playerpos.y)+180) SetEntityHeading(oPlayer,GetHeadingFromVector_2d(pos.x-playerpos.x,pos.y-playerpos.y)) exports.rprogress:Custom({ - Async = true, - x = 0.5, - y = 0.5, - From = 0, - To = 100, - Duration = 5000, - Radius = 60, - Stroke = 10, - MaxAngle = 360, - Rotation = 0, - Easing = "easeLinear", - Label = "SKINNING", - LabelPosition = "right", - Color = "rgba(255, 255, 255, 1.0)", - BGColor = "rgba(107, 109, 110, 0.95)", - Animation = { - --scenario = "CODE_HUMAN_MEDIC_TEND_TO_DEAD", -- https://pastebin.com/6mrYTdQv - animationDictionary = "anim@heists@narcotics@funding@gang_idle", -- https://alexguirre.github.io/animations-list/ - animationName = "gang_chatting_idle01", - }, - DisableControls = { + Async = true, + x = 0.5, + y = 0.5, + From = 0, + To = 100, + Duration = 5000, + Radius = 60, + Stroke = 10, + MaxAngle = 360, + Rotation = 0, + Easing = "easeLinear", + Label = "SKINNING", + LabelPosition = "right", + Color = "rgba(255, 255, 255, 1.0)", + BGColor = "rgba(107, 109, 110, 0.95)", + Animation = { + --scenario = "CODE_HUMAN_MEDIC_TEND_TO_DEAD", -- https://pastebin.com/6mrYTdQv + animationDictionary = "anim@heists@narcotics@funding@gang_idle", -- https://alexguirre.github.io/animations-list/ + animationName = "gang_chatting_idle01", + }, + + DisableControls = { Mouse = false, Player = true, Vehicle = true - }, - }) + }, + }) Wait(5000) + ClearPedTasks(PlayerPedId()) if GetEntityModel(ped) == GetHashKey("a_c_boar") then local item = 'boar_meat' From 67021d951d793f902152d9ad385647323371b6f1 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Fri, 8 Sep 2023 20:36:27 +0200 Subject: [PATCH 4/5] chore: new fix --- .../[esx_addons]/BOBsHunt/client/main.lua | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua b/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua index 83aca0553..0c76eaa64 100644 --- a/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua +++ b/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua @@ -70,27 +70,27 @@ CreateThread(function() Wait(5000) ClearPedTasks(PlayerPedId()) - if GetEntityModel(ped) == GetHashKey("a_c_boar") then - local item = 'boar_meat' - local p_name = 'boar meat' - TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) - elseif GetEntityModel(ped) == GetHashKey("a_c_mtlion") then - local item = 'pelt_mtnlion' - local p_name = 'Mountain Lion pelt' - TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) - elseif GetEntityModel(ped) == GetHashKey("a_c_deer") then - local item = 'deer_meat' - local p_name = 'deer meat' - TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) - elseif GetEntityModel(ped) == GetHashKey("a_c_coyote") then - local item = 'pelt_coyote' - local p_name = 'Coyote pelt' - TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) - elseif GetEntityModel(ped) == GetHashKey("a_c_rabbit_01") then - local item = 'rabbit_meat' - local p_name = 'Rabbit meat' - TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) - end + if GetEntityModel(ped) == GetHashKey("a_c_boar") then + local item = 'boar_meat' + local p_name = 'boar meat' + TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) + elseif GetEntityModel(ped) == GetHashKey("a_c_mtlion") then + local item = 'pelt_mtnlion' + local p_name = 'Mountain Lion pelt' + TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) + elseif GetEntityModel(ped) == GetHashKey("a_c_deer") then + local item = 'deer_meat' + local p_name = 'deer meat' + TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) + elseif GetEntityModel(ped) == GetHashKey("a_c_coyote") then + local item = 'pelt_coyote' + local p_name = 'Coyote pelt' + TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) + elseif GetEntityModel(ped) == GetHashKey("a_c_rabbit_01") then + local item = 'rabbit_meat' + local p_name = 'Rabbit meat' + TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) + end Wait(10) SetPedAsNoLongerNeeded(oldped) @@ -109,6 +109,7 @@ CreateThread(function() end end) +local oldped function CanSlaughterPed(ped) if not IsPedAPlayer(ped) and not IsPedInAnyVehicle(ped,false) and not IsPedHuman(ped) and IsEntityDead(ped) and ped ~= oldped and GetEntityModel(ped) == GetHashKey("a_c_boar") or GetEntityModel(ped) == GetHashKey("a_c_coyote") or GetEntityModel(ped) == GetHashKey("a_c_deer") or GetEntityModel(ped) == GetHashKey("a_c_mtlion") or GetEntityModel(ped) == GetHashKey("a_c_rabbit_01") then return true From 35ba6c020e11a0b8f04c630b33ac9e029712587b Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Fri, 8 Sep 2023 20:48:48 +0200 Subject: [PATCH 5/5] chore: fix formatting code --- .../BOBsHunt/client/functions.lua | 2 - .../[esx_addons]/BOBsHunt/client/main.lua | 134 +++++++++--------- 2 files changed, 67 insertions(+), 69 deletions(-) diff --git a/server-data/resources/[esx_addons]/BOBsHunt/client/functions.lua b/server-data/resources/[esx_addons]/BOBsHunt/client/functions.lua index d65430ee9..15db50343 100644 --- a/server-data/resources/[esx_addons]/BOBsHunt/client/functions.lua +++ b/server-data/resources/[esx_addons]/BOBsHunt/client/functions.lua @@ -1,7 +1,6 @@ drawText3D = function(x, y, z, text) local onScreen, _x, _y = World3dToScreen2d(x,y,z) local _, _, _ = table.unpack(GetGameplayCamCoords()) - local scale = 0.30 if onScreen then @@ -15,6 +14,5 @@ drawText3D = function(x, y, z, text) AddTextComponentString(text) DrawText(_x,_y) local _ = (string.len(text)) / 650 - --DrawRect(_x, _y + 0.0120, 0.030 + factor , 0.030, 66, 66, 66, 100) end end \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua b/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua index 0c76eaa64..a587f976c 100644 --- a/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua +++ b/server-data/resources/[esx_addons]/BOBsHunt/client/main.lua @@ -32,78 +32,78 @@ CreateThread(function() if distance < 2 and CanSlaughterPed(ped) then drawText3D(pos.x, pos.y, pos.z + 0.6, '⚙️ [H] ~b~Skin Animal~s~') while IsControlPressed(0, 38) do - break - end - if IsControlJustPressed(1,74) then - if GetSelectedPedWeapon(PlayerPedId()) == GetHashKey('WEAPON_KNIFE') then - local oldped = ped - SetEntityHeading(ped,GetHeadingFromVector_2d(pos.x-playerpos.x,pos.y-playerpos.y)+180) - SetEntityHeading(oPlayer,GetHeadingFromVector_2d(pos.x-playerpos.x,pos.y-playerpos.y)) - exports.rprogress:Custom({ - Async = true, - x = 0.5, - y = 0.5, - From = 0, - To = 100, - Duration = 5000, - Radius = 60, - Stroke = 10, - MaxAngle = 360, - Rotation = 0, - Easing = "easeLinear", - Label = "SKINNING", - LabelPosition = "right", - Color = "rgba(255, 255, 255, 1.0)", - BGColor = "rgba(107, 109, 110, 0.95)", - Animation = { - --scenario = "CODE_HUMAN_MEDIC_TEND_TO_DEAD", -- https://pastebin.com/6mrYTdQv - animationDictionary = "anim@heists@narcotics@funding@gang_idle", -- https://alexguirre.github.io/animations-list/ - animationName = "gang_chatting_idle01", - }, - - DisableControls = { - Mouse = false, - Player = true, - Vehicle = true - }, - }) - Wait(5000) + break + end + if IsControlJustPressed(1,74) then + if GetSelectedPedWeapon(PlayerPedId()) == GetHashKey('WEAPON_KNIFE') then + local oldped = ped + SetEntityHeading(ped,GetHeadingFromVector_2d(pos.x-playerpos.x,pos.y-playerpos.y)+180) + SetEntityHeading(oPlayer,GetHeadingFromVector_2d(pos.x-playerpos.x,pos.y-playerpos.y)) + exports.rprogress:Custom({ + Async = true, + x = 0.5, + y = 0.5, + From = 0, + To = 100, + Duration = 5000, + Radius = 60, + Stroke = 10, + MaxAngle = 360, + Rotation = 0, + Easing = "easeLinear", + Label = "SKINNING", + LabelPosition = "right", + Color = "rgba(255, 255, 255, 1.0)", + BGColor = "rgba(107, 109, 110, 0.95)", + Animation = { + --scenario = "CODE_HUMAN_MEDIC_TEND_TO_DEAD", -- https://pastebin.com/6mrYTdQv + animationDictionary = "anim@heists@narcotics@funding@gang_idle", -- https://alexguirre.github.io/animations-list/ + animationName = "gang_chatting_idle01", + }, - ClearPedTasks(PlayerPedId()) - if GetEntityModel(ped) == GetHashKey("a_c_boar") then - local item = 'boar_meat' - local p_name = 'boar meat' - TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) - elseif GetEntityModel(ped) == GetHashKey("a_c_mtlion") then - local item = 'pelt_mtnlion' - local p_name = 'Mountain Lion pelt' - TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) - elseif GetEntityModel(ped) == GetHashKey("a_c_deer") then - local item = 'deer_meat' - local p_name = 'deer meat' - TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) - elseif GetEntityModel(ped) == GetHashKey("a_c_coyote") then - local item = 'pelt_coyote' - local p_name = 'Coyote pelt' - TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) - elseif GetEntityModel(ped) == GetHashKey("a_c_rabbit_01") then - local item = 'rabbit_meat' - local p_name = 'Rabbit meat' - TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) - end + DisableControls = { + Mouse = false, + Player = true, + Vehicle = true + }, + }) + Wait(5000) - Wait(10) - SetPedAsNoLongerNeeded(oldped) - if DoesEntityExist(ped) then - DeleteEntity(ped) - end - Wait(1000) - break - else - ESX.showNotification(_U('knife_uses')) + ClearPedTasks(PlayerPedId()) + if GetEntityModel(ped) == GetHashKey("a_c_boar") then + local item = 'boar_meat' + local p_name = 'boar meat' + TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) + elseif GetEntityModel(ped) == GetHashKey("a_c_mtlion") then + local item = 'pelt_mtnlion' + local p_name = 'Mountain Lion pelt' + TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) + elseif GetEntityModel(ped) == GetHashKey("a_c_deer") then + local item = 'deer_meat' + local p_name = 'deer meat' + TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) + elseif GetEntityModel(ped) == GetHashKey("a_c_coyote") then + local item = 'pelt_coyote' + local p_name = 'Coyote pelt' + TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) + elseif GetEntityModel(ped) == GetHashKey("a_c_rabbit_01") then + local item = 'rabbit_meat' + local p_name = 'Rabbit meat' + TriggerServerEvent('esx_bobhunt:getPelt', item, p_name) end + + Wait(10) + SetPedAsNoLongerNeeded(oldped) + if DoesEntityExist(ped) then + DeleteEntity(ped) end + Wait(1000) + break + else + ESX.showNotification(_U('knife_uses')) + end end + end until not success EndFindPed(handle) end