Discord + +Copyright (C) 2024 bitpredator + +This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version. + +This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details. + +ATTENTION: +You are not authorized to change the name of the resource and the resources within it. + +If you want to contribute you can open a pull request. + +You are not authorized to sell this software (this is free project). + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. + +# Dependancy: +rprogress + +https://forum.cfx.re/t/release-standalone-rprogress-customisable-radial-progress-bars/1630655 \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_hunting/bpt_hunting.sql b/server-data/resources/[bpt_addons]/bpt_hunting/bpt_hunting.sql new file mode 100644 index 000000000..74e196161 --- /dev/null +++ b/server-data/resources/[bpt_addons]/bpt_hunting/bpt_hunting.sql @@ -0,0 +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); \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_hunting/client/functions.lua b/server-data/resources/[bpt_addons]/bpt_hunting/client/functions.lua new file mode 100644 index 000000000..05843c5a6 --- /dev/null +++ b/server-data/resources/[bpt_addons]/bpt_hunting/client/functions.lua @@ -0,0 +1,18 @@ +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 + SetTextScale(scale, scale) + SetTextFont(4) + SetTextProportional(1) + SetTextColour(255, 255, 255, 215) + SetTextOutline() + SetTextEntry("STRING") + SetTextCentre(1) + AddTextComponentString(text) + DrawText(_x, _y) + local _ = (string.len(text)) / 650 + end +end diff --git a/server-data/resources/[bpt_addons]/bpt_hunting/client/main.lua b/server-data/resources/[bpt_addons]/bpt_hunting/client/main.lua new file mode 100644 index 000000000..5228dd171 --- /dev/null +++ b/server-data/resources/[bpt_addons]/bpt_hunting/client/main.lua @@ -0,0 +1,135 @@ +ESX = exports["es_extended"]:getSharedObject() + +local oPlayer = false +local playerpos = false + +CreateThread(function() + while true do + oPlayer = PlayerPedId() + playerpos = GetEntityCoords(oPlayer) + Wait(500) + end +end) + +CreateThread(function() + while true do + Wait(1) + local handle, ped = FindFirstPed() + local success + repeat + success, ped = FindNextPed(handle) + 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, "[H] ~b~Skin Animal ~s~") + while IsControlPressed(0, 30) 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 - 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 = { + animationDictionary = "anim@heists@narcotics@funding@gang_idle", + 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" + local p_name = TranslateCap("boar_meat") + TriggerServerEvent("bpt_hunting:getPelt", item, p_name) + elseif GetEntityModel(ped) == GetHashKey("a_c_mtlion") then + local item = "pelt_mtnlion" + local p_name = TranslateCap("pelt_mtnlion") + TriggerServerEvent("bpt_hunting:getPelt", item, p_name) + elseif GetEntityModel(ped) == GetHashKey("a_c_deer") then + local item = "deer_meat" + local p_name = TranslateCap("deer_meat") + TriggerServerEvent("bpt_hunting:getPelt", item, p_name) + elseif GetEntityModel(ped) == GetHashKey("a_c_coyote") then + local item = "pelt_coyote" + local p_name = TranslateCap("pelt_coyote") + TriggerServerEvent("bpt_hunting:getPelt", item, p_name) + elseif GetEntityModel(ped) == GetHashKey("a_c_rabbit_01") then + local item = "rabbit_meat" + local p_name = TranslateCap("rabbit_meat") + TriggerServerEvent("bpt_hunting:getPelt", item, p_name) + end + Wait(10) + SetPedAsNoLongerNeeded(oldped) + if DoesEntityExist(ped) then + DeleteEntity(ped) + end + Wait(1000) + break + else + ESX.ShowNotification(TranslateCap("knife_uses")) + end + end + end + until not success + EndFindPed(handle) + 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 + end + return false +end + +local blips = { + { title = "Hunters Den", colour = 4, id = 463, x = -1132.93, y = 4948.42, z = 221.87 }, +} + +CreateThread(function() + for _, info in pairs(blips) do + info.blip = AddBlipForCoord(info.x, info.y, info.z) + SetBlipSprite(info.blip, info.id) + SetBlipDisplay(info.blip, 4) + SetBlipScale(info.blip, 0.8) + SetBlipColour(info.blip, info.colour) + SetBlipAsShortRange(info.blip, true) + BeginTextCommandSetBlipName("STRING") + AddTextComponentString(info.title) + EndTextCommandSetBlipName(info.blip) + end +end) diff --git a/server-data/resources/[bpt_addons]/bpt_hunting/config.lua b/server-data/resources/[bpt_addons]/bpt_hunting/config.lua new file mode 100644 index 000000000..adb7fc406 --- /dev/null +++ b/server-data/resources/[bpt_addons]/bpt_hunting/config.lua @@ -0,0 +1,2 @@ +Config = {} +Config.Locale = "en" diff --git a/server-data/resources/[bpt_addons]/bpt_hunting/fxmanifest.lua b/server-data/resources/[bpt_addons]/bpt_hunting/fxmanifest.lua new file mode 100644 index 000000000..22dbe4167 --- /dev/null +++ b/server-data/resources/[bpt_addons]/bpt_hunting/fxmanifest.lua @@ -0,0 +1,22 @@ +fx_version("adamant") +games({ "gta5" }) + +author("bitpredator") +description("bpt_hunting") +version("1.0.0") + +shared_script("@es_extended/imports.lua") + +client_scripts({ + "@es_extended/locale.lua", + "client/*.lua", + "locales/*.lua", + "config.lua", +}) + +server_scripts({ + "@es_extended/locale.lua", + "locales/*.lua", + "config.lua", + "server/*.lua", +}) diff --git a/server-data/resources/[bpt_addons]/bpt_hunting/locales/en.lua b/server-data/resources/[bpt_addons]/bpt_hunting/locales/en.lua new file mode 100644 index 000000000..831f4866b --- /dev/null +++ b/server-data/resources/[bpt_addons]/bpt_hunting/locales/en.lua @@ -0,0 +1,9 @@ +Locales["en"] = { + ["knife_uses"] = "You need to use a knife", + ["you_collected"] = "You picked up a", + ["deer_meat"] = "Deer meat", + ["boar_meat"] = "Boar meat", + ["pelt_mtnlion"] = "Mountain Lion pelt", + ["pelt_coyote"] = "Pelt Coyote", + ["rabbit_meat"] = "Rabbit meat", +} diff --git a/server-data/resources/[bpt_addons]/bpt_hunting/locales/it.lua b/server-data/resources/[bpt_addons]/bpt_hunting/locales/it.lua new file mode 100644 index 000000000..5ba349a75 --- /dev/null +++ b/server-data/resources/[bpt_addons]/bpt_hunting/locales/it.lua @@ -0,0 +1,9 @@ +Locales["it"] = { + ["knife_uses"] = "Devi usare un coltello", + ["you_collected"] = "Hai raccolto un", + ["deer_meat"] = "Carne di cervo", + ["boar_meat"] = "Carne di cinghiale", + ["pelt_mtnlion"] = "Pelle di leone di montagna", + ["pelt_coyote"] = "Pelle di coyote", + ["rabbit_meat"] = "Carne di coniglio", +}