From 10b4083960bdb543a32b9202d8206a08ada5952b Mon Sep 17 00:00:00 2001 From: dazuga31 <62469328+dazuga31@users.noreply.github.com> Date: Thu, 2 Jan 2025 11:35:29 +0000 Subject: [PATCH] Update client.lua use modern notify --- modules/weapon/client.lua | 44 ++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/modules/weapon/client.lua b/modules/weapon/client.lua index 2234840..c0f63da 100644 --- a/modules/weapon/client.lua +++ b/modules/weapon/client.lua @@ -92,28 +92,44 @@ CreateThread(function() while true do local wait = 1000 local ped = PlayerPedId() - if not IsPlayerDead(ped) and not IsPedInAnyVehicle(ped, true) then - for k,v in pairs(ThrownWeapons) do - if NetworkDoesNetworkIdExist(v.net_id) then + if not IsPlayerDead(ped) and not IsPedInAnyVehicle(ped, true) then + for k, v in pairs(ThrownWeapons) do + if NetworkDoesNetworkIdExist(v.net_id) then local entity = NetToObj(v.net_id) local coords = GetEntityCoords(entity) local dist = #(GetEntityCoords(ped) - coords) - if dist < 5.0 then + if dist < 5.0 then wait = 0 - if dist < 1.25 and not ShowInteractText(_L("pickup_weapon")) and IsControlJustPressed(1, 51) then - ClearPedTasksImmediately(ped) - FreezeEntityPosition(ped, true) - PlayAnim(ped, "pickup_object", "pickup_low", -8.0, 8.0, -1, 49, 1.0) - Wait(800) - TriggerServerEvent("pickle_weaponthrowing:pickupWeapon", k) - Wait(800) - ClearPedTasks(ped) - FreezeEntityPosition(ped, false) + if dist < 1.25 then + HelpNotify(_L("pickup_weapon"), HelpNotifyType, coords) + local keybind = string.upper(Config.ThrowKeybind) -- Робимо ключ чутливим до регістру + local controlIndex = GetKeyIndex(keybind) -- Отримуємо відповідний індекс для клавіші + if controlIndex and IsControlJustPressed(1, controlIndex) then + ClearPedTasksImmediately(ped) + FreezeEntityPosition(ped, true) + PlayAnim(ped, "pickup_object", "pickup_low", -8.0, 8.0, -1, 49, 1.0) + Wait(800) + TriggerServerEvent("pickle_weaponthrowing:pickupWeapon", k) + Wait(800) + ClearPedTasks(ped) + FreezeEntityPosition(ped, false) + end end end end - end + end end Wait(wait) end end) + +-- Функція для перетворення клавіші в індекс +function GetKeyIndex(key) + local keys = { + ["E"] = 51, + ["F"] = 23, + ["G"] = 47, + -- Додайте інші ключі за потреби + } + return keys[key] or nil +end