From 931cd134dcd878374a5007f05127f4a2af6fc449 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:18:24 +0200 Subject: [PATCH 1/3] =?UTF-8?q?chore:=20(esx=5Fmechnicjob)=20=F0=9F=8E=A8?= =?UTF-8?q?=20Run=20formatter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../esx_mechanicjob/client/main.lua | 6 +- .../esx_mechanicjob/server/main.lua | 202 +++++++++--------- 2 files changed, 99 insertions(+), 109 deletions(-) diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua index 6edbb1c2e..fc3268128 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua @@ -47,8 +47,6 @@ function StopNPCJob(cancel) if cancel then ESX.ShowNotification(TranslateCap('mission_canceled'), "error") - else - --TriggerServerEvent('esx_mechanicjob:onNPCJobCompleted') end end @@ -65,7 +63,7 @@ function OpenMechanicActionsMenu() if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name == 'boss' then elements[#elements+1] = { icon = 'fas fa-boss', - title = TranslateCap('boss_actions'), + title = TranslateCap('boss_actions'), value = 'boss_actions' } end @@ -109,7 +107,7 @@ function OpenMechanicActionsMenu() if Config.EnablePlayerManagement and ESX.PlayerData.job and (ESX.PlayerData.job.grade_name == 'boss' or ESX.PlayerData.job.grade_name == 'chief' or ESX.PlayerData.job.grade_name == 'experimente') then elements2[#elements2+1] = { icon = 'fas fa-truck', - title = 'Slamvan', + title = 'Slamvan', value = 'slamvan3' } end diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua index 4f8db9667..abd66bc76 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua @@ -1,288 +1,280 @@ -local PlayersHarvesting, PlayersHarvesting2, PlayersHarvesting3, PlayersCrafting, PlayersCrafting2, PlayersCrafting3 = {}, {}, {}, {}, {}, {} +local PlayersHarvesting, PlayersHarvesting2, PlayersHarvesting3, PlayersCrafting, PlayersCrafting2, PlayersCrafting3 = + {}, {}, {}, {}, {}, {} if Config.MaxInService ~= -1 then - TriggerEvent('esx_service:activateService', 'mechanic', Config.MaxInService) + TriggerEvent("esx_service:activateService", "mechanic", Config.MaxInService) end -TriggerEvent('esx_phone:registerNumber', 'mechanic', TranslateCap('mechanic_customer'), true, true) -TriggerEvent('esx_society:registerSociety', 'mechanic', 'mechanic', 'society_mechanic', 'society_mechanic', 'society_mechanic', {type = 'private'}) +TriggerEvent("esx_phone:registerNumber", "mechanic", TranslateCap("mechanic_customer"), true, true) +TriggerEvent("esx_society:registerSociety", "mechanic", "mechanic", "society_mechanic", "society_mechanic", "society_mechanic", + { + type = "private" + } +) local function Harvest(source) SetTimeout(4000, function() - if PlayersHarvesting[source] == true then local xPlayer = ESX.GetPlayerFromId(source) - local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count + local GazBottleQuantity = xPlayer.getInventoryItem("gazbottle").count if GazBottleQuantity >= 5 then - TriggerClientEvent('esx:showNotification', source, TranslateCap('you_do_not_room')) + TriggerClientEvent("esx:showNotification", source, TranslateCap("you_do_not_room")) else - xPlayer.addInventoryItem('gazbottle', 1) + xPlayer.addInventoryItem("gazbottle", 1) Harvest(source) end end - end) end -RegisterServerEvent('esx_mechanicjob:startHarvest') -AddEventHandler('esx_mechanicjob:startHarvest', function() +RegisterServerEvent("esx_mechanicjob:startHarvest") +AddEventHandler("esx_mechanicjob:startHarvest", function() local source = source PlayersHarvesting[source] = true - TriggerClientEvent('esx:showNotification', source, TranslateCap('recovery_gas_can')) + TriggerClientEvent("esx:showNotification", source, TranslateCap("recovery_gas_can")) Harvest(source) end) -RegisterServerEvent('esx_mechanicjob:stopHarvest') -AddEventHandler('esx_mechanicjob:stopHarvest', function() +RegisterServerEvent("esx_mechanicjob:stopHarvest") +AddEventHandler("esx_mechanicjob:stopHarvest", function() local source = source PlayersHarvesting[source] = false end) local function Harvest2(source) SetTimeout(4000, function() - if PlayersHarvesting2[source] == true then local xPlayer = ESX.GetPlayerFromId(source) - local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count + local FixToolQuantity = xPlayer.getInventoryItem("fixtool").count if FixToolQuantity >= 5 then - TriggerClientEvent('esx:showNotification', source, TranslateCap('you_do_not_room')) + TriggerClientEvent("esx:showNotification", source, TranslateCap("you_do_not_room")) else - xPlayer.addInventoryItem('fixtool', 1) + xPlayer.addInventoryItem("fixtool", 1) Harvest2(source) end end - end) end -RegisterServerEvent('esx_mechanicjob:startHarvest2') -AddEventHandler('esx_mechanicjob:startHarvest2', function() +RegisterServerEvent("esx_mechanicjob:startHarvest2") +AddEventHandler("esx_mechanicjob:startHarvest2", function() local source = source PlayersHarvesting2[source] = true - TriggerClientEvent('esx:showNotification', source, TranslateCap('recovery_repair_tools')) + TriggerClientEvent("esx:showNotification", source, TranslateCap("recovery_repair_tools")) Harvest2(source) end) -RegisterServerEvent('esx_mechanicjob:stopHarvest2') -AddEventHandler('esx_mechanicjob:stopHarvest2', function() +RegisterServerEvent("esx_mechanicjob:stopHarvest2") +AddEventHandler("esx_mechanicjob:stopHarvest2", function() local source = source PlayersHarvesting2[source] = false end) local function Harvest3(source) SetTimeout(4000, function() - if PlayersHarvesting3[source] == true then local xPlayer = ESX.GetPlayerFromId(source) - local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count + local CaroToolQuantity = xPlayer.getInventoryItem("carotool").count if CaroToolQuantity >= 5 then - TriggerClientEvent('esx:showNotification', source, TranslateCap('you_do_not_room')) + TriggerClientEvent("esx:showNotification", source, TranslateCap("you_do_not_room")) else - xPlayer.addInventoryItem('carotool', 1) + xPlayer.addInventoryItem("carotool", 1) Harvest3(source) end end - end) end -RegisterServerEvent('esx_mechanicjob:startHarvest3') -AddEventHandler('esx_mechanicjob:startHarvest3', function() +RegisterServerEvent("esx_mechanicjob:startHarvest3") +AddEventHandler("esx_mechanicjob:startHarvest3", function() local source = source PlayersHarvesting3[source] = true - TriggerClientEvent('esx:showNotification', source, TranslateCap('recovery_body_tools')) + TriggerClientEvent("esx:showNotification", source, TranslateCap("recovery_body_tools")) Harvest3(source) end) -RegisterServerEvent('esx_mechanicjob:stopHarvest3') -AddEventHandler('esx_mechanicjob:stopHarvest3', function() +RegisterServerEvent("esx_mechanicjob:stopHarvest3") +AddEventHandler("esx_mechanicjob:stopHarvest3", function() local source = source PlayersHarvesting3[source] = false end) local function Craft(source) SetTimeout(4000, function() - if PlayersCrafting[source] == true then local xPlayer = ESX.GetPlayerFromId(source) - local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count + local GazBottleQuantity = xPlayer.getInventoryItem("gazbottle").count if GazBottleQuantity <= 0 then - TriggerClientEvent('esx:showNotification', source, TranslateCap('not_enough_gas_can')) + TriggerClientEvent("esx:showNotification", source, TranslateCap("not_enough_gas_can")) else - xPlayer.removeInventoryItem('gazbottle', 1) - xPlayer.addInventoryItem('blowpipe', 1) + xPlayer.removeInventoryItem("gazbottle", 1) + xPlayer.addInventoryItem("blowpipe", 1) Craft(source) end end - end) end -RegisterServerEvent('esx_mechanicjob:startCraft') -AddEventHandler('esx_mechanicjob:startCraft', function() +RegisterServerEvent("esx_mechanicjob:startCraft") +AddEventHandler("esx_mechanicjob:startCraft", function() local source = source PlayersCrafting[source] = true - TriggerClientEvent('esx:showNotification', source, TranslateCap('assembling_blowtorch')) + TriggerClientEvent("esx:showNotification", source, TranslateCap("assembling_blowtorch")) Craft(source) end) -RegisterServerEvent('esx_mechanicjob:stopCraft') -AddEventHandler('esx_mechanicjob:stopCraft', function() +RegisterServerEvent("esx_mechanicjob:stopCraft") +AddEventHandler("esx_mechanicjob:stopCraft", function() local source = source PlayersCrafting[source] = false end) local function Craft2(source) SetTimeout(4000, function() - if PlayersCrafting2[source] == true then local xPlayer = ESX.GetPlayerFromId(source) - local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count + local FixToolQuantity = xPlayer.getInventoryItem("fixtool").count if FixToolQuantity <= 0 then - TriggerClientEvent('esx:showNotification', source, TranslateCap('not_enough_repair_tools')) + TriggerClientEvent("esx:showNotification", source, TranslateCap("not_enough_repair_tools")) else - xPlayer.removeInventoryItem('fixtool', 1) - xPlayer.addInventoryItem('fixkit', 1) + xPlayer.removeInventoryItem("fixtool", 1) + xPlayer.addInventoryItem("fixkit", 1) Craft2(source) end end - end) end -RegisterServerEvent('esx_mechanicjob:startCraft2') -AddEventHandler('esx_mechanicjob:startCraft2', function() +RegisterServerEvent("esx_mechanicjob:startCraft2") +AddEventHandler("esx_mechanicjob:startCraft2", function() local source = source PlayersCrafting2[source] = true - TriggerClientEvent('esx:showNotification', source, TranslateCap('assembling_repair_kit')) + TriggerClientEvent("esx:showNotification", source, TranslateCap("assembling_repair_kit")) Craft2(source) end) -RegisterServerEvent('esx_mechanicjob:stopCraft2') -AddEventHandler('esx_mechanicjob:stopCraft2', function() +RegisterServerEvent("esx_mechanicjob:stopCraft2") +AddEventHandler("esx_mechanicjob:stopCraft2", function() local source = source PlayersCrafting2[source] = false end) local function Craft3(source) SetTimeout(4000, function() - if PlayersCrafting3[source] == true then local xPlayer = ESX.GetPlayerFromId(source) - local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count + local CaroToolQuantity = xPlayer.getInventoryItem("carotool").count if CaroToolQuantity <= 0 then - TriggerClientEvent('esx:showNotification', source, TranslateCap('not_enough_body_tools')) + TriggerClientEvent("esx:showNotification", source, TranslateCap("not_enough_body_tools")) else - xPlayer.removeInventoryItem('carotool', 1) - xPlayer.addInventoryItem('carokit', 1) + xPlayer.removeInventoryItem("carotool", 1) + xPlayer.addInventoryItem("carokit", 1) Craft3(source) end end - end) end -RegisterServerEvent('esx_mechanicjob:startCraft3') -AddEventHandler('esx_mechanicjob:startCraft3', function() +RegisterServerEvent("esx_mechanicjob:startCraft3") +AddEventHandler("esx_mechanicjob:startCraft3", function() local source = source PlayersCrafting3[source] = true - TriggerClientEvent('esx:showNotification', source, TranslateCap('assembling_body_kit')) + TriggerClientEvent("esx:showNotification", source, TranslateCap("assembling_body_kit")) Craft3(source) end) -RegisterServerEvent('esx_mechanicjob:stopCraft3') -AddEventHandler('esx_mechanicjob:stopCraft3', function() +RegisterServerEvent("esx_mechanicjob:stopCraft3") +AddEventHandler("esx_mechanicjob:stopCraft3", function() local source = source PlayersCrafting3[source] = false end) -RegisterServerEvent('esx_mechanicjob:onNPCJobMissionCompleted') -AddEventHandler('esx_mechanicjob:onNPCJobMissionCompleted', function() +RegisterServerEvent("esx_mechanicjob:onNPCJobMissionCompleted") +AddEventHandler("esx_mechanicjob:onNPCJobMissionCompleted", function() local source = source local xPlayer = ESX.GetPlayerFromId(source) - local total = math.random(Config.NPCJobEarnings.min, Config.NPCJobEarnings.max); + local total = math.random(Config.NPCJobEarnings.min, Config.NPCJobEarnings.max) if xPlayer.job.grade >= 3 then total = total * 2 end - TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account) + TriggerEvent("esx_addonaccount:getSharedAccount", "society_mechanic", function(account) account.addMoney(total) end) - TriggerClientEvent("esx:showNotification", source, TranslateCap('your_comp_earned').. total) + TriggerClientEvent("esx:showNotification", source, TranslateCap("your_comp_earned") .. total) end) -ESX.RegisterUsableItem('blowpipe', function(source) +ESX.RegisterUsableItem("blowpipe", function(source) local source = source - local xPlayer = ESX.GetPlayerFromId(source) + local xPlayer = ESX.GetPlayerFromId(source) - xPlayer.removeInventoryItem('blowpipe', 1) + xPlayer.removeInventoryItem("blowpipe", 1) - TriggerClientEvent('esx_mechanicjob:onHijack', source) - TriggerClientEvent('esx:showNotification', source, TranslateCap('you_used_blowtorch')) + TriggerClientEvent("esx_mechanicjob:onHijack", source) + TriggerClientEvent("esx:showNotification", source, TranslateCap("you_used_blowtorch")) end) -ESX.RegisterUsableItem('fixkit', function(source) +ESX.RegisterUsableItem("fixkit", function(source) local source = source - local xPlayer = ESX.GetPlayerFromId(source) + local xPlayer = ESX.GetPlayerFromId(source) - xPlayer.removeInventoryItem('fixkit', 1) + xPlayer.removeInventoryItem("fixkit", 1) - TriggerClientEvent('esx_mechanicjob:onFixkit', source) - TriggerClientEvent('esx:showNotification', source, TranslateCap('you_used_repair_kit')) + TriggerClientEvent("esx_mechanicjob:onFixkit", source) + TriggerClientEvent("esx:showNotification", source, TranslateCap("you_used_repair_kit")) end) -ESX.RegisterUsableItem('carokit', function(source) +ESX.RegisterUsableItem("carokit", function(source) local source = source - local xPlayer = ESX.GetPlayerFromId(source) + local xPlayer = ESX.GetPlayerFromId(source) - xPlayer.removeInventoryItem('carokit', 1) + xPlayer.removeInventoryItem("carokit", 1) - TriggerClientEvent('esx_mechanicjob:onCarokit', source) - TriggerClientEvent('esx:showNotification', source, TranslateCap('you_used_body_kit')) + TriggerClientEvent("esx_mechanicjob:onCarokit", source) + TriggerClientEvent("esx:showNotification", source, TranslateCap("you_used_body_kit")) end) -RegisterServerEvent('esx_mechanicjob:getStockItem') -AddEventHandler('esx_mechanicjob:getStockItem', function(itemName, count) +RegisterServerEvent("esx_mechanicjob:getStockItem") +AddEventHandler("esx_mechanicjob:getStockItem", function(itemName, count) local xPlayer = ESX.GetPlayerFromId(source) - TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mechanic', function(inventory) + TriggerEvent("esx_addoninventory:getSharedInventory", "society_mechanic", function(inventory) local item = inventory.getItem(itemName) -- is there enough in the society? if count > 0 and item.count >= count then - -- can the player carry the said amount of x item? if xPlayer.canCarryItem(itemName, count) then inventory.removeItem(itemName, count) xPlayer.addInventoryItem(itemName, count) - xPlayer.showNotification(TranslateCap('have_withdrawn', count, item.label)) + xPlayer.showNotification(TranslateCap("have_withdrawn", count, item.label)) else - xPlayer.showNotification(TranslateCap('player_cannot_hold')) + xPlayer.showNotification(TranslateCap("player_cannot_hold")) end else - xPlayer.showNotification(TranslateCap('invalid_quantity')) + xPlayer.showNotification(TranslateCap("invalid_quantity")) end end) end) -ESX.RegisterServerCallback('esx_mechanicjob:getStockItems', function(source, cb) - TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mechanic', function(inventory) +ESX.RegisterServerCallback("esx_mechanicjob:getStockItems", function(source, cb) + TriggerEvent("esx_addoninventory:getSharedInventory", "society_mechanic", function(inventory) cb(inventory.items) end) end) -RegisterServerEvent('esx_mechanicjob:putStockItems') -AddEventHandler('esx_mechanicjob:putStockItems', function(itemName, count) +RegisterServerEvent("esx_mechanicjob:putStockItems") +AddEventHandler("esx_mechanicjob:putStockItems", function(itemName, count) local xPlayer = ESX.GetPlayerFromId(source) - TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mechanic', function(inventory) + TriggerEvent("esx_addoninventory:getSharedInventory", "society_mechanic", function(inventory) local item = inventory.getItem(itemName) local playerItemCount = xPlayer.getInventoryItem(itemName).count @@ -290,16 +282,16 @@ AddEventHandler('esx_mechanicjob:putStockItems', function(itemName, count) xPlayer.removeInventoryItem(itemName, count) inventory.addItem(itemName, count) else - xPlayer.showNotification(TranslateCap('invalid_quantity')) + xPlayer.showNotification(TranslateCap("invalid_quantity")) end - xPlayer.showNotification(TranslateCap('have_deposited', count, item.label)) + xPlayer.showNotification(TranslateCap("have_deposited", count, item.label)) end) end) -ESX.RegisterServerCallback('esx_mechanicjob:getPlayerInventory', function(source, cb) - local xPlayer = ESX.GetPlayerFromId(source) - local items = xPlayer.inventory +ESX.RegisterServerCallback("esx_mechanicjob:getPlayerInventory", function(source, cb) + local xPlayer = ESX.GetPlayerFromId(source) + local items = xPlayer.inventory - cb({items = items}) + cb({ items = items }) end) From cd0f8210e810f544f74154b749a1fbbf29031be4 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:38:57 +0200 Subject: [PATCH 2/3] chore: (bpt_menu) remove the clothes/accessory management as it is present in esx-radialmenu --- .../[bpt_addons]/bpt_menu/client/main.lua | 159 ------------------ .../dependencies/menu/elements/ItemsBadge.lua | 1 - .../[bpt_addons]/bpt_menu/locales/br.lua | 19 --- .../[bpt_addons]/bpt_menu/locales/de.lua | 19 --- .../[bpt_addons]/bpt_menu/locales/en.lua | 19 --- .../[bpt_addons]/bpt_menu/locales/es.lua | 19 --- .../[bpt_addons]/bpt_menu/locales/fr.lua | 20 --- .../[bpt_addons]/bpt_menu/locales/it.lua | 15 -- 8 files changed, 271 deletions(-) diff --git a/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua b/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua index 9dccc8a03..6ecb83174 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/client/main.lua @@ -2,8 +2,6 @@ local PersonalMenu = { ItemSelected = {}, ItemIndex = {}, BillData = {}, - ClothesButtons = { "torso", "pants", "shoes", "bag", "bproof" }, - AccessoriesButtons = { "ears", "glasses", "helmet", "mask" }, DoorState = { FrontLeft = false, FrontRight = false, @@ -102,8 +100,6 @@ local function getPersonalMenuCategory(id) return personalMenuCategoriesById[id] end -local clothesCategory = addPersonalMenuCategory("clothes", TranslateCap("clothes_title")) -addPersonalMenuCategory("accessories", TranslateCap("accessories_title")) local animationCategory = addPersonalMenuCategory("animation", TranslateCap("animation_title")) addPersonalMenuCategory("vehicle", TranslateCap("vehicle_title"), function() @@ -221,123 +217,6 @@ function startAnimAction(animDict, animName) RemoveAnimDict(animDict) end -function setClothes(clotheId) - TriggerServerCallback("esx_skin:getPlayerSkin", function(skin) - TriggerEvent("skinchanger:getSkin", function(currentSkin) - local clothes = nil - - if clotheId == "torso" then - startAnimAction("clothingtie", "try_tie_neutral_a") - Wait(1000) - PlayerVars.handsup, PlayerVars.pointing = false, false - ClearPedTasks(plyPed) - - if skin.torso_1 ~= currentSkin.torso_1 then - clothes = { - ["torso_1"] = skin.torso_1, - ["torso_2"] = skin.torso_2, - ["tshirt_1"] = skin.tshirt_1, - ["tshirt_2"] = skin.tshirt_2, - ["arms"] = skin.arms, - } - else - clothes = { ["torso_1"] = 15, ["torso_2"] = 0, ["tshirt_1"] = 15, ["tshirt_2"] = 0, ["arms"] = 15 } - end - elseif clotheId == "pants" then - if skin.pants_1 ~= currentSkin.pants_1 then - clothes = { ["pants_1"] = skin.pants_1, ["pants_2"] = skin.pants_2 } - else - if skin.sex == 0 then - clothes = { ["pants_1"] = 61, ["pants_2"] = 1 } - else - clothes = { ["pants_1"] = 15, ["pants_2"] = 0 } - end - end - elseif clotheId == "shoes" then - if skin.shoes_1 ~= currentSkin.shoes_1 then - clothes = { ["shoes_1"] = skin.shoes_1, ["shoes_2"] = skin.shoes_2 } - else - if skin.sex == 0 then - clothes = { ["shoes_1"] = 34, ["shoes_2"] = 0 } - else - clothes = { ["shoes_1"] = 35, ["shoes_2"] = 0 } - end - end - elseif clotheId == "bag" then - if skin.bags_1 ~= currentSkin.bags_1 then - clothes = { ["bags_1"] = skin.bags_1, ["bags_2"] = skin.bags_2 } - else - clothes = { ["bags_1"] = 0, ["bags_2"] = 0 } - end - elseif clotheId == "bproof" then - startAnimAction("clothingtie", "try_tie_neutral_a") - Wait(1000) - PlayerVars.handsup, PlayerVars.pointing = false, false - ClearPedTasks(plyPed) - - if skin.bproof_1 ~= currentSkin.bproof_1 then - clothes = { ["bproof_1"] = skin.bproof_1, ["bproof_2"] = skin.bproof_2 } - else - clothes = { ["bproof_1"] = 0, ["bproof_2"] = 0 } - end - end - - TriggerEvent("skinchanger:loadClothes", currentSkin, clothes) - end) - end) -end - -function setAccessory(accessoryId) - TriggerServerCallback("esx_accessories:get", function(hasAccessory, accessorySkin) - if not hasAccessory then - local localeKey = ("accessories_no_%s"):format(accessoryId) - GameNotification(TranslateCap(localeKey)) - return - end - - TriggerEvent("skinchanger:getSkin", function(currentSkin) - local propIdx = -1 - local propTex = 0 - - if accessoryId == "ears" then - startAnimAction("mini@ears_defenders", "takeoff_earsdefenders_idle") - Wait(250) - PlayerVars.handsup, PlayerVars.pointing = false, false - ClearPedTasks(plyPed) - elseif accessoryId == "glasses" then - startAnimAction("clothingspecs", "try_glasses_positive_a") - Wait(1000) - PlayerVars.handsup, PlayerVars.pointing = false, false - ClearPedTasks(plyPed) - elseif accessoryId == "helmet" then - startAnimAction("missfbi4", "takeoff_mask") - Wait(1000) - PlayerVars.handsup, PlayerVars.pointing = false, false - ClearPedTasks(plyPed) - elseif accessoryId == "mask" then - propIdx = 0 - startAnimAction("missfbi4", "takeoff_mask") - Wait(850) - PlayerVars.handsup, PlayerVars.pointing = false, false - ClearPedTasks(plyPed) - end - - local accessoryIdxKey = ("%s_1"):format(accessoryId) - local accessoryTexKey = ("%s_2"):format(accessoryId) - - if currentSkin[accessoryIdxKey] == 0 then - propIdx = accessorySkin[accessoryIdxKey] - propTex = accessorySkin[accessoryTexKey] - end - - TriggerEvent("skinchanger:loadClothes", currentSkin, { - [accessoryIdxKey] = propIdx, - [accessoryTexKey] = propTex, - }) - end) - end, firstToUpper(accessoryId)) -end - function CheckQuantity(number) number = tonumber(number) if type(number) ~= "number" then @@ -395,44 +274,6 @@ function DrawPersonalMenu() end) end -getPersonalMenuCategory("clothes").drawer = function() - for i = 1, #PersonalMenu.ClothesButtons do - local clotheId = PersonalMenu.ClothesButtons[i] - - RageUI.Button( - TranslateCap(("clothes_%s"):format(clotheId)), - nil, - { RightBadge = RageUI.BadgeStyle.Clothes }, - true, - function(Hovered, Active, Selected) - if not Selected then - return - end - setClothes(clotheId) - end - ) - end -end - -getPersonalMenuCategory("accessories").drawer = function() - for i = 1, #PersonalMenu.AccessoriesButtons do - local accessoryId = PersonalMenu.AccessoriesButtons[i] - - RageUI.Button( - TranslateCap(("accessories_%s"):format(accessoryId)), - nil, - { RightBadge = RageUI.BadgeStyle.Clothes }, - true, - function(Hovered, Active, Selected) - if not Selected then - return - end - setAccessory(accessoryId) - end - ) - end -end - getPersonalMenuCategory("animation").drawer = function() for i = 1, #Config.Animations do local animationCfg = Config.Animations[i] diff --git a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/elements/ItemsBadge.lua b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/elements/ItemsBadge.lua index 1a2da3262..483fa18db 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/elements/ItemsBadge.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/dependencies/menu/elements/ItemsBadge.lua @@ -8,7 +8,6 @@ RageUI.BadgeStyle = { Ammo = 7, Armour = 8, Barber = 9, - Clothes = 10, Franklin = 11, Bike = 12, Car = 13, diff --git a/server-data/resources/[bpt_addons]/bpt_menu/locales/br.lua b/server-data/resources/[bpt_addons]/bpt_menu/locales/br.lua index 484c23229..c32bf8bd0 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/locales/br.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/locales/br.lua @@ -23,10 +23,6 @@ Locales["br"] = { ["gave_ammo"] = "Você deu x%s munições para %s", ["no_ammo"] = "Você não tem munição", ["not_enough_ammo"] = "Você não tem tantas munições", - ["accessories_no_ears"] = "Vous ne possédez pas d'Accessoire d'Oreilles", - ["accessories_no_glasses"] = "Você não tem um óculos", - ["accessories_no_helmet"] = "Você não tem um capacete / chapéu", - ["accessories_no_mask"] = "Você não tem uma máscara", ["admin_noclipon"] = "NoClip ~g~ativado", ["admin_noclipoff"] = "NoClip ~r~desativado", ["admin_godmodeon"] = "Godmod ~g~ativado", @@ -50,21 +46,6 @@ Locales["br"] = { ["voice_normal"] = "Normal", ["voice_cry"] = "Gritar", - -- Clothes Menu - ["clothes_title"] = "Vestuário", - ["clothes_torso"] = "Peito", - ["clothes_pants"] = "Pernas", - ["clothes_shoes"] = "Sapatos", - ["clothes_bag"] = "Sac", - ["clothes_bproof"] = "Colete", - - -- Accessories Menu - ["accessories_title"] = "Acessórios", - ["accessories_ears"] = "Accessórios para as Orelhas", - ["accessories_glasses"] = "Óculos", - ["accessories_helmet"] = "Chapeú / Capacete", - ["accessories_mask"] = "Mascará", - -- Animation Menu ["animation_title"] = "Animações", diff --git a/server-data/resources/[bpt_addons]/bpt_menu/locales/de.lua b/server-data/resources/[bpt_addons]/bpt_menu/locales/de.lua index 57bd2a2e8..1042a11c9 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/locales/de.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/locales/de.lua @@ -23,10 +23,6 @@ Locales["de"] = { ["gave_ammo"] = "Du hast x %s Munition an %s gegeben", ["no_ammo"] = "Du hast keine Munition", ["not_enough_ammo"] = "Du hast nicht so viel Munition", - ["accessories_no_ears"] = "Du hast kein Ohr Zubehör", - ["accessories_no_glasses"] = "Du hast keine Brille", - ["accessories_no_helmet"] = "Du hast keinen Helm/Hut", - ["accessories_no_mask"] = "Du hast keine Maske", ["admin_noclipon"] = "NoClip ~g~ aktiviert", ["admin_noclipoff"] = "NoClip ~r~ deaktiviert", ["admin_godmodeon"] = "Invincible ~g~ aktiviert", @@ -50,21 +46,6 @@ Locales["de"] = { ["voice_normal"] = "Normal", ["voice_cry"] = "Schreien", - -- Clothes Menu - ["clothes_title"] = "Kleidungsmenü", - ["clothes_torso"] = "Oberteil", - ["clothes_pants"] = "Hose", - ["clothes_shoes"] = "Schuhe", - ["clothes_bag"] = "Rucksack", - ["clothes_bproof"] = "Schusssichere Weste", - - -- Accessories Menu - ["accessories_title"] = "Zubehör", - ["accessories_ears"] = "Ohren Zubehör", - ["accessories_glasses"] = "Brille", - ["accessories_helmet"] = "Hut / Helm", - ["accessories_mask"] = "Maske", - -- Animation Menu ["animation_title"] = "Animationen", diff --git a/server-data/resources/[bpt_addons]/bpt_menu/locales/en.lua b/server-data/resources/[bpt_addons]/bpt_menu/locales/en.lua index 8e7be6e5a..126da8052 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/locales/en.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/locales/en.lua @@ -23,10 +23,6 @@ Locales["en"] = { ["gave_ammo"] = "You have given x %s ammo to %s", ["no_ammo"] = "You do not have any ammo", ["not_enough_ammo"] = "You do not have as many ammo", - ["accessories_no_ears"] = "You do not have an ear accessory", - ["accessories_no_glasses"] = "You do not have glasses", - ["accessories_no_helmet"] = "You do not have a helmet / hat", - ["accessories_no_mask"] = "You do not have a mask", ["admin_noclipon"] = "NoClip ~g~ enabled", ["admin_noclipoff"] = "NoClip ~r~ disabled", ["admin_godmodeon"] = "Invincible ~g~ enabled", @@ -50,21 +46,6 @@ Locales["en"] = { ["voice_normal"] = "Normal", ["voice_cry"] = "Shout", - -- Clothes Menu - ["clothes_title"] = "Clothing", - ["clothes_torso"] = "High", - ["clothes_pants"] = "Pants", - ["clothes_shoes"] = "Shoes", - ["clothes_bag"] = "Bag", - ["clothes_bproof"] = "Bullet proof vest", - - -- Accessories Menu - ["accessories_title"] = "Accessories", - ["accessories_ears"] = "Ears Accessory", - ["accessories_glasses"] = "Glasses", - ["accessories_helmet"] = "Hat / Helmet", - ["accessories_mask"] = "Mask", - -- Animation Menu ["animation_title"] = "Animations", ["animation_party_title"] = "Festivals", diff --git a/server-data/resources/[bpt_addons]/bpt_menu/locales/es.lua b/server-data/resources/[bpt_addons]/bpt_menu/locales/es.lua index e26eef086..102044eed 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/locales/es.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/locales/es.lua @@ -23,10 +23,6 @@ Locales["es"] = { ["gave_ammo"] = "Distes x %s munición a %s", ["no_ammo"] = "No tienes munición", ["not_enough_ammo"] = "No tienes suficiente munición", - ["accessories_no_ears"] = "No tienes un accesorio de oreja", - ["accessories_no_glasses"] = "No tienes gafas", - ["accessories_no_helmet"] = "No tienes casco / gorra / gorro", - ["accessories_no_mask"] = "No tienes una máscara", ["admin_noclipon"] = "NoClip ~g~ habilitado", ["admin_noclipoff"] = "NoClip ~r~ deshabilitado", ["admin_godmodeon"] = "Invencible ~g~ habilitado", @@ -50,21 +46,6 @@ Locales["es"] = { ["voice_normal"] = "Normal", ["voice_cry"] = "Gritar", - -- Clothes Menu - ["clothes_title"] = "Ropa", - ["clothes_torso"] = "Torso", - ["clothes_pants"] = "Pantalones", - ["clothes_shoes"] = "Zapatos", - ["clothes_bag"] = "Bolso/a", - ["clothes_bproof"] = "Chaleco Anti-Balas", - - -- Accessories Menu - ["accessories_title"] = "Accesorios", - ["accessories_ears"] = "Accesorios de oreja", - ["accessories_glasses"] = "Gafas", - ["accessories_helmet"] = "Gorra / Casco", - ["accessories_mask"] = "Máscara", - -- Animation Menu ["animation_title"] = "Animaciones", ["animation_party_title"] = "Festivales", diff --git a/server-data/resources/[bpt_addons]/bpt_menu/locales/fr.lua b/server-data/resources/[bpt_addons]/bpt_menu/locales/fr.lua index 69ac9af70..5dc143e62 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/locales/fr.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/locales/fr.lua @@ -23,10 +23,6 @@ Locales["fr"] = { ["gave_ammo"] = "Vous avez donné x%s munitions à %s", ["no_ammo"] = "Vous ne possédez pas de munitions", ["not_enough_ammo"] = "Vous ne possédez pas autant de munitions", - ["accessories_no_ears"] = "Vous ne possédez pas d'accessoire d'oreilles", - ["accessories_no_glasses"] = "Vous ne possédez pas de lunettes", - ["accessories_no_helmet"] = "Vous ne possédez pas de casque / chapeau", - ["accessories_no_mask"] = "Vous ne possédez pas de masque", ["admin_noclipon"] = "NoClip ~g~activé", ["admin_noclipoff"] = "NoClip ~r~désactivé", ["admin_godmodeon"] = "Mode invincible ~g~activé", @@ -50,24 +46,8 @@ Locales["fr"] = { ["voice_normal"] = "Normal", ["voice_cry"] = "Crier", - -- Clothes Menu - ["clothes_title"] = "Vêtements", - ["clothes_torso"] = "Haut", - ["clothes_pants"] = "Bas", - ["clothes_shoes"] = "Chaussures", - ["clothes_bag"] = "Sac", - ["clothes_bproof"] = "Gilet par Balle", - - -- Accessories Menu - ["accessories_title"] = "Accessoires", - ["accessories_ears"] = "Accessoire d'Oreilles", - ["accessories_glasses"] = "Lunettes", - ["accessories_helmet"] = "Chapeau/Casque", - ["accessories_mask"] = "Masque", - -- Animation Menu ["animation_title"] = "Animations", - ["animation_party_title"] = "Festives", ["animation_party_smoke"] = "Fumer une cigarette", ["animation_party_playsong"] = "Jouer de la musique", diff --git a/server-data/resources/[bpt_addons]/bpt_menu/locales/it.lua b/server-data/resources/[bpt_addons]/bpt_menu/locales/it.lua index ef3c20191..608ccea01 100644 --- a/server-data/resources/[bpt_addons]/bpt_menu/locales/it.lua +++ b/server-data/resources/[bpt_addons]/bpt_menu/locales/it.lua @@ -17,10 +17,6 @@ Locales["it"] = { ["gave_ammo"] = "Hai dato x %s munizioni per %s", ["no_ammo"] = "Non hai munizioni", ["not_enough_ammo"] = "Non hai tante munizioni", - ["accessories_no_ears"] = "Non hai un accessorio per l'orecchio", - ["accessories_no_glasses"] = "Non hai gli occhiali", - ["accessories_no_helmet"] = "Non hai un casco/cappello", - ["accessories_no_mask"] = "Non hai una maschera", ["admin_noclipon"] = "NoClip attivato", ["admin_noclipoff"] = "NoClip disattivato", ["admin_godmodeon"] = "Modalità invincibile attivata", @@ -32,17 +28,6 @@ Locales["it"] = { ["admin_nomarker"] = "Nessun indicatore sulla mappa!", ["mainmenu_subtitle"] = "MENU INTERAZIONE", ["approach"] = "Approccio: ~b~%s", - ["clothes_title"] = "Capi di abbigliamento", - ["clothes_torso"] = "Torso", - ["clothes_pants"] = "Pants", - ["clothes_shoes"] = "Scarpe", - ["clothes_bag"] = "Borsa", - ["clothes_bproof"] = "Giubbotto antiproiettile", - ["accessories_title"] = "Accessori", - ["accessories_ears"] = "Accessorio per le orecchie", - ["accessories_glasses"] = "Occhiali", - ["accessories_helmet"] = "Cappello / Casco", - ["accessories_mask"] = "Maschera", ["animation_title"] = "Animazioni", ["animation_party_title"] = "Animazioni Festive", ["animation_party_smoke"] = "Fuma una sigaretta", From bcbe7ed89ac59f1f74e96ab270627d5f508a61de Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:45:38 +0200 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20(esx-radialmenu)=20=F0=9F=8E=A8=20?= =?UTF-8?q?Run=20formatter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../esx-radialmenu/client/clothing.lua | 257 ++- .../esx-radialmenu/client/main.lua | 634 +++--- .../esx-radialmenu/client/stretcher.lua | 699 ++++--- .../esx-radialmenu/client/trunk.lua | 519 ++--- .../[esx_addons]/esx-radialmenu/config.lua | 1820 +++++++++-------- .../esx-radialmenu/fxmanifest.lua | 48 +- .../esx-radialmenu/html/css/main.css | 22 +- .../esx-radialmenu/html/index.html | 9 +- .../esx-radialmenu/html/js/RadialMenu.js | 48 +- .../esx-radialmenu/html/js/main.js | 38 +- .../esx-radialmenu/locales/fr.lua | 88 +- .../esx-radialmenu/server/stretcher.lua | 14 +- .../esx-radialmenu/server/trunk.lua | 33 +- 13 files changed, 2287 insertions(+), 1942 deletions(-) diff --git a/server-data/resources/[esx_addons]/esx-radialmenu/client/clothing.lua b/server-data/resources/[esx_addons]/esx-radialmenu/client/clothing.lua index 095db6080..79a1946eb 100644 --- a/server-data/resources/[esx_addons]/esx-radialmenu/client/clothing.lua +++ b/server-data/resources/[esx_addons]/esx-radialmenu/client/clothing.lua @@ -1,8 +1,8 @@ local variations = { - jackets = {male = {}, female = {}}, - hair = {male = {}, female = {}}, - bags = {male = {}, female = {}}, - visor = {male = {}, female = {}}, + jackets = { male = {}, female = {} }, + hair = { male = {}, female = {} }, + bags = { male = {}, female = {} }, + visor = { male = {}, female = {} }, gloves = { male = { [16] = 4, @@ -396,8 +396,8 @@ local variations = { [237] = 229, [238] = 229, [239] = 229, - } - } + }, + }, } local function addNewVariation(which, gender, one, two, single) @@ -653,44 +653,44 @@ local drawables = { ["Top"] = { Drawable = 11, Table = variations.jackets, - Emote = {Dict = "missmic4", Anim = "michael_tux_fidget", Move = 51, Dur = 1500} + Emote = { Dict = "missmic4", Anim = "michael_tux_fidget", Move = 51, Dur = 1500 }, }, ["gloves"] = { Drawable = 3, Table = variations.gloves, Remember = true, - Emote = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200} + Emote = { Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200 }, }, ["Shoes"] = { Drawable = 6, - Table = {Standalone = true, male = 34, female = 35}, - Emote = {Dict = "random@domestic", Anim = "pickup_low", Move = 0, Dur = 1200} + Table = { Standalone = true, male = 34, female = 35 }, + Emote = { Dict = "random@domestic", Anim = "pickup_low", Move = 0, Dur = 1200 }, }, ["Neck"] = { Drawable = 7, - Table = {Standalone = true, male = 0, female = 0 }, - Emote = {Dict = "clothingtie", Anim = "try_tie_positive_a", Move = 51, Dur = 2100} + Table = { Standalone = true, male = 0, female = 0 }, + Emote = { Dict = "clothingtie", Anim = "try_tie_positive_a", Move = 51, Dur = 2100 }, }, ["Vest"] = { Drawable = 9, - Table = {Standalone = true, male = 0, female = 0 }, - Emote = {Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200} + Table = { Standalone = true, male = 0, female = 0 }, + Emote = { Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200 }, }, ["Bag"] = { Drawable = 5, Table = variations.bags, - Emote = {Dict = "anim@heists@ornate_bank@grab_cash", Anim = "intro", Move = 51, Dur = 1600} + Emote = { Dict = "anim@heists@ornate_bank@grab_cash", Anim = "intro", Move = 51, Dur = 1600 }, }, ["Mask"] = { Drawable = 1, - Table = {Standalone = true, male = 0, female = 0 }, - Emote = {Dict = "mp_masks@standard_car@ds@", Anim = "put_on_mask", Move = 51, Dur = 800} + Table = { Standalone = true, male = 0, female = 0 }, + Emote = { Dict = "mp_masks@standard_car@ds@", Anim = "put_on_mask", Move = 51, Dur = 800 }, }, ["hair"] = { Drawable = 2, Table = variations.hair, Remember = true, - Emote = {Dict = "clothingtie", Anim = "check_out_a", Move = 51, Dur = 2000} + Emote = { Dict = "clothingtie", Anim = "check_out_a", Move = 51, Dur = 2000 }, }, } @@ -698,24 +698,26 @@ local Extras = { ["Shirt"] = { Drawable = 11, Table = { - Standalone = true, male = 252, female = 74, + Standalone = true, + male = 252, + female = 74, Extra = { - {Drawable = 8, Id = 15, Tex = 0, Name = "Extra Undershirt"}, - {Drawable = 3, Id = 15, Tex = 0, Name = "Extra Gloves"}, - {Drawable = 10, Id = 0, Tex = 0, Name = "Extra Decals"}, - } + { Drawable = 8, Id = 15, Tex = 0, Name = "Extra Undershirt" }, + { Drawable = 3, Id = 15, Tex = 0, Name = "Extra Gloves" }, + { Drawable = 10, Id = 0, Tex = 0, Name = "Extra Decals" }, }, - Emote = {Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200} + }, + Emote = { Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200 }, }, ["Pants"] = { Drawable = 4, - Table = {Standalone = true, male = 61, female = 14}, - Emote = {Dict = "re@construction", Anim = "out_of_breath", Move = 51, Dur = 1300} + Table = { Standalone = true, male = 61, female = 14 }, + Emote = { Dict = "re@construction", Anim = "out_of_breath", Move = 51, Dur = 1300 }, }, ["Bagoff"] = { Drawable = 5, - Table = {Standalone = true, male = 0, female = 0}, - Emote = {Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200} + Table = { Standalone = true, male = 0, female = 0 }, + Emote = { Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200 }, }, } @@ -724,44 +726,44 @@ local Props = { Prop = 0, Variants = variations.visor, Emote = { - On = {Dict = "mp_masks@standard_car@ds@", Anim = "put_on_mask", Move = 51, Dur = 600}, - Off = {Dict = "missheist_agency2ahelmet", Anim = "take_off_helmet_stand", Move = 51, Dur = 1200} - } + On = { Dict = "mp_masks@standard_car@ds@", Anim = "put_on_mask", Move = 51, Dur = 600 }, + Off = { Dict = "missheist_agency2ahelmet", Anim = "take_off_helmet_stand", Move = 51, Dur = 1200 }, + }, }, ["Hat"] = { Prop = 0, Emote = { - On = {Dict = "mp_masks@standard_car@ds@", Anim = "put_on_mask", Move = 51, Dur = 600}, - Off = {Dict = "missheist_agency2ahelmet", Anim = "take_off_helmet_stand", Move = 51, Dur = 1200} - } + On = { Dict = "mp_masks@standard_car@ds@", Anim = "put_on_mask", Move = 51, Dur = 600 }, + Off = { Dict = "missheist_agency2ahelmet", Anim = "take_off_helmet_stand", Move = 51, Dur = 1200 }, + }, }, ["Glasses"] = { Prop = 1, Emote = { - On = {Dict = "clothingspecs", Anim = "take_off", Move = 51, Dur = 1400}, - Off = {Dict = "clothingspecs", Anim = "take_off", Move = 51, Dur = 1400} - } + On = { Dict = "clothingspecs", Anim = "take_off", Move = 51, Dur = 1400 }, + Off = { Dict = "clothingspecs", Anim = "take_off", Move = 51, Dur = 1400 }, + }, }, ["Ear"] = { Prop = 2, Emote = { - On = {Dict = "mp_cp_stolen_tut", Anim = "b_think", Move = 51, Dur = 900}, - Off = {Dict = "mp_cp_stolen_tut", Anim = "b_think", Move = 51, Dur = 900} - } + On = { Dict = "mp_cp_stolen_tut", Anim = "b_think", Move = 51, Dur = 900 }, + Off = { Dict = "mp_cp_stolen_tut", Anim = "b_think", Move = 51, Dur = 900 }, + }, }, ["Watch"] = { Prop = 6, Emote = { - On = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200}, - Off = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200} - } + On = { Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200 }, + Off = { Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200 }, + }, }, ["Bracelet"] = { Prop = 7, Emote = { - On = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200}, - Off = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200} - } + On = { Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200 }, + Off = { Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200 }, + }, }, } @@ -770,10 +772,18 @@ Cooldown = false local function PlayToggleEmote(e, cb) local Ped = PlayerPedId() - while not HasAnimDictLoaded(e.Dict) do RequestAnimDict(e.Dict) Wait(100) end - if IsPedInAnyVehicle(Ped) then e.Move = 51 end + while not HasAnimDictLoaded(e.Dict) do + RequestAnimDict(e.Dict) + Wait(100) + end + if IsPedInAnyVehicle(Ped) then + e.Move = 51 + end TaskPlayAnim(Ped, e.Dict, e.Anim, 3.0, 3.0, e.Dur, e.Move, 0, false, false, false) - local Pause = e.Dur-500 if Pause < 500 then Pause = 500 end + local Pause = e.Dur - 500 + if Pause < 500 then + Pause = 500 + end IncurCooldown(Pause) Wait(Pause) -- Lets wait for the emote to play for a bit then do the callback. cb() @@ -785,17 +795,23 @@ function ResetClothing(anim) end local Ped = PlayerPedId() local e = drawables.Top.Emote - if anim then TaskPlayAnim(Ped, e.Dict, e.Anim, 3.0, 3.0, 3000, e.Move, 0, false, false, false) end + if anim then + TaskPlayAnim(Ped, e.Dict, e.Anim, 3.0, 3.0, 3000, e.Move, 0, false, false, false) + end for _, v in pairs(LastEquipped) do if v then - if v.Drawable then SetPedComponentVariation(Ped, v.Id, v.Drawable, v.Texture, 0) - elseif v.Prop then ClearPedProp(Ped, v.Id) SetPedPropIndex(Ped, v.Id, v.Prop, v.Texture, true) end + if v.Drawable then + SetPedComponentVariation(Ped, v.Id, v.Drawable, v.Texture, 0) + elseif v.Prop then + ClearPedProp(Ped, v.Id) + SetPedPropIndex(Ped, v.Id, v.Prop, v.Texture, true) + end end end LastEquipped = {} end -RegisterNetEvent('esx-radialmenu:ResetClothing', ResetClothing) +RegisterNetEvent("esx-radialmenu:ResetClothing", ResetClothing) function ToggleClothing(whic, extra) local which = whic @@ -804,11 +820,16 @@ function ToggleClothing(whic, extra) end Wait(50) - if which == "Shirt" or which == "Pants" or which == "Bagoff" then - extra = true - end - if Cooldown then return end - local Toggle = drawables[which] if extra then Toggle = Extras[which] end + if which == "Shirt" or which == "Pants" or which == "Bagoff" then + extra = true + end + if Cooldown then + return + end + local Toggle = drawables[which] + if extra then + Toggle = Extras[which] + end local Ped = PlayerPedId() local Cur = { -- Lets check what we are currently wearing. Drawable = GetPedDrawableVariation(Ped, Toggle.Drawable), @@ -818,27 +839,42 @@ function ToggleClothing(whic, extra) } local Gender = IsMpPed(Ped) if which ~= "Mask" then - if not Gender then Notify( _U("wrong_ped")) return false end -- We cancel the command here if the person is not using a multiplayer model. + if not Gender then + Notify(_U("wrong_ped")) + return false + end -- We cancel the command here if the person is not using a multiplayer model. end local Table = Toggle.Table[Gender] if not Toggle.Table.Standalone then -- "Standalone" is for things that dont require a variant, like the shoes just need to be switched to a specific drawable. Looking back at this i should have planned ahead, but it all works so, meh! - for k,v in pairs(Table) do + for k, v in pairs(Table) do if not Toggle.Remember then if k == Cur.Drawable then - PlayToggleEmote(Toggle.Emote, function() SetPedComponentVariation(Ped, Toggle.Drawable, v, Cur.Texture, 0) end) return true + PlayToggleEmote(Toggle.Emote, function() + SetPedComponentVariation(Ped, Toggle.Drawable, v, Cur.Texture, 0) + end) + return true end else if not LastEquipped[which] then if k == Cur.Drawable then - PlayToggleEmote(Toggle.Emote, function() LastEquipped[which] = Cur SetPedComponentVariation(Ped, Toggle.Drawable, v, Cur.Texture, 0) end) return true + PlayToggleEmote(Toggle.Emote, function() + LastEquipped[which] = Cur + SetPedComponentVariation(Ped, Toggle.Drawable, v, Cur.Texture, 0) + end) + return true end else local Last = LastEquipped[which] - PlayToggleEmote(Toggle.Emote, function() SetPedComponentVariation(Ped, Toggle.Drawable, Last.Drawable, Last.Texture, 0) LastEquipped[which] = false end) return true + PlayToggleEmote(Toggle.Emote, function() + SetPedComponentVariation(Ped, Toggle.Drawable, Last.Drawable, Last.Texture, 0) + LastEquipped[which] = false + end) + return true end end end - Notify( _U("no_variants")) return + Notify(_U("no_variants")) + return else if not LastEquipped[which] then if Cur.Drawable ~= Table then @@ -848,7 +884,11 @@ function ToggleClothing(whic, extra) if Toggle.Table.Extra then local extraToggled = Toggle.Table.Extra for _, v in pairs(extraToggled) do - local ExtraCur = {Drawable = GetPedDrawableVariation(Ped, v.Drawable), Texture = GetPedTextureVariation(Ped, v.Drawable), Id = v.Drawable} + local ExtraCur = { + Drawable = GetPedDrawableVariation(Ped, v.Drawable), + Texture = GetPedTextureVariation(Ped, v.Drawable), + Id = v.Drawable, + } SetPedComponentVariation(Ped, v.Drawable, v.Id, v.Tex, 0) LastEquipped[v.Name] = ExtraCur end @@ -875,10 +915,11 @@ function ToggleClothing(whic, extra) return true end end - Notify( _U("already_wearing")) return false + Notify(_U("already_wearing")) + return false end -RegisterNetEvent('esx-radialmenu:ToggleClothing', ToggleClothing) +RegisterNetEvent("esx-radialmenu:ToggleClothing", ToggleClothing) function ToggleProps(whic) local which = whic @@ -887,7 +928,9 @@ function ToggleProps(whic) end Wait(50) - if Cooldown then return end + if Cooldown then + return + end local Prop = Props[which] local Ped = PlayerPedId() local Cur = { -- Lets get out currently equipped prop. @@ -898,52 +941,73 @@ function ToggleProps(whic) } if not Prop.Variants then if Cur.Prop ~= -1 then -- If we currently are wearing this prop, remove it and save the one we were wearing into the LastEquipped table. - PlayToggleEmote(Prop.Emote.Off, function() LastEquipped[which] = Cur ClearPedProp(Ped, Prop.Prop) end) return true + PlayToggleEmote(Prop.Emote.Off, function() + LastEquipped[which] = Cur + ClearPedProp(Ped, Prop.Prop) + end) + return true else local Last = LastEquipped[which] -- Detect that we have already taken our prop off, lets put it back on. if Last then - PlayToggleEmote(Prop.Emote.On, function() SetPedPropIndex(Ped, Prop.Prop, Last.Prop, Last.Texture, true) end) LastEquipped[which] = false return true + PlayToggleEmote(Prop.Emote.On, function() + SetPedPropIndex(Ped, Prop.Prop, Last.Prop, Last.Texture, true) + end) + LastEquipped[which] = false + return true end end - Notify( _U("nothing_to_remove")) return false + Notify(_U("nothing_to_remove")) + return false else local Gender = IsMpPed(Ped) - if not Gender then Notify( _U("wrong_ped")) return false end -- We dont really allow for variants on ped models, Its possible, but im pretty sure 95% of ped models dont really have variants. + if not Gender then + Notify(_U("wrong_ped")) + return false + end -- We dont really allow for variants on ped models, Its possible, but im pretty sure 95% of ped models dont really have variants. variations = Prop.Variants[Gender] - for k,v in pairs(variations) do + for k, v in pairs(variations) do if Cur.Prop == k then - PlayToggleEmote(Prop.Emote.On, function() SetPedPropIndex(Ped, Prop.Prop, v, Cur.Texture, true) end) return true + PlayToggleEmote(Prop.Emote.On, function() + SetPedPropIndex(Ped, Prop.Prop, v, Cur.Texture, true) + end) + return true end end - Notify( _U("no_variants")) return false + Notify(_U("no_variants")) + return false end end -RegisterNetEvent('esx-radialmenu:ToggleProps', ToggleProps) +RegisterNetEvent("esx-radialmenu:ToggleProps", ToggleProps) -for k,v in pairs(Config.Commands) do +for k, v in pairs(Config.Commands) do RegisterCommand(k, v.Func) --log("Created /"..k.." ("..v.Desc..")") -- Useful for _U checking. - TriggerEvent("chat:addSuggestion", "/"..k, v.Desc) + TriggerEvent("chat:addSuggestion", "/" .. k, v.Desc) end if Config.ExtrasEnabled then - for k,v in pairs(Config.ExtraCommands) do + for k, v in pairs(Config.ExtraCommands) do RegisterCommand(k, v.Func) --log("Created /"..k.." ("..v.Desc..")") -- Useful for _U checking. - TriggerEvent("chat:addSuggestion", "/"..k, v.Desc) + TriggerEvent("chat:addSuggestion", "/" .. k, v.Desc) end end -AddEventHandler('onResourceStop', function(resource) -- Mostly for development, restart the resource and it will put all the clothes back on. - if resource == GetCurrentResourceName() then - ResetClothing() +AddEventHandler( + "onResourceStop", + function(resource) -- Mostly for development, restart the resource and it will put all the clothes back on. + if resource == GetCurrentResourceName() then + ResetClothing() + end end -end) +) function IncurCooldown(ms) CreateThread(function() - Cooldown = true Wait(ms) Cooldown = false + Cooldown = true + Wait(ms) + Cooldown = false end) end @@ -952,22 +1016,33 @@ function Notify(message, color) -- However you want your notifications to be sho end function IsMpPed(ped) - local male = `mp_m_freemode_01` local female = `mp_f_freemode_01` + local male = `mp_m_freemode_01` + local female = `mp_f_freemode_01` local CurrentModel = GetEntityModel(ped) - if CurrentModel == male then return "male" elseif CurrentModel == female then return "female" else return false end + if CurrentModel == male then + return "male" + elseif CurrentModel == female then + return "female" + else + return false + end end -RegisterNetEvent('dpc:EquipLast', function() +RegisterNetEvent("dpc:EquipLast", function() local Ped = PlayerPedId() for _, v in pairs(LastEquipped) do if v then - if v.Drawable then SetPedComponentVariation(Ped, v.ID, v.Drawable, v.Texture, 0) - elseif v.Prop then ClearPedProp(Ped, v.ID) SetPedPropIndex(Ped, v.ID, v.Prop, v.Texture, true) end + if v.Drawable then + SetPedComponentVariation(Ped, v.ID, v.Drawable, v.Texture, 0) + elseif v.Prop then + ClearPedProp(Ped, v.ID) + SetPedPropIndex(Ped, v.ID, v.Prop, v.Texture, true) + end end end LastEquipped = {} end) -RegisterNetEvent('dpc:ResetClothing', function() +RegisterNetEvent("dpc:ResetClothing", function() LastEquipped = {} end) diff --git a/server-data/resources/[esx_addons]/esx-radialmenu/client/main.lua b/server-data/resources/[esx_addons]/esx-radialmenu/client/main.lua index 6fb17ff6a..c009717f6 100644 --- a/server-data/resources/[esx_addons]/esx-radialmenu/client/main.lua +++ b/server-data/resources/[esx_addons]/esx-radialmenu/client/main.lua @@ -6,382 +6,402 @@ local vehicleIndex = nil local DynamicMenuItems = {} local FinalMenuItems = {} -local controlsToToggle = {24,0,1,2, 142, 257, 346} -- if not using toggle +local controlsToToggle = { 24, 0, 1, 2, 142, 257, 346 } -- if not using toggle -- Functions local function deepcopy(orig) -- modified the deep copy function from http://lua-users.org/wiki/CopyTable - local orig_type = type(orig) - local copy - if orig_type == 'table' then - if not orig.canOpen or orig.canOpen() then - local toRemove = {} - copy = {} - for orig_key, orig_value in next, orig, nil do - if type(orig_value) == 'table' then - if not orig_value.canOpen or orig_value.canOpen() then - copy[deepcopy(orig_key)] = deepcopy(orig_value) - else - toRemove[orig_key] = true - end - else - copy[deepcopy(orig_key)] = deepcopy(orig_value) - end - end - for i=1, #toRemove do table.remove(copy, i) --[[ Using this to make sure all indexes get re-indexed and no empty spaces are in the radialmenu ]] end - if copy and next(copy) then setmetatable(copy, deepcopy(getmetatable(orig))) end - end - elseif orig_type ~= 'function' then - copy = orig - end - return copy + local orig_type = type(orig) + local copy + if orig_type == "table" then + if not orig.canOpen or orig.canOpen() then + local toRemove = {} + copy = {} + for orig_key, orig_value in next, orig, nil do + if type(orig_value) == "table" then + if not orig_value.canOpen or orig_value.canOpen() then + copy[deepcopy(orig_key)] = deepcopy(orig_value) + else + toRemove[orig_key] = true + end + else + copy[deepcopy(orig_key)] = deepcopy(orig_value) + end + end + for i = 1, #toRemove do + table.remove(copy, i) --[[ Using this to make sure all indexes get re-indexed and no empty spaces are in the radialmenu ]] + end + if copy and next(copy) then + setmetatable(copy, deepcopy(getmetatable(orig))) + end + end + elseif orig_type ~= "function" then + copy = orig + end + return copy end local function getNearestVeh() - local pos = GetEntityCoords(PlayerPedId()) - local entityWorld = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 20.0, 0.0) - local rayHandle = CastRayPointToPoint(pos.x, pos.y, pos.z, entityWorld.x, entityWorld.y, entityWorld.z, 10, PlayerPedId(), 0) - local vehicleHandle = GetRaycastResult(rayHandle) - return vehicleHandle + local pos = GetEntityCoords(PlayerPedId()) + local entityWorld = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 20.0, 0.0) + local rayHandle = + CastRayPointToPoint(pos.x, pos.y, pos.z, entityWorld.x, entityWorld.y, entityWorld.z, 10, PlayerPedId(), 0) + local vehicleHandle = GetRaycastResult(rayHandle) + return vehicleHandle end local function AddOption(data, id) - local menuID = id ~= nil and id or (#DynamicMenuItems + 1) - DynamicMenuItems[menuID] = deepcopy(data) - return menuID + local menuID = id ~= nil and id or (#DynamicMenuItems + 1) + DynamicMenuItems[menuID] = deepcopy(data) + return menuID end local function RemoveOption(id) - DynamicMenuItems[id] = nil + DynamicMenuItems[id] = nil end local function SetupJobMenu() - local JobInteractionCheck = ESX.PlayerData.job.name - if ESX.PlayerData.job.type == "leo" then JobInteractionCheck = "police" end - local JobMenu = { - id = 'jobinteractions', - title = 'Work', - icon = 'briefcase', - items = {} - } - --if Config.JobInteractions[JobInteractionCheck] and next(Config.JobInteractions[JobInteractionCheck]) and ESX.PlayerData.job.onduty then - if Config.JobInteractions[JobInteractionCheck] and next(Config.JobInteractions[JobInteractionCheck]) then - JobMenu.items = Config.JobInteractions[JobInteractionCheck] - end - - if #JobMenu.items == 0 then - if jobIndex then - RemoveOption(jobIndex) - jobIndex = nil - end - else - jobIndex = AddOption(JobMenu, jobIndex) - end + local JobInteractionCheck = ESX.PlayerData.job.name + if ESX.PlayerData.job.type == "leo" then + JobInteractionCheck = "police" + end + local JobMenu = { + id = "jobinteractions", + title = "Work", + icon = "briefcase", + items = {}, + } + --if Config.JobInteractions[JobInteractionCheck] and next(Config.JobInteractions[JobInteractionCheck]) and ESX.PlayerData.job.onduty then + if Config.JobInteractions[JobInteractionCheck] and next(Config.JobInteractions[JobInteractionCheck]) then + JobMenu.items = Config.JobInteractions[JobInteractionCheck] + end + + if #JobMenu.items == 0 then + if jobIndex then + RemoveOption(jobIndex) + jobIndex = nil + end + else + jobIndex = AddOption(JobMenu, jobIndex) + end end local function SetupVehicleMenu() - local VehicleMenu = { - id = 'vehicle', - title = 'Vehicle', - icon = 'car', - items = {} - } - - local ped = PlayerPedId() - local Vehicle = GetVehiclePedIsIn(ped) ~= 0 and GetVehiclePedIsIn(ped) or getNearestVeh() - if Vehicle ~= 0 then - VehicleMenu.items[#VehicleMenu.items+1] = Config.VehicleDoors - if Config.EnableExtraMenu then VehicleMenu.items[#VehicleMenu.items+1] = Config.VehicleExtras end - - if not IsVehicleOnAllWheels(Vehicle) then - VehicleMenu.items[#VehicleMenu.items+1] = { - id = 'vehicle-flip', - title = 'Flip Vehicle', - icon = 'car-burst', - type = 'client', - event = 'esx-radialmenu:flipVehicle', - shouldClose = true - } - end - - if IsPedInAnyVehicle(ped) then - local seatIndex = #VehicleMenu.items+1 - VehicleMenu.items[seatIndex] = deepcopy(Config.VehicleSeats) - - local seatTable = { - [1] = _U("driver_seat"), - [2] = _U("passenger_seat"), - [3] = _U("rear_left_seat"), - [4] = _U("rear_right_seat"), - } - - local AmountOfSeats = GetVehicleModelNumberOfSeats(GetEntityModel(Vehicle)) - for i = 1, AmountOfSeats do - local newIndex = #VehicleMenu.items[seatIndex].items+1 - VehicleMenu.items[seatIndex].items[newIndex] = { - id = i - 2, - title = seatTable[i] or _U("other_seats"), - icon = 'caret-up', - type = 'client', - event = 'esx-radialmenu:client:ChangeSeat', - shouldClose = false, - } - end - end - end - - if #VehicleMenu.items == 0 then - if vehicleIndex then - RemoveOption(vehicleIndex) - vehicleIndex = nil - end - else - vehicleIndex = AddOption(VehicleMenu, vehicleIndex) - end + local VehicleMenu = { + id = "vehicle", + title = "Vehicle", + icon = "car", + items = {}, + } + + local ped = PlayerPedId() + local Vehicle = GetVehiclePedIsIn(ped) ~= 0 and GetVehiclePedIsIn(ped) or getNearestVeh() + if Vehicle ~= 0 then + VehicleMenu.items[#VehicleMenu.items + 1] = Config.VehicleDoors + if Config.EnableExtraMenu then + VehicleMenu.items[#VehicleMenu.items + 1] = Config.VehicleExtras + end + + if not IsVehicleOnAllWheels(Vehicle) then + VehicleMenu.items[#VehicleMenu.items + 1] = { + id = "vehicle-flip", + title = "Flip Vehicle", + icon = "car-burst", + type = "client", + event = "esx-radialmenu:flipVehicle", + shouldClose = true, + } + end + + if IsPedInAnyVehicle(ped) then + local seatIndex = #VehicleMenu.items + 1 + VehicleMenu.items[seatIndex] = deepcopy(Config.VehicleSeats) + + local seatTable = { + [1] = _U("driver_seat"), + [2] = _U("passenger_seat"), + [3] = _U("rear_left_seat"), + [4] = _U("rear_right_seat"), + } + + local AmountOfSeats = GetVehicleModelNumberOfSeats(GetEntityModel(Vehicle)) + for i = 1, AmountOfSeats do + local newIndex = #VehicleMenu.items[seatIndex].items + 1 + VehicleMenu.items[seatIndex].items[newIndex] = { + id = i - 2, + title = seatTable[i] or _U("other_seats"), + icon = "caret-up", + type = "client", + event = "esx-radialmenu:client:ChangeSeat", + shouldClose = false, + } + end + end + end + + if #VehicleMenu.items == 0 then + if vehicleIndex then + RemoveOption(vehicleIndex) + vehicleIndex = nil + end + else + vehicleIndex = AddOption(VehicleMenu, vehicleIndex) + end end local function SetupSubItems() - SetupJobMenu() - SetupVehicleMenu() + SetupJobMenu() + SetupVehicleMenu() end local function selectOption(t, t2) - for _, v in pairs(t) do - if v.items then - local found, hasAction, val = selectOption(v.items, t2) - if found then return true, hasAction, val end - else - if v.id == t2.id and ((v.event and v.event == t2.event) or v.action) and (not v.canOpen or v.canOpen()) then - return true, v.action, v - end - end - end - return false + for _, v in pairs(t) do + if v.items then + local found, hasAction, val = selectOption(v.items, t2) + if found then + return true, hasAction, val + end + else + if v.id == t2.id and ((v.event and v.event == t2.event) or v.action) and (not v.canOpen or v.canOpen()) then + return true, v.action, v + end + end + end + return false end local function IsPoliceOrEMS() - return (ESX.PlayerData.job.name == "police" or ESX.PlayerData.job.type == "leo" or ESX.PlayerData.job.name == "ambulance") + return ( + ESX.PlayerData.job.name == "police" + or ESX.PlayerData.job.type == "leo" + or ESX.PlayerData.job.name == "ambulance" + ) end local function IsDowned() - return (ESX.PlayerData.dead) + return ESX.PlayerData.dead end local function SetupRadialMenu() - FinalMenuItems = {} - if (IsDowned() and IsPoliceOrEMS()) then - FinalMenuItems = { - [1] = { - id = 'emergencybutton2', - title = _U("emergency_button"), - icon = 'circle-exclamation', - type = 'client', - event = 'police:client:SendPoliceEmergencyAlert', - shouldClose = true, - }, - } - else - SetupSubItems() - FinalMenuItems = deepcopy(Config.MenuItems) - for _, v in pairs(DynamicMenuItems) do - FinalMenuItems[#FinalMenuItems+1] = v - end - - end + FinalMenuItems = {} + if IsDowned() and IsPoliceOrEMS() then + FinalMenuItems = { + [1] = { + id = "emergencybutton2", + title = _U("emergency_button"), + icon = "circle-exclamation", + type = "client", + event = "police:client:SendPoliceEmergencyAlert", + shouldClose = true, + }, + } + else + SetupSubItems() + FinalMenuItems = deepcopy(Config.MenuItems) + for _, v in pairs(DynamicMenuItems) do + FinalMenuItems[#FinalMenuItems + 1] = v + end + end end local function controlToggle(bool) - for i = 1, #controlsToToggle,1 do - if bool then - exports['esx-smallresources']:addDisableControls(controlsToToggle[i]) - else - exports['esx-smallresources']:removeDisableControls(controlsToToggle[i]) - end - end + for i = 1, #controlsToToggle, 1 do + if bool then + exports["esx-smallresources"]:addDisableControls(controlsToToggle[i]) + else + exports["esx-smallresources"]:removeDisableControls(controlsToToggle[i]) + end + end end - local function setRadialState(bool, sendMessage, delay) - -- Menuitems have to be added only once - if Config.UseWhilstWalking then - if bool then - SetupRadialMenu() - PlaySoundFrontend(-1, "NAV", "HUD_AMMO_SHOP_SOUNDSET", 1) - controlToggle(true) - else - controlToggle(false) - end - SetNuiFocus(bool, bool) - SetNuiFocusKeepInput(bool, true) - else - if bool then - TriggerEvent('esx-radialmenu:client:onRadialmenuOpen') - SetupRadialMenu() - else - TriggerEvent('esx-radialmenu:client:onRadialmenuClose') - end - SetNuiFocus(bool, bool) - end - - if sendMessage then - SendNUIMessage({ - action = "ui", - radial = bool, - items = FinalMenuItems, - toggle = Config.Toggle, - keybind = Config.Keybind - }) - end - if delay then Wait(500) end - inRadialMenu = bool + -- Menuitems have to be added only once + if Config.UseWhilstWalking then + if bool then + SetupRadialMenu() + PlaySoundFrontend(-1, "NAV", "HUD_AMMO_SHOP_SOUNDSET", 1) + controlToggle(true) + else + controlToggle(false) + end + SetNuiFocus(bool, bool) + SetNuiFocusKeepInput(bool, true) + else + if bool then + TriggerEvent("esx-radialmenu:client:onRadialmenuOpen") + SetupRadialMenu() + else + TriggerEvent("esx-radialmenu:client:onRadialmenuClose") + end + SetNuiFocus(bool, bool) + end + + if sendMessage then + SendNUIMessage({ + action = "ui", + radial = bool, + items = FinalMenuItems, + toggle = Config.Toggle, + keybind = Config.Keybind, + }) + end + if delay then + Wait(500) + end + inRadialMenu = bool end -- Command -RegisterCommand('radialmenu', function() - if ((IsDowned() and IsPoliceOrEMS()) or not IsDowned()) and not LocalPlayer.state.handcuffed and not IsPauseMenuActive() and not inRadialMenu then - setRadialState(true, true) - SetCursorLocation(0.5, 0.5) - end +RegisterCommand("radialmenu", function() + if + ((IsDowned() and IsPoliceOrEMS()) or not IsDowned()) + and not LocalPlayer.state.handcuffed + and not IsPauseMenuActive() + and not inRadialMenu + then + setRadialState(true, true) + SetCursorLocation(0.5, 0.5) + end end) -RegisterKeyMapping('radialmenu', _U("command_description"), 'keyboard', Config.Keybind) +RegisterKeyMapping("radialmenu", _U("command_description"), "keyboard", Config.Keybind) -- Events -- Sets the metadata when the player spawns -RegisterNetEvent('esx:playerLoaded', function(xPlayer) +RegisterNetEvent("esx:playerLoaded", function(xPlayer) ESX.PlayerData = xPlayer ESX.PlayerLoaded = true end) -- Sets the playerdata to an empty table when the player has quit or did /logout -RegisterNetEvent('esx:onPlayerLogout', function() - ESX.PlayerLoaded = false - firstSpawn = true +RegisterNetEvent("esx:onPlayerLogout", function() + ESX.PlayerLoaded = false + firstSpawn = true end) -RegisterNetEvent('esx-radialmenu:client:noPlayers', function() - ESX.ShowNotification("Aucun joueur n'est à proximité.", 'error', 2500) +RegisterNetEvent("esx-radialmenu:client:noPlayers", function() + ESX.ShowNotification("Aucun joueur n'est à proximité.", "error", 2500) end) -RegisterNetEvent('esx-radialmenu:client:openDoor', function(data) - local string = data.id - local replace = string:gsub("door", "") - local door = tonumber(replace) - local ped = PlayerPedId() - local closestVehicle = GetVehiclePedIsIn(ped) ~= 0 and GetVehiclePedIsIn(ped) or getNearestVeh() - if closestVehicle ~= 0 then - if closestVehicle ~= GetVehiclePedIsIn(ped) then - local plate = GetVehicleNumberPlateText(closestVehicle) - if GetVehicleDoorAngleRatio(closestVehicle, door) > 0.0 then - if not IsVehicleSeatFree(closestVehicle, -1) then - TriggerServerEvent('esx-radialmenu:trunk:server:Door', false, plate, door) - else - SetVehicleDoorShut(closestVehicle, door, false) - end - else - if not IsVehicleSeatFree(closestVehicle, -1) then - TriggerServerEvent('esx-radialmenu:trunk:server:Door', true, plate, door) - else - SetVehicleDoorOpen(closestVehicle, door, false, false) - end - end - else - if GetVehicleDoorAngleRatio(closestVehicle, door) > 0.0 then - SetVehicleDoorShut(closestVehicle, door, false) - else - SetVehicleDoorOpen(closestVehicle, door, false, false) - end - end - else - ESX.ShowNotification( _U("no_vehicle_found"), 'error', 2500) - end +RegisterNetEvent("esx-radialmenu:client:openDoor", function(data) + local string = data.id + local replace = string:gsub("door", "") + local door = tonumber(replace) + local ped = PlayerPedId() + local closestVehicle = GetVehiclePedIsIn(ped) ~= 0 and GetVehiclePedIsIn(ped) or getNearestVeh() + if closestVehicle ~= 0 then + if closestVehicle ~= GetVehiclePedIsIn(ped) then + local plate = GetVehicleNumberPlateText(closestVehicle) + if GetVehicleDoorAngleRatio(closestVehicle, door) > 0.0 then + if not IsVehicleSeatFree(closestVehicle, -1) then + TriggerServerEvent("esx-radialmenu:trunk:server:Door", false, plate, door) + else + SetVehicleDoorShut(closestVehicle, door, false) + end + else + if not IsVehicleSeatFree(closestVehicle, -1) then + TriggerServerEvent("esx-radialmenu:trunk:server:Door", true, plate, door) + else + SetVehicleDoorOpen(closestVehicle, door, false, false) + end + end + else + if GetVehicleDoorAngleRatio(closestVehicle, door) > 0.0 then + SetVehicleDoorShut(closestVehicle, door, false) + else + SetVehicleDoorOpen(closestVehicle, door, false, false) + end + end + else + ESX.ShowNotification(_U("no_vehicle_found"), "error", 2500) + end end) -RegisterNetEvent('esx-radialmenu:client:setExtra', function(data) - local string = data.id - local replace = string:gsub("extra", "") - local extra = tonumber(replace) - local ped = PlayerPedId() - local veh = GetVehiclePedIsIn(ped) - if veh ~= nil then - if GetPedInVehicleSeat(veh, -1) == ped then - SetVehicleAutoRepairDisabled(veh, true) -- Forces Auto Repair off when Toggling Extra [GTA 5 Niche Issue] - if DoesExtraExist(veh, extra) then - if IsVehicleExtraTurnedOn(veh, extra) then - SetVehicleExtra(veh, extra, 1) - ESX.ShowNotification( _U("extra_deactivated", {extra = extra}), 'error', 2500) - else - SetVehicleExtra(veh, extra, 0) - ESX.ShowNotification( _U("extra_activated", {extra = extra}), 'success', 2500) - end - else - ESX.ShowNotification( _U("extra_not_present", {extra = extra}), 'error', 2500) - end - else - ESX.ShowNotification( _U("not_driver"), 'error', 2500) - end - end +RegisterNetEvent("esx-radialmenu:client:setExtra", function(data) + local string = data.id + local replace = string:gsub("extra", "") + local extra = tonumber(replace) + local ped = PlayerPedId() + local veh = GetVehiclePedIsIn(ped) + if veh ~= nil then + if GetPedInVehicleSeat(veh, -1) == ped then + SetVehicleAutoRepairDisabled(veh, true) -- Forces Auto Repair off when Toggling Extra [GTA 5 Niche Issue] + if DoesExtraExist(veh, extra) then + if IsVehicleExtraTurnedOn(veh, extra) then + SetVehicleExtra(veh, extra, 1) + ESX.ShowNotification(_U("extra_deactivated", { extra = extra }), "error", 2500) + else + SetVehicleExtra(veh, extra, 0) + ESX.ShowNotification(_U("extra_activated", { extra = extra }), "success", 2500) + end + else + ESX.ShowNotification(_U("extra_not_present", { extra = extra }), "error", 2500) + end + else + ESX.ShowNotification(_U("not_driver"), "error", 2500) + end + end end) -RegisterNetEvent('esx-radialmenu:trunk:client:Door', function(plate, door, open) - local veh = GetVehiclePedIsIn(PlayerPedId()) - if veh ~= 0 then - local pl = GetVehicleNumberPlateText(veh) - if pl == plate then - if open then - SetVehicleDoorOpen(veh, door, false, false) - else - SetVehicleDoorShut(veh, door, false) - end - end - end +RegisterNetEvent("esx-radialmenu:trunk:client:Door", function(plate, door, open) + local veh = GetVehiclePedIsIn(PlayerPedId()) + if veh ~= 0 then + local pl = GetVehicleNumberPlateText(veh) + if pl == plate then + if open then + SetVehicleDoorOpen(veh, door, false, false) + else + SetVehicleDoorShut(veh, door, false) + end + end + end end) -RegisterNetEvent('esx-radialmenu:client:ChangeSeat', function(data) - local Veh = GetVehiclePedIsIn(PlayerPedId()) - local IsSeatFree = IsVehicleSeatFree(Veh, data.id) - local speed = GetEntitySpeed(Veh) - if not HasHarnass then - local kmh = speed * 3.6 - if IsSeatFree then - if kmh <= 100.0 then - SetPedIntoVehicle(PlayerPedId(), Veh, data.id) - ESX.ShowNotification( _U("switched_seats", {seat = data.title})) - else - ESX.ShowNotification( _U("vehicle_driving_fast"), 'error') - end - else - ESX.ShowNotification( _U("seat_occupied"), 'error') - end - else - ESX.ShowNotification( _U("race_harness_on"), 'error') - end +RegisterNetEvent("esx-radialmenu:client:ChangeSeat", function(data) + local Veh = GetVehiclePedIsIn(PlayerPedId()) + local IsSeatFree = IsVehicleSeatFree(Veh, data.id) + local speed = GetEntitySpeed(Veh) + if not HasHarnass then + local kmh = speed * 3.6 + if IsSeatFree then + if kmh <= 100.0 then + SetPedIntoVehicle(PlayerPedId(), Veh, data.id) + ESX.ShowNotification(_U("switched_seats", { seat = data.title })) + else + ESX.ShowNotification(_U("vehicle_driving_fast"), "error") + end + else + ESX.ShowNotification(_U("seat_occupied"), "error") + end + else + ESX.ShowNotification(_U("race_harness_on"), "error") + end end) -- NUI Callbacks -RegisterNUICallback('closeRadial', function(data, cb) - setRadialState(false, false, data.delay) - cb('ok') +RegisterNUICallback("closeRadial", function(data, cb) + setRadialState(false, false, data.delay) + cb("ok") end) -RegisterNUICallback('selectItem', function(inData, cb) - local itemData = inData.itemData - local found, action, data = selectOption(FinalMenuItems, itemData) - if data and found then - if action then - action(data) - elseif data.type == 'client' then - TriggerEvent(data.event, data) - elseif data.type == 'server' then - TriggerServerEvent(data.event, data) - elseif data.type == 'command' then - ExecuteCommand(data.event) - end - end - cb('ok') +RegisterNUICallback("selectItem", function(inData, cb) + local itemData = inData.itemData + local found, action, data = selectOption(FinalMenuItems, itemData) + if data and found then + if action then + action(data) + elseif data.type == "client" then + TriggerEvent(data.event, data) + elseif data.type == "server" then + TriggerServerEvent(data.event, data) + elseif data.type == "command" then + ExecuteCommand(data.event) + end + end + cb("ok") end) -exports('AddOption', AddOption) -exports('RemoveOption', RemoveOption) \ No newline at end of file +exports("AddOption", AddOption) +exports("RemoveOption", RemoveOption) diff --git a/server-data/resources/[esx_addons]/esx-radialmenu/client/stretcher.lua b/server-data/resources/[esx_addons]/esx-radialmenu/client/stretcher.lua index 86968dcb0..5fdeb8156 100644 --- a/server-data/resources/[esx_addons]/esx-radialmenu/client/stretcher.lua +++ b/server-data/resources/[esx_addons]/esx-radialmenu/client/stretcher.lua @@ -1,358 +1,465 @@ local isAttached = false local stretcherObject = nil local isLayingOnBed = false -local detachKeys = {157, 158, 160, 164, 165, 73, 36} +local detachKeys = { 157, 158, 160, 164, 165, 73, 36 } -- Add your vehicles here that will allow Ambulance to get a stretcher out. local allowedStretcherVehicles = { - "ambulance", + "ambulance", } -- Functions local function DrawText3Ds(x, y, z, text) SetTextScale(0.35, 0.35) - SetTextFont(4) - SetTextProportional(1) - SetTextColour(255, 255, 255, 215) - SetTextEntry("STRING") - SetTextCentre(true) - AddTextComponentString(text) - SetDrawOrigin(x,y,z, 0) - DrawText(0.0, 0.0) - local factor = (string.len(text)) / 370 - DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75) - ClearDrawOrigin() + SetTextFont(4) + SetTextProportional(1) + SetTextColour(255, 255, 255, 215) + SetTextEntry("STRING") + SetTextCentre(true) + AddTextComponentString(text) + SetDrawOrigin(x, y, z, 0) + DrawText(0.0, 0.0) + local factor = (string.len(text)) / 370 + DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75) + ClearDrawOrigin() end local function checkForVehicles() - local PlayerPed = PlayerPedId() - local PlayerPos = GetEntityCoords(PlayerPed) - local veh = 0 - for _, v in pairs(allowedStretcherVehicles) do - veh = GetClosestVehicle(PlayerPos.x, PlayerPos.y, PlayerPos.z, 7.5, GetHashKey(v), 70) - if veh ~= 0 then - break - end - end - return veh + local PlayerPed = PlayerPedId() + local PlayerPos = GetEntityCoords(PlayerPed) + local veh = 0 + for _, v in pairs(allowedStretcherVehicles) do + veh = GetClosestVehicle(PlayerPos.x, PlayerPos.y, PlayerPos.z, 7.5, GetHashKey(v), 70) + if veh ~= 0 then + break + end + end + return veh end local function setClosestStretcher() - local ped = PlayerPedId() - local coords = GetEntityCoords(ped) - local object = GetClosestObjectOfType(coords.x, coords.y, coords.z, 10.0, `prop_ld_binbag_01`, false, false, false) - if object ~= 0 then - stretcherObject = object - end + local ped = PlayerPedId() + local coords = GetEntityCoords(ped) + local object = GetClosestObjectOfType(coords.x, coords.y, coords.z, 10.0, `prop_ld_binbag_01`, false, false, false) + if object ~= 0 then + stretcherObject = object + end end local function loadAnim(dict) - RequestAnimDict(dict) - while not HasAnimDictLoaded(dict) do - Wait(0) - end + RequestAnimDict(dict) + while not HasAnimDictLoaded(dict) do + Wait(0) + end end local function LayOnStretcher() - local inBedDicts = "anim@gangops@morgue@table@" - local inBedAnims = "ko_front" - local ped = PlayerPedId() - local coords = GetEntityCoords(ped) - local player, distance = ESX.Game.GetClosestPlayer() - if player == -1 then - loadAnim(inBedDicts) - if stretcherObject and #(coords - GetEntityCoords(stretcherObject)) <= 3.0 then - TaskPlayAnim(PlayerPedId(), inBedDicts, inBedAnims, 8.0, 8.0, -1, 69, 1, false, false, false) - AttachEntityToEntity(ped, stretcherObject, 0, 0, 0.0, 1.0, 0.0, 0.0, 180.0, 0.0, false, false, false, false, 2) - isLayingOnBed = true - end - else - if distance < 2.0 then - TriggerServerEvent('esx-radialmenu:Stretcher:BusyCheck', GetPlayerServerId(player), "lay") - else - loadAnim(inBedDicts) - if stretcherObject and #(coords - GetEntityCoords(stretcherObject)) <= 3.0 then - TaskPlayAnim(PlayerPedId(), inBedDicts, inBedAnims, 8.0, 8.0, -1, 69, 1, false, false, false) - AttachEntityToEntity(ped, stretcherObject, 0, 0, 0.0, 1.6, 0.0, 0.0, 360.0, 0.0, false, false, false, false, 2) - isLayingOnBed = true - end - end - end + local inBedDicts = "anim@gangops@morgue@table@" + local inBedAnims = "ko_front" + local ped = PlayerPedId() + local coords = GetEntityCoords(ped) + local player, distance = ESX.Game.GetClosestPlayer() + if player == -1 then + loadAnim(inBedDicts) + if stretcherObject and #(coords - GetEntityCoords(stretcherObject)) <= 3.0 then + TaskPlayAnim(PlayerPedId(), inBedDicts, inBedAnims, 8.0, 8.0, -1, 69, 1, false, false, false) + AttachEntityToEntity( + ped, + stretcherObject, + 0, + 0, + 0.0, + 1.0, + 0.0, + 0.0, + 180.0, + 0.0, + false, + false, + false, + false, + 2 + ) + isLayingOnBed = true + end + else + if distance < 2.0 then + TriggerServerEvent("esx-radialmenu:Stretcher:BusyCheck", GetPlayerServerId(player), "lay") + else + loadAnim(inBedDicts) + if stretcherObject and #(coords - GetEntityCoords(stretcherObject)) <= 3.0 then + TaskPlayAnim(PlayerPedId(), inBedDicts, inBedAnims, 8.0, 8.0, -1, 69, 1, false, false, false) + AttachEntityToEntity( + ped, + stretcherObject, + 0, + 0, + 0.0, + 1.6, + 0.0, + 0.0, + 360.0, + 0.0, + false, + false, + false, + false, + 2 + ) + isLayingOnBed = true + end + end + end end local function getOffStretcher() - local ped = PlayerPedId() - local coords = GetOffsetFromEntityInWorldCoords(stretcherObject, 0.85, 0.0, 0) - ClearPedTasks(ped) - DetachEntity(ped, false, true) - SetEntityCoords(ped, coords.x, coords.y, coords.z) - isLayingOnBed = false + local ped = PlayerPedId() + local coords = GetOffsetFromEntityInWorldCoords(stretcherObject, 0.85, 0.0, 0) + ClearPedTasks(ped) + DetachEntity(ped, false, true) + SetEntityCoords(ped, coords.x, coords.y, coords.z) + isLayingOnBed = false end local function attachToStretcher() - local ped = PlayerPedId() - local closestPlayer, distance = ESX.Game.GetClosestPlayer() - if stretcherObject then - if closestPlayer == -1 then - NetworkRequestControlOfEntity(stretcherObject) - loadAnim("anim@heists@box_carry@") - TaskPlayAnim(ped, 'anim@heists@box_carry@', 'idle', 8.0, 8.0, -1, 50, 0, false, false, false) - SetTimeout(150, function() - AttachEntityToEntity(stretcherObject, ped, GetPedBoneIndex(ped, 28422), 0.0, -1.0, -0.50, 195.0, 180.0, 180.0, 90.0, false, false, true, false, 2) - end) - FreezeEntityPosition(stretcherObject, false) - else - if distance < 2.0 then - TriggerServerEvent('esx-radialmenu:Stretcher:BusyCheck', GetPlayerServerId(closestPlayer), "attach") - else - NetworkRequestControlOfEntity(stretcherObject) - loadAnim("anim@heists@box_carry@") - TaskPlayAnim(ped, 'anim@heists@box_carry@', 'idle', 8.0, 8.0, -1, 50, 0, false, false, false) - SetTimeout(150, function() - AttachEntityToEntity(stretcherObject, ped, GetPedBoneIndex(ped, 28422), 0.0, -1.0, -1.0, 195.0, 180.0, 180.0, 90.0, false, false, true, false, 2) - end) - FreezeEntityPosition(stretcherObject, false) - end - end - end + local ped = PlayerPedId() + local closestPlayer, distance = ESX.Game.GetClosestPlayer() + if stretcherObject then + if closestPlayer == -1 then + NetworkRequestControlOfEntity(stretcherObject) + loadAnim("anim@heists@box_carry@") + TaskPlayAnim(ped, "anim@heists@box_carry@", "idle", 8.0, 8.0, -1, 50, 0, false, false, false) + SetTimeout(150, function() + AttachEntityToEntity( + stretcherObject, + ped, + GetPedBoneIndex(ped, 28422), + 0.0, + -1.0, + -0.50, + 195.0, + 180.0, + 180.0, + 90.0, + false, + false, + true, + false, + 2 + ) + end) + FreezeEntityPosition(stretcherObject, false) + else + if distance < 2.0 then + TriggerServerEvent("esx-radialmenu:Stretcher:BusyCheck", GetPlayerServerId(closestPlayer), "attach") + else + NetworkRequestControlOfEntity(stretcherObject) + loadAnim("anim@heists@box_carry@") + TaskPlayAnim(ped, "anim@heists@box_carry@", "idle", 8.0, 8.0, -1, 50, 0, false, false, false) + SetTimeout(150, function() + AttachEntityToEntity( + stretcherObject, + ped, + GetPedBoneIndex(ped, 28422), + 0.0, + -1.0, + -1.0, + 195.0, + 180.0, + 180.0, + 90.0, + false, + false, + true, + false, + 2 + ) + end) + FreezeEntityPosition(stretcherObject, false) + end + end + end end local function detachStretcher() - DetachEntity(stretcherObject, false, true) - ClearPedTasksImmediately(PlayerPedId()) - isAttached = false + DetachEntity(stretcherObject, false, true) + ClearPedTasksImmediately(PlayerPedId()) + isAttached = false end -- Events -RegisterNetEvent('esx-radialmenu:client:TakeStretcher', function() - local vehicle = checkForVehicles() - if vehicle ~= 0 then - RequestModel("prop_ld_binbag_01") - while not HasModelLoaded("prop_ld_binbag_01") do - Wait(0) - end - local obj = CreateObject(`prop_ld_binbag_01`, GetEntityCoords(PlayerPedId()), true) - if obj ~= 0 then - SetEntityRotation(obj, 0.0, 0.0, GetEntityHeading(vehicle), false, false) - FreezeEntityPosition(obj, true) - PlaceObjectOnGroundProperly(obj) - stretcherObject = obj - SetTimeout(200, function() - attachToStretcher() - isAttached = true - end) - else - ESX.ShowNotification( _U("obj_not_found"), 2500, 'error') - end - else - ESX.ShowNotification( _U("not_near_ambulance"), 'error') - end +RegisterNetEvent("esx-radialmenu:client:TakeStretcher", function() + local vehicle = checkForVehicles() + if vehicle ~= 0 then + RequestModel("prop_ld_binbag_01") + while not HasModelLoaded("prop_ld_binbag_01") do + Wait(0) + end + local obj = CreateObject(`prop_ld_binbag_01`, GetEntityCoords(PlayerPedId()), true) + if obj ~= 0 then + SetEntityRotation(obj, 0.0, 0.0, GetEntityHeading(vehicle), false, false) + FreezeEntityPosition(obj, true) + PlaceObjectOnGroundProperly(obj) + stretcherObject = obj + SetTimeout(200, function() + attachToStretcher() + isAttached = true + end) + else + ESX.ShowNotification(_U("obj_not_found"), 2500, "error") + end + else + ESX.ShowNotification(_U("not_near_ambulance"), "error") + end end) -RegisterNetEvent('esx-radialmenu:client:RemoveStretcher', function() - local ped = PlayerPedId() - local coords = GetOffsetFromEntityInWorldCoords(ped, 0, 1.5, 0) - if stretcherObject then - local bCoords = GetEntityCoords(stretcherObject) - if #(coords - bCoords) < 3.0 then - if DoesEntityExist(stretcherObject) then - DeleteEntity(stretcherObject) - ClearPedTasks(ped) - DetachEntity(ped, false, true) - TriggerServerEvent('esx-radialmenu:server:RemoveStretcher', coords, stretcherObject) - isAttached = false - stretcherObject = nil - isLayingOnBed = false - end - else - ESX.ShowNotification( _U("far_away"), 'error') - end - end +RegisterNetEvent("esx-radialmenu:client:RemoveStretcher", function() + local ped = PlayerPedId() + local coords = GetOffsetFromEntityInWorldCoords(ped, 0, 1.5, 0) + if stretcherObject then + local bCoords = GetEntityCoords(stretcherObject) + if #(coords - bCoords) < 3.0 then + if DoesEntityExist(stretcherObject) then + DeleteEntity(stretcherObject) + ClearPedTasks(ped) + DetachEntity(ped, false, true) + TriggerServerEvent("esx-radialmenu:server:RemoveStretcher", coords, stretcherObject) + isAttached = false + stretcherObject = nil + isLayingOnBed = false + end + else + ESX.ShowNotification(_U("far_away"), "error") + end + end end) -RegisterNetEvent('esx-radialmenu:client:RemoveStretcherFromArea', function(playerPos, bObject) - local ped = PlayerPedId() - local pos = GetEntityCoords(ped) - if pos ~= playerPos then - if stretcherObject then - if stretcherObject == bObject then - if #(pos - playerPos) < 10 then - if IsEntityPlayingAnim(ped, 'anim@heists@box_carry@', 'idle', false) then - detachStretcher() - end - if IsEntityPlayingAnim(ped, "anim@gangops@morgue@table@", "ko_front", false) then - local coords = GetOffsetFromEntityInWorldCoords(ped, 0.85, 0.0, 0) - ClearPedTasks(ped) - DetachEntity(ped, false, true) - SetEntityCoords(ped, coords.x, coords.y, coords.z) - isLayingOnBed = false - end - end - end - end - end +RegisterNetEvent("esx-radialmenu:client:RemoveStretcherFromArea", function(playerPos, bObject) + local ped = PlayerPedId() + local pos = GetEntityCoords(ped) + if pos ~= playerPos then + if stretcherObject then + if stretcherObject == bObject then + if #(pos - playerPos) < 10 then + if IsEntityPlayingAnim(ped, "anim@heists@box_carry@", "idle", false) then + detachStretcher() + end + if IsEntityPlayingAnim(ped, "anim@gangops@morgue@table@", "ko_front", false) then + local coords = GetOffsetFromEntityInWorldCoords(ped, 0.85, 0.0, 0) + ClearPedTasks(ped) + DetachEntity(ped, false, true) + SetEntityCoords(ped, coords.x, coords.y, coords.z) + isLayingOnBed = false + end + end + end + end + end end) -RegisterNetEvent('esx-radialmenu:Stretcher:client:BusyCheck', function(otherId, type) - local ped = PlayerPedId() - if type == "lay" then - loadAnim("anim@gangops@morgue@table@") - if IsEntityPlayingAnim(ped, "anim@gangops@morgue@table@", "ko_front", 3) then - TriggerServerEvent('esx-radialmenu:server:BusyResult', true, otherId, type) - else - TriggerServerEvent('esx-radialmenu:server:BusyResult', false, otherId, type) - end - else - loadAnim('anim@heists@box_carry@') - if IsEntityPlayingAnim(ped, 'anim@heists@box_carry@', 'idle', 3) then - TriggerServerEvent('esx-radialmenu:server:BusyResult', true, otherId, type) - else - TriggerServerEvent('esx-radialmenu:server:BusyResult', false, otherId, type) - end - end +RegisterNetEvent("esx-radialmenu:Stretcher:client:BusyCheck", function(otherId, type) + local ped = PlayerPedId() + if type == "lay" then + loadAnim("anim@gangops@morgue@table@") + if IsEntityPlayingAnim(ped, "anim@gangops@morgue@table@", "ko_front", 3) then + TriggerServerEvent("esx-radialmenu:server:BusyResult", true, otherId, type) + else + TriggerServerEvent("esx-radialmenu:server:BusyResult", false, otherId, type) + end + else + loadAnim("anim@heists@box_carry@") + if IsEntityPlayingAnim(ped, "anim@heists@box_carry@", "idle", 3) then + TriggerServerEvent("esx-radialmenu:server:BusyResult", true, otherId, type) + else + TriggerServerEvent("esx-radialmenu:server:BusyResult", false, otherId, type) + end + end end) -RegisterNetEvent('esx-radialmenu:client:Result', function(isBusy, type) - local ped = PlayerPedId() - local inBedDicts = "anim@gangops@morgue@table@" - local inBedAnims = "ko_front" - if type == "lay" then - if not isBusy then - NetworkRequestControlOfEntity(stretcherObject) - loadAnim(inBedDicts) - TaskPlayAnim(ped, inBedDicts, inBedAnims, 8.0, 8.0, -1, 69, 1, false, false, false) - AttachEntityToEntity(ped, stretcherObject, 0, 0, 0.0, 1.6, 0.0, 0.0, 360.0, 0.0, false, false, false, false, 2) - isLayingOnBed = true - else - ESX.ShowNotification( _U("stretcher_in_use"), "error") - isLayingOnBed = false - end - else - if not isBusy then - NetworkRequestControlOfEntity(stretcherObject) - loadAnim("anim@heists@box_carry@") - TaskPlayAnim(ped, 'anim@heists@box_carry@', 'idle', 8.0, 8.0, -1, 50, 0, false, false, false) - SetTimeout(150, function() - AttachEntityToEntity(stretcherObject, ped, GetPedBoneIndex(ped, 28422), 0.0, -1.0, -1.0, 195.0, 180.0, 180.0, 90.0, false, false, true, false, 2) - end) - FreezeEntityPosition(stretcherObject, false) - isAttached = true - else - ESX.ShowNotification( _U("stretcher_in_use"), "error") - isAttached = false - end - end +RegisterNetEvent("esx-radialmenu:client:Result", function(isBusy, type) + local ped = PlayerPedId() + local inBedDicts = "anim@gangops@morgue@table@" + local inBedAnims = "ko_front" + if type == "lay" then + if not isBusy then + NetworkRequestControlOfEntity(stretcherObject) + loadAnim(inBedDicts) + TaskPlayAnim(ped, inBedDicts, inBedAnims, 8.0, 8.0, -1, 69, 1, false, false, false) + AttachEntityToEntity( + ped, + stretcherObject, + 0, + 0, + 0.0, + 1.6, + 0.0, + 0.0, + 360.0, + 0.0, + false, + false, + false, + false, + 2 + ) + isLayingOnBed = true + else + ESX.ShowNotification(_U("stretcher_in_use"), "error") + isLayingOnBed = false + end + else + if not isBusy then + NetworkRequestControlOfEntity(stretcherObject) + loadAnim("anim@heists@box_carry@") + TaskPlayAnim(ped, "anim@heists@box_carry@", "idle", 8.0, 8.0, -1, 50, 0, false, false, false) + SetTimeout(150, function() + AttachEntityToEntity( + stretcherObject, + ped, + GetPedBoneIndex(ped, 28422), + 0.0, + -1.0, + -1.0, + 195.0, + 180.0, + 180.0, + 90.0, + false, + false, + true, + false, + 2 + ) + end) + FreezeEntityPosition(stretcherObject, false) + isAttached = true + else + ESX.ShowNotification(_U("stretcher_in_use"), "error") + isAttached = false + end + end end) -AddEventHandler('onResourceStop', function(resource) - if resource == GetCurrentResourceName() then - if stretcherObject then - detachStretcher() - DeleteObject(stretcherObject) - ClearPedTasksImmediately(PlayerPedId()) - end - end +AddEventHandler("onResourceStop", function(resource) + if resource == GetCurrentResourceName() then + if stretcherObject then + detachStretcher() + DeleteObject(stretcherObject) + ClearPedTasksImmediately(PlayerPedId()) + end + end end) -- Threads CreateThread(function() - while true do - setClosestStretcher() - Wait(1000) - end + while true do + setClosestStretcher() + Wait(1000) + end end) CreateThread(function() - while true do - local sleep = 1000 - local ped = PlayerPedId() - local pos = GetEntityCoords(ped) - if stretcherObject then - local offsetCoords = GetOffsetFromEntityInWorldCoords(stretcherObject, 0, 0.85, 0) - local distance = #(pos - offsetCoords) - if distance <= 1.0 then - if not isAttached then - sleep = 0 - DrawText3Ds(offsetCoords.x, offsetCoords.y, offsetCoords.z, _U("push_stretcher_button")) - if IsControlJustPressed(0, 51) then - attachToStretcher() - isAttached = true - sleep = 100 - end - if IsControlJustPressed(0, 74) then - FreezeEntityPosition(stretcherObject, true) - sleep = 100 - end - else - sleep = 0 - DrawText3Ds(offsetCoords.x, offsetCoords.y, offsetCoords.z, _U("stop_pushing_stretcher_button")) - if IsControlJustPressed(0, 51) then - detachStretcher() - isAttached = false - sleep = 100 - end - end + while true do + local sleep = 1000 + local ped = PlayerPedId() + local pos = GetEntityCoords(ped) + if stretcherObject then + local offsetCoords = GetOffsetFromEntityInWorldCoords(stretcherObject, 0, 0.85, 0) + local distance = #(pos - offsetCoords) + if distance <= 1.0 then + if not isAttached then + sleep = 0 + DrawText3Ds(offsetCoords.x, offsetCoords.y, offsetCoords.z, _U("push_stretcher_button")) + if IsControlJustPressed(0, 51) then + attachToStretcher() + isAttached = true + sleep = 100 + end + if IsControlJustPressed(0, 74) then + FreezeEntityPosition(stretcherObject, true) + sleep = 100 + end + else + sleep = 0 + DrawText3Ds(offsetCoords.x, offsetCoords.y, offsetCoords.z, _U("stop_pushing_stretcher_button")) + if IsControlJustPressed(0, 51) then + detachStretcher() + isAttached = false + sleep = 100 + end + end - if not isLayingOnBed then - if not isAttached then - sleep = 0 - DrawText3Ds(offsetCoords.x, offsetCoords.y, offsetCoords.z + 0.2, _U("lay_stretcher_button")) - if IsControlJustPressed(0, 47) or IsDisabledControlJustPressed(0, 47) then - LayOnStretcher() - sleep = 100 - end - end - end - elseif distance <= 2 then - if not isLayingOnBed then - sleep = 0 - DrawText3Ds(offsetCoords.x, offsetCoords.y, offsetCoords.z, _U("push_position_drawtext")) - else - if not isAttached then - sleep = 0 - DrawText3Ds(offsetCoords.x, offsetCoords.y, offsetCoords.z + 0.2, _U("get_off_stretcher_button")) - if IsControlJustPressed(0, 47) or IsDisabledControlJustPressed(0, 47) then - getOffStretcher() - sleep = 100 - end - end - end - end - end - Wait(sleep) - end + if not isLayingOnBed then + if not isAttached then + sleep = 0 + DrawText3Ds(offsetCoords.x, offsetCoords.y, offsetCoords.z + 0.2, _U("lay_stretcher_button")) + if IsControlJustPressed(0, 47) or IsDisabledControlJustPressed(0, 47) then + LayOnStretcher() + sleep = 100 + end + end + end + elseif distance <= 2 then + if not isLayingOnBed then + sleep = 0 + DrawText3Ds(offsetCoords.x, offsetCoords.y, offsetCoords.z, _U("push_position_drawtext")) + else + if not isAttached then + sleep = 0 + DrawText3Ds( + offsetCoords.x, + offsetCoords.y, + offsetCoords.z + 0.2, + _U("get_off_stretcher_button") + ) + if IsControlJustPressed(0, 47) or IsDisabledControlJustPressed(0, 47) then + getOffStretcher() + sleep = 100 + end + end + end + end + end + Wait(sleep) + end end) CreateThread(function() - while true do - local sleep = 1000 - if isAttached then - sleep = 0 - local ped = PlayerPedId() - for _, PressedKey in pairs(detachKeys) do - if IsControlJustPressed(0, PressedKey) or IsDisabledControlJustPressed(0, PressedKey) then - detachStretcher() - sleep = 100 - end - end - if IsPedShooting(ped) or IsPlayerFreeAiming(PlayerId()) or IsPedInMeleeCombat(ped) or IsEntityDead(ped) or IsPedRagdoll(ped) then - detachStretcher() - end - end - Wait(sleep) - end + while true do + local sleep = 1000 + if isAttached then + sleep = 0 + local ped = PlayerPedId() + for _, PressedKey in pairs(detachKeys) do + if IsControlJustPressed(0, PressedKey) or IsDisabledControlJustPressed(0, PressedKey) then + detachStretcher() + sleep = 100 + end + end + if + IsPedShooting(ped) + or IsPlayerFreeAiming(PlayerId()) + or IsPedInMeleeCombat(ped) + or IsEntityDead(ped) + or IsPedRagdoll(ped) + then + detachStretcher() + end + end + Wait(sleep) + end end) CreateThread(function() - Wait(1000) - local ped = PlayerPedId() - local pos = GetEntityCoords(ped) - local object = GetClosestObjectOfType(pos.x, pos.y, pos.z, 5.0, `prop_ld_binbag_01`, false, false, false) - if object ~= 0 then - DeleteObject(object) - ClearPedTasksImmediately(ped) - end -end) \ No newline at end of file + Wait(1000) + local ped = PlayerPedId() + local pos = GetEntityCoords(ped) + local object = GetClosestObjectOfType(pos.x, pos.y, pos.z, 5.0, `prop_ld_binbag_01`, false, false, false) + if object ~= 0 then + DeleteObject(object) + ClearPedTasksImmediately(ped) + end +end) diff --git a/server-data/resources/[esx_addons]/esx-radialmenu/client/trunk.lua b/server-data/resources/[esx_addons]/esx-radialmenu/client/trunk.lua index c02b87ebd..044465d4b 100644 --- a/server-data/resources/[esx_addons]/esx-radialmenu/client/trunk.lua +++ b/server-data/resources/[esx_addons]/esx-radialmenu/client/trunk.lua @@ -3,274 +3,307 @@ local isKidnapped = false local isKidnapping = false local cam = nil local disabledTrunk = { - [`penetrator`] = "penetrator", - [`vacca`] = "vacca", - [`monroe`] = "monroe", - [`turismor`] = "turismor", - [`osiris`] = "osiris", - [`comet`] = "comet", - [`ardent`] = "ardent", - [`jester`] = "jester", - [`nero`] = "nero", - [`nero2`] = "nero2", - [`vagner`] = "vagner", - [`infernus`] = "infernus", - [`zentorno`] = "zentorno", - [`comet2`] = "comet2", - [`comet3`] = "comet3", - [`comet4`] = "comet4", - [`bullet`] = "bullet", + [`penetrator`] = "penetrator", + [`vacca`] = "vacca", + [`monroe`] = "monroe", + [`turismor`] = "turismor", + [`osiris`] = "osiris", + [`comet`] = "comet", + [`ardent`] = "ardent", + [`jester`] = "jester", + [`nero`] = "nero", + [`nero2`] = "nero2", + [`vagner`] = "vagner", + [`infernus`] = "infernus", + [`zentorno`] = "zentorno", + [`comet2`] = "comet2", + [`comet3`] = "comet3", + [`comet4`] = "comet4", + [`bullet`] = "bullet", } -- Functions local function DrawText3Ds(x, y, z, text) SetTextScale(0.35, 0.35) - SetTextFont(4) - SetTextProportional(1) - SetTextColour(255, 255, 255, 215) - SetTextEntry("STRING") - SetTextCentre(true) - AddTextComponentString(text) - SetDrawOrigin(x,y,z, 0) - DrawText(0.0, 0.0) - local factor = (string.len(text)) / 370 - DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75) - ClearDrawOrigin() + SetTextFont(4) + SetTextProportional(1) + SetTextColour(255, 255, 255, 215) + SetTextEntry("STRING") + SetTextCentre(true) + AddTextComponentString(text) + SetDrawOrigin(x, y, z, 0) + DrawText(0.0, 0.0) + local factor = (string.len(text)) / 370 + DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75) + ClearDrawOrigin() end local function getNearestVeh() - local pos = GetEntityCoords(PlayerPedId()) - local entityWorld = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 20.0, 0.0) + local pos = GetEntityCoords(PlayerPedId()) + local entityWorld = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 20.0, 0.0) - local rayHandle = CastRayPointToPoint(pos.x, pos.y, pos.z, entityWorld.x, entityWorld.y, entityWorld.z, 10, PlayerPedId(), 0) - local vehicleHandle = GetRaycastResult(rayHandle) - return vehicleHandle + local rayHandle = + CastRayPointToPoint(pos.x, pos.y, pos.z, entityWorld.x, entityWorld.y, entityWorld.z, 10, PlayerPedId(), 0) + local vehicleHandle = GetRaycastResult(rayHandle) + return vehicleHandle end local function TrunkCam(bool) - local vehicle = GetEntityAttachedTo(PlayerPedId()) - local drawPos = GetOffsetFromEntityInWorldCoords(vehicle, 0, -5.5, 0) - local vehHeading = GetEntityHeading(vehicle) - if bool then - RenderScriptCams(false, false, 0, 1, 0) - DestroyCam(cam, false) - if not DoesCamExist(cam) then - cam = CreateCam('DEFAULT_SCRIPTED_CAMERA', true) - SetCamActive(cam, true) - SetCamCoord(cam, drawPos.x, drawPos.y, drawPos.z + 2) - SetCamRot(cam, -2.5, 0.0, vehHeading, 0.0) - RenderScriptCams(true, false, 0, true, true) - end - else - RenderScriptCams(false, false, 0, 1, 0) - DestroyCam(cam, false) - cam = nil - end + local vehicle = GetEntityAttachedTo(PlayerPedId()) + local drawPos = GetOffsetFromEntityInWorldCoords(vehicle, 0, -5.5, 0) + local vehHeading = GetEntityHeading(vehicle) + if bool then + RenderScriptCams(false, false, 0, 1, 0) + DestroyCam(cam, false) + if not DoesCamExist(cam) then + cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true) + SetCamActive(cam, true) + SetCamCoord(cam, drawPos.x, drawPos.y, drawPos.z + 2) + SetCamRot(cam, -2.5, 0.0, vehHeading, 0.0) + RenderScriptCams(true, false, 0, true, true) + end + else + RenderScriptCams(false, false, 0, 1, 0) + DestroyCam(cam, false) + cam = nil + end end -- Events -RegisterNetEvent('esx_kidnapping:client:SetKidnapping', function(bool) - isKidnapping = bool +RegisterNetEvent("esx_kidnapping:client:SetKidnapping", function(bool) + isKidnapping = bool end) -RegisterNetEvent('esx-trunk:client:KidnapTrunk', function() - local closestPlayer, distance = ESX.Game.GetClosestPlayer() - if distance ~= -1 and distance < 2 then - if isKidnapping then - local closestVehicle = getNearestVeh() - if closestVehicle ~= 0 then - TriggerEvent('police:client:KidnapPlayer') - TriggerServerEvent("police:server:CuffPlayer", GetPlayerServerId(closestPlayer), false) - Wait(50) - TriggerServerEvent("esx-trunk:server:KidnapTrunk", GetPlayerServerId(closestPlayer), closestVehicle) - end - else - ESX.ShowNotification( _U("not_kidnapped"), 'error') - end - end +RegisterNetEvent("esx-trunk:client:KidnapTrunk", function() + local closestPlayer, distance = ESX.Game.GetClosestPlayer() + if distance ~= -1 and distance < 2 then + if isKidnapping then + local closestVehicle = getNearestVeh() + if closestVehicle ~= 0 then + TriggerEvent("police:client:KidnapPlayer") + TriggerServerEvent("police:server:CuffPlayer", GetPlayerServerId(closestPlayer), false) + Wait(50) + TriggerServerEvent("esx-trunk:server:KidnapTrunk", GetPlayerServerId(closestPlayer), closestVehicle) + end + else + ESX.ShowNotification(_U("not_kidnapped"), "error") + end + end end) -RegisterNetEvent('esx-trunk:client:KidnapGetIn', function(veh) - local ped = PlayerPedId() - local closestVehicle = veh - local vehClass = GetVehicleClass(closestVehicle) - local plate = GetVehicleNumberPlateText(closestVehicle) - if Config.TrunkClasses[vehClass].allowed then - ESX.TriggerServerCallback('esx-trunk:server:getTrunkBusy', function(isBusy) - if not disabledTrunk[GetEntityModel(closestVehicle)] then - if not inTrunk then - if not isBusy then - if not isKidnapped then - if GetVehicleDoorAngleRatio(closestVehicle, 5) > 0 then - local offset = { - x = Config.TrunkClasses[vehClass].x, - y = Config.TrunkClasses[vehClass].y, - z = Config.TrunkClasses[vehClass].z, - } - RequestAnimDict("fin_ext_p1-7") - while not HasAnimDictLoaded("fin_ext_p1-7") do - Wait(0) - end - TaskPlayAnim(ped, "fin_ext_p1-7", "cs_devin_dual-7", 8.0, 8.0, -1, 1, 999.0, 0, 0, 0) - AttachEntityToEntity(ped, closestVehicle, 0, offset.x, offset.y, offset.z, 0, 0, 40.0, 1, 1, 1, 1, 1, 1) - TriggerServerEvent('esx-trunk:server:setTrunkBusy', plate, true) - inTrunk = true - Wait(500) - SetVehicleDoorShut(closestVehicle, 5, false) - ESX.ShowNotification( _U("entered_trunk"), 'success', 4000) - TrunkCam(true) - isKidnapped = true - else - ESX.ShowNotification( _U("trunk_closed"), 'error', 2500) - end - else - local vehicle = GetEntityAttachedTo(ped) - plate = GetVehicleNumberPlateText(vehicle) - if GetVehicleDoorAngleRatio(vehicle, 5) > 0 then - local vehCoords = GetOffsetFromEntityInWorldCoords(vehicle, 0, -5.0, 0) - DetachEntity(ped, true, true) - ClearPedTasks(ped) - inTrunk = false - TriggerServerEvent('esx_smallresources:trunk:server:setTrunkBusy', plate, nil) - SetEntityCoords(ped, vehCoords.x, vehCoords.y, vehCoords.z) - SetEntityCollision(PlayerPedId(), true, true) - TrunkCam(false) - else - ESX.ShowNotification( _U("trunk_closed"), 'error', 2500) - end - end - else - ESX.ShowNotification( _U("someone_in_trunk"), 'error', 2500) - end - else - ESX.ShowNotification( _U("already_in_trunk"), 'error', 2500) - end - else - ESX.ShowNotification( _U("cant_enter_trunk"), 'error', 2500) - end - end, plate) - else - ESX.ShowNotification( _U("cant_enter_trunk"), 'error', 2500) - end +RegisterNetEvent("esx-trunk:client:KidnapGetIn", function(veh) + local ped = PlayerPedId() + local closestVehicle = veh + local vehClass = GetVehicleClass(closestVehicle) + local plate = GetVehicleNumberPlateText(closestVehicle) + if Config.TrunkClasses[vehClass].allowed then + ESX.TriggerServerCallback("esx-trunk:server:getTrunkBusy", function(isBusy) + if not disabledTrunk[GetEntityModel(closestVehicle)] then + if not inTrunk then + if not isBusy then + if not isKidnapped then + if GetVehicleDoorAngleRatio(closestVehicle, 5) > 0 then + local offset = { + x = Config.TrunkClasses[vehClass].x, + y = Config.TrunkClasses[vehClass].y, + z = Config.TrunkClasses[vehClass].z, + } + RequestAnimDict("fin_ext_p1-7") + while not HasAnimDictLoaded("fin_ext_p1-7") do + Wait(0) + end + TaskPlayAnim(ped, "fin_ext_p1-7", "cs_devin_dual-7", 8.0, 8.0, -1, 1, 999.0, 0, 0, 0) + AttachEntityToEntity( + ped, + closestVehicle, + 0, + offset.x, + offset.y, + offset.z, + 0, + 0, + 40.0, + 1, + 1, + 1, + 1, + 1, + 1 + ) + TriggerServerEvent("esx-trunk:server:setTrunkBusy", plate, true) + inTrunk = true + Wait(500) + SetVehicleDoorShut(closestVehicle, 5, false) + ESX.ShowNotification(_U("entered_trunk"), "success", 4000) + TrunkCam(true) + isKidnapped = true + else + ESX.ShowNotification(_U("trunk_closed"), "error", 2500) + end + else + local vehicle = GetEntityAttachedTo(ped) + plate = GetVehicleNumberPlateText(vehicle) + if GetVehicleDoorAngleRatio(vehicle, 5) > 0 then + local vehCoords = GetOffsetFromEntityInWorldCoords(vehicle, 0, -5.0, 0) + DetachEntity(ped, true, true) + ClearPedTasks(ped) + inTrunk = false + TriggerServerEvent("esx_smallresources:trunk:server:setTrunkBusy", plate, nil) + SetEntityCoords(ped, vehCoords.x, vehCoords.y, vehCoords.z) + SetEntityCollision(PlayerPedId(), true, true) + TrunkCam(false) + else + ESX.ShowNotification(_U("trunk_closed"), "error", 2500) + end + end + else + ESX.ShowNotification(_U("someone_in_trunk"), "error", 2500) + end + else + ESX.ShowNotification(_U("already_in_trunk"), "error", 2500) + end + else + ESX.ShowNotification(_U("cant_enter_trunk"), "error", 2500) + end + end, plate) + else + ESX.ShowNotification(_U("cant_enter_trunk"), "error", 2500) + end end) -RegisterNetEvent('esx-trunk:client:GetIn', function() - local ped = PlayerPedId() - local closestVehicle = getNearestVeh() - if closestVehicle ~= 0 then - local vehClass = GetVehicleClass(closestVehicle) - local plate = GetVehicleNumberPlateText(closestVehicle) - if Config.TrunkClasses[vehClass].allowed then - ESX.TriggerServerCallback('esx-trunk:server:getTrunkBusy', function(isBusy) - if not disabledTrunk[GetEntityModel(closestVehicle)] then - if not inTrunk then - if not isBusy then - if GetVehicleDoorAngleRatio(closestVehicle, 5) > 0 then - local offset = { - x = Config.TrunkClasses[vehClass].x, - y = Config.TrunkClasses[vehClass].y, - z = Config.TrunkClasses[vehClass].z, - } - RequestAnimDict("fin_ext_p1-7") - while not HasAnimDictLoaded("fin_ext_p1-7") do - Wait(0) - end - TaskPlayAnim(ped, "fin_ext_p1-7", "cs_devin_dual-7", 8.0, 8.0, -1, 1, 999.0, 0, 0, 0) - AttachEntityToEntity(ped, closestVehicle, 0, offset.x, offset.y, offset.z, 0, 0, 40.0, 1, 1, 1, 1, 1, 1) - TriggerServerEvent('esx-trunk:server:setTrunkBusy', plate, true) - inTrunk = true - Wait(500) - SetVehicleDoorShut(closestVehicle, 5, false) - ESX.ShowNotification( _U("entered_trunk"), 'success', 4000) - TrunkCam(true) - else - ESX.ShowNotification( _U("trunk_closed"), 'error', 2500) - end - else - ESX.ShowNotification( _U("someone_in_trunk"), 'error', 2500) - end - else - ESX.ShowNotification( _U("already_in_trunk"), 'error', 2500) - end - else - ESX.ShowNotification( _U("cant_enter_trunk"), 'error', 2500) - end - end, plate) - else - ESX.ShowNotification( _U("cant_enter_trunk"), 'error', 2500) - end - else - ESX.ShowNotification( _U("no_vehicle_found"), 'error', 2500) - end +RegisterNetEvent("esx-trunk:client:GetIn", function() + local ped = PlayerPedId() + local closestVehicle = getNearestVeh() + if closestVehicle ~= 0 then + local vehClass = GetVehicleClass(closestVehicle) + local plate = GetVehicleNumberPlateText(closestVehicle) + if Config.TrunkClasses[vehClass].allowed then + ESX.TriggerServerCallback("esx-trunk:server:getTrunkBusy", function(isBusy) + if not disabledTrunk[GetEntityModel(closestVehicle)] then + if not inTrunk then + if not isBusy then + if GetVehicleDoorAngleRatio(closestVehicle, 5) > 0 then + local offset = { + x = Config.TrunkClasses[vehClass].x, + y = Config.TrunkClasses[vehClass].y, + z = Config.TrunkClasses[vehClass].z, + } + RequestAnimDict("fin_ext_p1-7") + while not HasAnimDictLoaded("fin_ext_p1-7") do + Wait(0) + end + TaskPlayAnim(ped, "fin_ext_p1-7", "cs_devin_dual-7", 8.0, 8.0, -1, 1, 999.0, 0, 0, 0) + AttachEntityToEntity( + ped, + closestVehicle, + 0, + offset.x, + offset.y, + offset.z, + 0, + 0, + 40.0, + 1, + 1, + 1, + 1, + 1, + 1 + ) + TriggerServerEvent("esx-trunk:server:setTrunkBusy", plate, true) + inTrunk = true + Wait(500) + SetVehicleDoorShut(closestVehicle, 5, false) + ESX.ShowNotification(_U("entered_trunk"), "success", 4000) + TrunkCam(true) + else + ESX.ShowNotification(_U("trunk_closed"), "error", 2500) + end + else + ESX.ShowNotification(_U("someone_in_trunk"), "error", 2500) + end + else + ESX.ShowNotification(_U("already_in_trunk"), "error", 2500) + end + else + ESX.ShowNotification(_U("cant_enter_trunk"), "error", 2500) + end + end, plate) + else + ESX.ShowNotification(_U("cant_enter_trunk"), "error", 2500) + end + else + ESX.ShowNotification(_U("no_vehicle_found"), "error", 2500) + end end) -- Threads CreateThread(function() - while true do - local sleep = 1000 - local vehicle = GetEntityAttachedTo(PlayerPedId()) - local drawPos = GetOffsetFromEntityInWorldCoords(vehicle, 0, -5.5, 0) - local vehHeading = GetEntityHeading(vehicle) - if cam then - sleep = 0 - SetCamRot(cam, -2.5, 0.0, vehHeading, 0.0) - SetCamCoord(cam, drawPos.x, drawPos.y, drawPos.z + 2) - end - Wait(sleep) - end + while true do + local sleep = 1000 + local vehicle = GetEntityAttachedTo(PlayerPedId()) + local drawPos = GetOffsetFromEntityInWorldCoords(vehicle, 0, -5.5, 0) + local vehHeading = GetEntityHeading(vehicle) + if cam then + sleep = 0 + SetCamRot(cam, -2.5, 0.0, vehHeading, 0.0) + SetCamCoord(cam, drawPos.x, drawPos.y, drawPos.z + 2) + end + Wait(sleep) + end end) CreateThread(function() - while true do - local sleep = 1000 - if inTrunk then - if not isKidnapped then - local ped = PlayerPedId() - local vehicle = GetEntityAttachedTo(ped) - local drawPos = GetOffsetFromEntityInWorldCoords(vehicle, 0, -2.5, 0) - local plate = GetVehicleNumberPlateText(vehicle) - if DoesEntityExist(vehicle) then - sleep = 0 - DrawText3Ds(drawPos.x, drawPos.y, drawPos.z + 0.75, _U("get_out_trunk_button")) - if IsControlJustPressed(0, 38) then - if GetVehicleDoorAngleRatio(vehicle, 5) > 0 then - local vehCoords = GetOffsetFromEntityInWorldCoords(vehicle, 0, -5.0, 0) - DetachEntity(ped, true, true) - ClearPedTasks(ped) - inTrunk = false - TriggerServerEvent('esx-trunk:server:setTrunkBusy', plate, false) - SetEntityCoords(ped, vehCoords.x, vehCoords.y, vehCoords.z) - SetEntityCollision(ped, true, true) - TrunkCam(false) - else - ESX.ShowNotification( _U("trunk_closed"), 2500, 'error') - end - Wait(100) - end - if GetVehicleDoorAngleRatio(vehicle, 5) > 0 then - DrawText3Ds(drawPos.x, drawPos.y, drawPos.z + 0.5, _U("close_trunk_button")) - if IsControlJustPressed(0, 47) then - if not IsVehicleSeatFree(vehicle, -1) then - TriggerServerEvent('esx-radialmenu:trunk:server:Door', false, plate, 5) - else - SetVehicleDoorShut(vehicle, 5, false) - end - Wait(100) - end - else - DrawText3Ds(drawPos.x, drawPos.y, drawPos.z + 0.5, _U("open_trunk_button")) - if IsControlJustPressed(0, 47) then - if not IsVehicleSeatFree(vehicle, -1) then - TriggerServerEvent('esx-radialmenu:trunk:server:Door', true, plate, 5) - else - SetVehicleDoorOpen(vehicle, 5, false, false) - end - Wait(100) - end - end - end - end - end - Wait(sleep) - end -end) \ No newline at end of file + while true do + local sleep = 1000 + if inTrunk then + if not isKidnapped then + local ped = PlayerPedId() + local vehicle = GetEntityAttachedTo(ped) + local drawPos = GetOffsetFromEntityInWorldCoords(vehicle, 0, -2.5, 0) + local plate = GetVehicleNumberPlateText(vehicle) + if DoesEntityExist(vehicle) then + sleep = 0 + DrawText3Ds(drawPos.x, drawPos.y, drawPos.z + 0.75, _U("get_out_trunk_button")) + if IsControlJustPressed(0, 38) then + if GetVehicleDoorAngleRatio(vehicle, 5) > 0 then + local vehCoords = GetOffsetFromEntityInWorldCoords(vehicle, 0, -5.0, 0) + DetachEntity(ped, true, true) + ClearPedTasks(ped) + inTrunk = false + TriggerServerEvent("esx-trunk:server:setTrunkBusy", plate, false) + SetEntityCoords(ped, vehCoords.x, vehCoords.y, vehCoords.z) + SetEntityCollision(ped, true, true) + TrunkCam(false) + else + ESX.ShowNotification(_U("trunk_closed"), 2500, "error") + end + Wait(100) + end + if GetVehicleDoorAngleRatio(vehicle, 5) > 0 then + DrawText3Ds(drawPos.x, drawPos.y, drawPos.z + 0.5, _U("close_trunk_button")) + if IsControlJustPressed(0, 47) then + if not IsVehicleSeatFree(vehicle, -1) then + TriggerServerEvent("esx-radialmenu:trunk:server:Door", false, plate, 5) + else + SetVehicleDoorShut(vehicle, 5, false) + end + Wait(100) + end + else + DrawText3Ds(drawPos.x, drawPos.y, drawPos.z + 0.5, _U("open_trunk_button")) + if IsControlJustPressed(0, 47) then + if not IsVehicleSeatFree(vehicle, -1) then + TriggerServerEvent("esx-radialmenu:trunk:server:Door", true, plate, 5) + else + SetVehicleDoorOpen(vehicle, 5, false, false) + end + Wait(100) + end + end + end + end + end + Wait(sleep) + end +end) diff --git a/server-data/resources/[esx_addons]/esx-radialmenu/config.lua b/server-data/resources/[esx_addons]/esx-radialmenu/config.lua index 32cd10217..22bac55cd 100644 --- a/server-data/resources/[esx_addons]/esx-radialmenu/config.lua +++ b/server-data/resources/[esx_addons]/esx-radialmenu/config.lua @@ -1,893 +1,995 @@ Config = {} -Config.Locale = 'fr' -Config.Keybind = 'F1' -- FiveM Keyboard, this is registered keymapping, so needs changed in keybindings if player already has this mapped. +Config.Locale = "fr" +Config.Keybind = "F1" -- FiveM Keyboard, this is registered keymapping, so needs changed in keybindings if player already has this mapped. Config.Toggle = false -- use toggle mode. False requires hold of key Config.UseWhilstWalking = false -- use whilst walking Config.EnableExtraMenu = true Config.Fliptime = 10000 - - Config.MenuItems = { - [1] = { - id = 'citizen', - title = 'Citizen', - icon = 'user', - items = { - { - id = 'givenum', - title = 'Give Contact Details', - icon = 'address-book', - type = 'client', - event = 'esx_phone:client:GiveContactDetails', - shouldClose = true - }, { - id = 'getintrunk', - title = 'Get In Trunk', - icon = 'car', - type = 'client', - event = 'esx-trunk:client:GetIn', - shouldClose = true - }, - { - id = 'interactions', - title = 'Interaction', - icon = 'triangle-exclamation', - items = { - { - id = 'handcuff', - title = 'Cuff', - icon = 'user-lock', - type = 'client', - event = 'police:client:CuffPlayerSoft', - shouldClose = true - }, { - id = 'playerinvehicle', - title = 'Put In Vehicle', - icon = 'car-side', - type = 'client', - event = 'police:client:PutPlayerInVehicle', - shouldClose = true - }, { - id = 'playeroutvehicle', - title = 'Take Out Of Vehicle', - icon = 'car-side', - type = 'client', - event = 'police:client:SetPlayerOutVehicle', - shouldClose = true - }, { - id = 'stealplayer', - title = 'Rob', - icon = 'mask', - type = 'client', - event = 'police:client:RobPlayer', - shouldClose = true - }, { - id = 'escort', - title = 'Kidnap', - icon = 'user-group', - type = 'client', - event = 'police:client:KidnapPlayer', - shouldClose = true - }, { - id = 'escort2', - title = 'Escort', - icon = 'user-group', - type = 'client', - event = 'police:client:EscortPlayer', - shouldClose = true - }, { - id = 'escort554', - title = 'Hostage', - icon = 'child', - type = 'client', - event = 'A5:Client:TakeHostage', - shouldClose = true - } - } - } - } - }, - [2] = { - id = 'general', - title = 'General', - icon = 'rectangle-list', - items = { - { - id = 'house', - title = 'House Interaction', - icon = 'house', - items = { - { - id = 'givehousekey', - title = 'Give House Keys', - icon = 'key', - type = 'client', - event = 'esx_houses:client:giveHouseKey', - shouldClose = true - }, { - id = 'removehousekey', - title = 'Remove House Keys', - icon = 'key', - type = 'client', - event = 'esx_houses:client:removeHouseKey', - shouldClose = true - }, { - id = 'togglelock', - title = 'Toggle Doorlock', - icon = 'door-closed', - type = 'client', - event = 'esx_houses:client:toggleDoorlock', - shouldClose = true - }, { - id = 'decoratehouse', - title = 'Decorate House', - icon = 'box', - type = 'client', - event = 'esx_houses:client:decorate', - shouldClose = true - }, { - id = 'houseLocations', - title = 'Interaction Locations', - icon = 'house', - items = { - { - id = 'setstash', - title = 'Set Stash', - icon = 'box-open', - type = 'client', - event = 'esx_houses:client:setLocation', - shouldClose = true - }, { - id = 'setoutift', - title = 'Set Wardrobe', - icon = 'shirt', - type = 'client', - event = 'esx_houses:client:setLocation', - shouldClose = true - }, { - id = 'setlogout', - title = 'Set Logout', - icon = 'door-open', - type = 'client', - event = 'esx_houses:client:setLocation', - shouldClose = true - } - } - } - } - }, { - id = 'clothesmenu', - title = 'Clothing', - icon = 'shirt', - items = { - { - id = 'Hair', - title = 'Hair', - icon = 'user', - type = 'client', - event = 'esx-radialmenu:ToggleClothing', - shouldClose = true - }, { - id = 'Ear', - title = 'Ear Piece', - icon = 'ear-deaf', - type = 'client', - event = 'esx-radialmenu:ToggleProps', - shouldClose = true - }, { - id = 'Neck', - title = 'Neck', - icon = 'user-tie', - type = 'client', - event = 'esx-radialmenu:ToggleClothing', - shouldClose = true - }, { - id = 'Top', - title = 'Top', - icon = 'shirt', - type = 'client', - event = 'esx-radialmenu:ToggleClothing', - shouldClose = true - }, { - id = 'Shirt', - title = 'Shirt', - icon = 'shirt', - type = 'client', - event = 'esx-radialmenu:ToggleClothing', - shouldClose = true - }, { - id = 'Pants', - title = 'Pants', - icon = 'user', - type = 'client', - event = 'esx-radialmenu:ToggleClothing', - shouldClose = true - }, { - id = 'Shoes', - title = 'Shoes', - icon = 'shoe-prints', - type = 'client', - event = 'esx-radialmenu:ToggleClothing', - shouldClose = true - }, { - id = 'meer', - title = 'Extras', - icon = 'plus', - items = { - { - id = 'Hat', - title = 'Hat', - icon = 'hat-cowboy-side', - type = 'client', - event = 'esx-radialmenu:ToggleProps', - shouldClose = true - }, { - id = 'Glasses', - title = 'Glasses', - icon = 'glasses', - type = 'client', - event = 'esx-radialmenu:ToggleProps', - shouldClose = true - }, { - id = 'Visor', - title = 'Visor', - icon = 'hat-cowboy-side', - type = 'client', - event = 'esx-radialmenu:ToggleProps', - shouldClose = true - }, { - id = 'Mask', - title = 'Mask', - icon = 'masks-theater', - type = 'client', - event = 'esx-radialmenu:ToggleClothing', - shouldClose = true - }, { - id = 'Vest', - title = 'Vest', - icon = 'vest', - type = 'client', - event = 'esx-radialmenu:ToggleClothing', - shouldClose = true - }, { - id = 'Bag', - title = 'Bag', - icon = 'bag-shopping', - type = 'client', - event = 'esx-radialmenu:ToggleClothing', - shouldClose = true - }, { - id = 'Bracelet', - title = 'Bracelet', - icon = 'user', - type = 'client', - event = 'esx-radialmenu:ToggleProps', - shouldClose = true - }, { - id = 'Watch', - title = 'Watch', - icon = 'stopwatch', - type = 'client', - event = 'esx-radialmenu:ToggleProps', - shouldClose = true - }, { - id = 'Gloves', - title = 'Gloves', - icon = 'mitten', - type = 'client', - event = 'esx-radialmenu:ToggleClothing', - shouldClose = true - } - } - } - } - } - } - }, + [1] = { + id = "citizen", + title = "Citizen", + icon = "user", + items = { + { + id = "givenum", + title = "Give Contact Details", + icon = "address-book", + type = "client", + event = "esx_phone:client:GiveContactDetails", + shouldClose = true, + }, + { + id = "getintrunk", + title = "Get In Trunk", + icon = "car", + type = "client", + event = "esx-trunk:client:GetIn", + shouldClose = true, + }, + { + id = "interactions", + title = "Interaction", + icon = "triangle-exclamation", + items = { + { + id = "handcuff", + title = "Cuff", + icon = "user-lock", + type = "client", + event = "police:client:CuffPlayerSoft", + shouldClose = true, + }, + { + id = "playerinvehicle", + title = "Put In Vehicle", + icon = "car-side", + type = "client", + event = "police:client:PutPlayerInVehicle", + shouldClose = true, + }, + { + id = "playeroutvehicle", + title = "Take Out Of Vehicle", + icon = "car-side", + type = "client", + event = "police:client:SetPlayerOutVehicle", + shouldClose = true, + }, + { + id = "stealplayer", + title = "Rob", + icon = "mask", + type = "client", + event = "police:client:RobPlayer", + shouldClose = true, + }, + { + id = "escort", + title = "Kidnap", + icon = "user-group", + type = "client", + event = "police:client:KidnapPlayer", + shouldClose = true, + }, + { + id = "escort2", + title = "Escort", + icon = "user-group", + type = "client", + event = "police:client:EscortPlayer", + shouldClose = true, + }, + { + id = "escort554", + title = "Hostage", + icon = "child", + type = "client", + event = "A5:Client:TakeHostage", + shouldClose = true, + }, + }, + }, + }, + }, + [2] = { + id = "general", + title = "General", + icon = "rectangle-list", + items = { + { + id = "house", + title = "House Interaction", + icon = "house", + items = { + { + id = "givehousekey", + title = "Give House Keys", + icon = "key", + type = "client", + event = "esx_houses:client:giveHouseKey", + shouldClose = true, + }, + { + id = "removehousekey", + title = "Remove House Keys", + icon = "key", + type = "client", + event = "esx_houses:client:removeHouseKey", + shouldClose = true, + }, + { + id = "togglelock", + title = "Toggle Doorlock", + icon = "door-closed", + type = "client", + event = "esx_houses:client:toggleDoorlock", + shouldClose = true, + }, + { + id = "decoratehouse", + title = "Decorate House", + icon = "box", + type = "client", + event = "esx_houses:client:decorate", + shouldClose = true, + }, + { + id = "houseLocations", + title = "Interaction Locations", + icon = "house", + items = { + { + id = "setstash", + title = "Set Stash", + icon = "box-open", + type = "client", + event = "esx_houses:client:setLocation", + shouldClose = true, + }, + { + id = "setoutift", + title = "Set Wardrobe", + icon = "shirt", + type = "client", + event = "esx_houses:client:setLocation", + shouldClose = true, + }, + { + id = "setlogout", + title = "Set Logout", + icon = "door-open", + type = "client", + event = "esx_houses:client:setLocation", + shouldClose = true, + }, + }, + }, + }, + }, + { + id = "clothesmenu", + title = "Clothing", + icon = "shirt", + items = { + { + id = "Hair", + title = "Hair", + icon = "user", + type = "client", + event = "esx-radialmenu:ToggleClothing", + shouldClose = true, + }, + { + id = "Ear", + title = "Ear Piece", + icon = "ear-deaf", + type = "client", + event = "esx-radialmenu:ToggleProps", + shouldClose = true, + }, + { + id = "Neck", + title = "Neck", + icon = "user-tie", + type = "client", + event = "esx-radialmenu:ToggleClothing", + shouldClose = true, + }, + { + id = "Top", + title = "Top", + icon = "shirt", + type = "client", + event = "esx-radialmenu:ToggleClothing", + shouldClose = true, + }, + { + id = "Shirt", + title = "Shirt", + icon = "shirt", + type = "client", + event = "esx-radialmenu:ToggleClothing", + shouldClose = true, + }, + { + id = "Pants", + title = "Pants", + icon = "user", + type = "client", + event = "esx-radialmenu:ToggleClothing", + shouldClose = true, + }, + { + id = "Shoes", + title = "Shoes", + icon = "shoe-prints", + type = "client", + event = "esx-radialmenu:ToggleClothing", + shouldClose = true, + }, + { + id = "meer", + title = "Extras", + icon = "plus", + items = { + { + id = "Hat", + title = "Hat", + icon = "hat-cowboy-side", + type = "client", + event = "esx-radialmenu:ToggleProps", + shouldClose = true, + }, + { + id = "Glasses", + title = "Glasses", + icon = "glasses", + type = "client", + event = "esx-radialmenu:ToggleProps", + shouldClose = true, + }, + { + id = "Visor", + title = "Visor", + icon = "hat-cowboy-side", + type = "client", + event = "esx-radialmenu:ToggleProps", + shouldClose = true, + }, + { + id = "Mask", + title = "Mask", + icon = "masks-theater", + type = "client", + event = "esx-radialmenu:ToggleClothing", + shouldClose = true, + }, + { + id = "Vest", + title = "Vest", + icon = "vest", + type = "client", + event = "esx-radialmenu:ToggleClothing", + shouldClose = true, + }, + { + id = "Bag", + title = "Bag", + icon = "bag-shopping", + type = "client", + event = "esx-radialmenu:ToggleClothing", + shouldClose = true, + }, + { + id = "Bracelet", + title = "Bracelet", + icon = "user", + type = "client", + event = "esx-radialmenu:ToggleProps", + shouldClose = true, + }, + { + id = "Watch", + title = "Watch", + icon = "stopwatch", + type = "client", + event = "esx-radialmenu:ToggleProps", + shouldClose = true, + }, + { + id = "Gloves", + title = "Gloves", + icon = "mitten", + type = "client", + event = "esx-radialmenu:ToggleClothing", + shouldClose = true, + }, + }, + }, + }, + }, + }, + }, } Config.VehicleDoors = { - id = 'vehicledoors', - title = 'Vehicle Doors', - icon = 'car-side', - items = { - { - id = 'door0', - title = 'Drivers door', - icon = 'car-side', - type = 'client', - event = 'esx-radialmenu:client:openDoor', - shouldClose = false - }, { - id = 'door4', - title = 'Hood', - icon = 'car', - type = 'client', - event = 'esx-radialmenu:client:openDoor', - shouldClose = false - }, { - id = 'door1', - title = 'Passengers door', - icon = 'car-side', - type = 'client', - event = 'esx-radialmenu:client:openDoor', - shouldClose = false - }, { - id = 'door3', - title = 'Right rear', - icon = 'car-side', - type = 'client', - event = 'esx-radialmenu:client:openDoor', - shouldClose = false - }, { - id = 'door5', - title = 'Trunk', - icon = 'car', - type = 'client', - event = 'esx-radialmenu:client:openDoor', - shouldClose = false - }, { - id = 'door2', - title = 'Left rear', - icon = 'car-side', - type = 'client', - event = 'esx-radialmenu:client:openDoor', - shouldClose = false - } - } + id = "vehicledoors", + title = "Vehicle Doors", + icon = "car-side", + items = { + { + id = "door0", + title = "Drivers door", + icon = "car-side", + type = "client", + event = "esx-radialmenu:client:openDoor", + shouldClose = false, + }, + { + id = "door4", + title = "Hood", + icon = "car", + type = "client", + event = "esx-radialmenu:client:openDoor", + shouldClose = false, + }, + { + id = "door1", + title = "Passengers door", + icon = "car-side", + type = "client", + event = "esx-radialmenu:client:openDoor", + shouldClose = false, + }, + { + id = "door3", + title = "Right rear", + icon = "car-side", + type = "client", + event = "esx-radialmenu:client:openDoor", + shouldClose = false, + }, + { + id = "door5", + title = "Trunk", + icon = "car", + type = "client", + event = "esx-radialmenu:client:openDoor", + shouldClose = false, + }, + { + id = "door2", + title = "Left rear", + icon = "car-side", + type = "client", + event = "esx-radialmenu:client:openDoor", + shouldClose = false, + }, + }, } Config.VehicleExtras = { - id = 'vehicleextras', - title = 'Vehicle Extras', - icon = 'plus', - items = { - { - id = 'extra1', - title = 'Extra 1', - icon = 'box-open', - type = 'client', - event = 'esx-radialmenu:client:setExtra', - shouldClose = false - }, { - id = 'extra2', - title = 'Extra 2', - icon = 'box-open', - type = 'client', - event = 'esx-radialmenu:client:setExtra', - shouldClose = false - }, { - id = 'extra3', - title = 'Extra 3', - icon = 'box-open', - type = 'client', - event = 'esx-radialmenu:client:setExtra', - shouldClose = false - }, { - id = 'extra4', - title = 'Extra 4', - icon = 'box-open', - type = 'client', - event = 'esx-radialmenu:client:setExtra', - shouldClose = false - }, { - id = 'extra5', - title = 'Extra 5', - icon = 'box-open', - type = 'client', - event = 'esx-radialmenu:client:setExtra', - shouldClose = false - }, { - id = 'extra6', - title = 'Extra 6', - icon = 'box-open', - type = 'client', - event = 'esx-radialmenu:client:setExtra', - shouldClose = false - }, { - id = 'extra7', - title = 'Extra 7', - icon = 'box-open', - type = 'client', - event = 'esx-radialmenu:client:setExtra', - shouldClose = false - }, { - id = 'extra8', - title = 'Extra 8', - icon = 'box-open', - type = 'client', - event = 'esx-radialmenu:client:setExtra', - shouldClose = false - }, { - id = 'extra9', - title = 'Extra 9', - icon = 'box-open', - type = 'client', - event = 'esx-radialmenu:client:setExtra', - shouldClose = false - }, { - id = 'extra10', - title = 'Extra 10', - icon = 'box-open', - type = 'client', - event = 'esx-radialmenu:client:setExtra', - shouldClose = false - }, { - id = 'extra11', - title = 'Extra 11', - icon = 'box-open', - type = 'client', - event = 'esx-radialmenu:client:setExtra', - shouldClose = false - }, { - id = 'extra12', - title = 'Extra 12', - icon = 'box-open', - type = 'client', - event = 'esx-radialmenu:client:setExtra', - shouldClose = false - }, { - id = 'extra13', - title = 'Extra 13', - icon = 'box-open', - type = 'client', - event = 'esx-radialmenu:client:setExtra', - shouldClose = false - } - } + id = "vehicleextras", + title = "Vehicle Extras", + icon = "plus", + items = { + { + id = "extra1", + title = "Extra 1", + icon = "box-open", + type = "client", + event = "esx-radialmenu:client:setExtra", + shouldClose = false, + }, + { + id = "extra2", + title = "Extra 2", + icon = "box-open", + type = "client", + event = "esx-radialmenu:client:setExtra", + shouldClose = false, + }, + { + id = "extra3", + title = "Extra 3", + icon = "box-open", + type = "client", + event = "esx-radialmenu:client:setExtra", + shouldClose = false, + }, + { + id = "extra4", + title = "Extra 4", + icon = "box-open", + type = "client", + event = "esx-radialmenu:client:setExtra", + shouldClose = false, + }, + { + id = "extra5", + title = "Extra 5", + icon = "box-open", + type = "client", + event = "esx-radialmenu:client:setExtra", + shouldClose = false, + }, + { + id = "extra6", + title = "Extra 6", + icon = "box-open", + type = "client", + event = "esx-radialmenu:client:setExtra", + shouldClose = false, + }, + { + id = "extra7", + title = "Extra 7", + icon = "box-open", + type = "client", + event = "esx-radialmenu:client:setExtra", + shouldClose = false, + }, + { + id = "extra8", + title = "Extra 8", + icon = "box-open", + type = "client", + event = "esx-radialmenu:client:setExtra", + shouldClose = false, + }, + { + id = "extra9", + title = "Extra 9", + icon = "box-open", + type = "client", + event = "esx-radialmenu:client:setExtra", + shouldClose = false, + }, + { + id = "extra10", + title = "Extra 10", + icon = "box-open", + type = "client", + event = "esx-radialmenu:client:setExtra", + shouldClose = false, + }, + { + id = "extra11", + title = "Extra 11", + icon = "box-open", + type = "client", + event = "esx-radialmenu:client:setExtra", + shouldClose = false, + }, + { + id = "extra12", + title = "Extra 12", + icon = "box-open", + type = "client", + event = "esx-radialmenu:client:setExtra", + shouldClose = false, + }, + { + id = "extra13", + title = "Extra 13", + icon = "box-open", + type = "client", + event = "esx-radialmenu:client:setExtra", + shouldClose = false, + }, + }, } Config.VehicleSeats = { - id = 'vehicleseats', - title = 'Vehicle Seats', - icon = 'chair', - items = {} + id = "vehicleseats", + title = "Vehicle Seats", + icon = "chair", + items = {}, } Config.JobInteractions = { - ["ambulance"] = { - { - id = 'statuscheck', - title = 'Check Health Status', - icon = 'heart-pulse', - type = 'client', - event = 'hospital:client:CheckStatus', - shouldClose = true - },{ - id = 'revivep', - title = 'Revive', - icon = 'user-doctor', - type = 'client', - event = 'hospital:client:RevivePlayer', - shouldClose = true - },{ - id = 'treatwounds', - title = 'Heal wounds', - icon = 'bandage', - type = 'client', - event = 'hospital:client:TreatWounds', - shouldClose = true - }, { - id = 'emergencybutton2', - title = 'Emergency button', - icon = 'bell', - type = 'client', - event = 'police:client:SendPoliceEmergencyAlert', - shouldClose = true - }, { - id = 'escort', - title = 'Escort', - icon = 'user-group', - type = 'client', - event = 'police:client:EscortPlayer', - shouldClose = true - }, { - id = 'stretcheroptions', - title = 'Stretcher', - icon = 'bed-pulse', - items = { - { - id = 'spawnstretcher', - title = 'Spawn Stretcher', - icon = 'plus', - type = 'client', - event = 'esx-radialmenu:client:TakeStretcher', - shouldClose = false - }, { - id = 'despawnstretcher', - title = 'Remove Stretcher', - icon = 'minus', - type = 'client', - event = 'esx-radialmenu:client:RemoveStretcher', - shouldClose = false - } - } - } - }, - ["taxi"] = { - { - id = 'togglemeter', - title = 'Show/Hide Meter', - icon = 'eye-slash', - type = 'client', - event = 'esx_taxi:client:toggleMeter', - shouldClose = false - }, { - id = 'togglemouse', - title = 'Start/Stop Meter', - icon = 'hourglass-start', - type = 'client', - event = 'esx_taxi:client:enableMeter', - shouldClose = true - }, { - id = 'npc_mission', - title = 'NPC Mission', - icon = 'taxi', - type = 'client', - event = 'esx_taxi:client:DoTaxiNpc', - shouldClose = true - } - }, - ["tow"] = { - { - id = 'togglenpc', - title = 'Toggle NPC', - icon = 'toggle-on', - type = 'client', - event = 'jobs:client:ToggleNpc', - shouldClose = true - }, { - id = 'towvehicle', - title = 'Tow vehicle', - icon = 'truck-pickup', - type = 'client', - event = 'esx_tow:client:TowVehicle', - shouldClose = true - } - }, - ["mechanic"] = { - { - id = 'towvehicle', - title = 'Tow vehicle', - icon = 'truck-pickup', - type = 'client', - event = 'esx_tow:client:TowVehicle', - shouldClose = true - } - }, - ["police"] = { - { - id = 'emergencybutton', - title = 'Emergency button', - icon = 'bell', - type = 'client', - event = 'police:client:SendPoliceEmergencyAlert', - shouldClose = true - }, { - id = 'checkvehstatus', - title = 'Check Tune Status', - icon = 'circle-info', - type = 'client', - event = 'esx_tunerchip:client:TuneStatus', - shouldClose = true - }, { - id = 'resethouse', - title = 'Reset house lock', - icon = 'key', - type = 'client', - event = 'esx_houses:client:ResetHouse', - shouldClose = true - }, { - id = 'takedriverlicense', - title = 'Revoke Drivers License', - icon = 'id-card', - type = 'client', - event = 'police:client:SeizeDriverLicense', - shouldClose = true - }, { - id = 'policeinteraction', - title = 'Police Actions', - icon = 'list-check', - items = { - { - id = 'statuscheck', - title = 'Check Health Status', - icon = 'heart-pulse', - type = 'client', - event = 'hospital:client:CheckStatus', - shouldClose = true - }, { - id = 'checkstatus', - title = 'Check status', - icon = 'question', - type = 'client', - event = 'police:client:CheckStatus', - shouldClose = true - }, { - id = 'escort', - title = 'Escort', - icon = 'user-group', - type = 'client', - event = 'police:client:EscortPlayer', - shouldClose = true - }, { - id = 'searchplayer', - title = 'Search', - icon = 'magnifying-glass', - type = 'client', - event = 'police:client:SearchPlayer', - shouldClose = true - }, { - id = 'jailplayer', - title = 'Jail', - icon = 'user-lock', - type = 'client', - event = 'police:client:JailPlayer', - shouldClose = true - } - } - }, { - id = 'policeobjects', - title = 'Objects', - icon = 'road', - items = { - { - id = 'spawnpion', - title = 'Cone', - icon = 'triangle-exclamation', - type = 'client', - event = 'police:client:spawnCone', - shouldClose = false - }, { - id = 'spawnhek', - title = 'Gate', - icon = 'torii-gate', - type = 'client', - event = 'police:client:spawnBarrier', - shouldClose = false - }, { - id = 'spawnschotten', - title = 'Speed Limit Sign', - icon = 'sign-hanging', - type = 'client', - event = 'police:client:spawnRoadSign', - shouldClose = false - }, { - id = 'spawntent', - title = 'Tent', - icon = 'campground', - type = 'client', - event = 'police:client:spawnTent', - shouldClose = false - }, { - id = 'spawnverlichting', - title = 'Lighting', - icon = 'lightbulb', - type = 'client', - event = 'police:client:spawnLight', - shouldClose = false - }, { - id = 'spikestrip', - title = 'Spike Strips', - icon = 'caret-up', - type = 'client', - event = 'police:client:SpawnSpikeStrip', - shouldClose = false - }, { - id = 'deleteobject', - title = 'Remove object', - icon = 'trash', - type = 'client', - event = 'police:client:deleteObject', - shouldClose = false - } - } - } - }, - ["hotdog"] = { - { - id = 'togglesell', - title = 'Toggle sell', - icon = 'hotdog', - type = 'client', - event = 'esx_hotdogjob:client:ToggleSell', - shouldClose = true - } - } + ["ambulance"] = { + { + id = "statuscheck", + title = "Check Health Status", + icon = "heart-pulse", + type = "client", + event = "hospital:client:CheckStatus", + shouldClose = true, + }, + { + id = "revivep", + title = "Revive", + icon = "user-doctor", + type = "client", + event = "hospital:client:RevivePlayer", + shouldClose = true, + }, + { + id = "treatwounds", + title = "Heal wounds", + icon = "bandage", + type = "client", + event = "hospital:client:TreatWounds", + shouldClose = true, + }, + { + id = "emergencybutton2", + title = "Emergency button", + icon = "bell", + type = "client", + event = "police:client:SendPoliceEmergencyAlert", + shouldClose = true, + }, + { + id = "escort", + title = "Escort", + icon = "user-group", + type = "client", + event = "police:client:EscortPlayer", + shouldClose = true, + }, + { + id = "stretcheroptions", + title = "Stretcher", + icon = "bed-pulse", + items = { + { + id = "spawnstretcher", + title = "Spawn Stretcher", + icon = "plus", + type = "client", + event = "esx-radialmenu:client:TakeStretcher", + shouldClose = false, + }, + { + id = "despawnstretcher", + title = "Remove Stretcher", + icon = "minus", + type = "client", + event = "esx-radialmenu:client:RemoveStretcher", + shouldClose = false, + }, + }, + }, + }, + ["taxi"] = { + { + id = "togglemeter", + title = "Show/Hide Meter", + icon = "eye-slash", + type = "client", + event = "esx_taxi:client:toggleMeter", + shouldClose = false, + }, + { + id = "togglemouse", + title = "Start/Stop Meter", + icon = "hourglass-start", + type = "client", + event = "esx_taxi:client:enableMeter", + shouldClose = true, + }, + { + id = "npc_mission", + title = "NPC Mission", + icon = "taxi", + type = "client", + event = "esx_taxi:client:DoTaxiNpc", + shouldClose = true, + }, + }, + ["tow"] = { + { + id = "togglenpc", + title = "Toggle NPC", + icon = "toggle-on", + type = "client", + event = "jobs:client:ToggleNpc", + shouldClose = true, + }, + { + id = "towvehicle", + title = "Tow vehicle", + icon = "truck-pickup", + type = "client", + event = "esx_tow:client:TowVehicle", + shouldClose = true, + }, + }, + ["mechanic"] = { + { + id = "towvehicle", + title = "Tow vehicle", + icon = "truck-pickup", + type = "client", + event = "esx_tow:client:TowVehicle", + shouldClose = true, + }, + }, + ["police"] = { + { + id = "emergencybutton", + title = "Emergency button", + icon = "bell", + type = "client", + event = "police:client:SendPoliceEmergencyAlert", + shouldClose = true, + }, + { + id = "checkvehstatus", + title = "Check Tune Status", + icon = "circle-info", + type = "client", + event = "esx_tunerchip:client:TuneStatus", + shouldClose = true, + }, + { + id = "resethouse", + title = "Reset house lock", + icon = "key", + type = "client", + event = "esx_houses:client:ResetHouse", + shouldClose = true, + }, + { + id = "takedriverlicense", + title = "Revoke Drivers License", + icon = "id-card", + type = "client", + event = "police:client:SeizeDriverLicense", + shouldClose = true, + }, + { + id = "policeinteraction", + title = "Police Actions", + icon = "list-check", + items = { + { + id = "statuscheck", + title = "Check Health Status", + icon = "heart-pulse", + type = "client", + event = "hospital:client:CheckStatus", + shouldClose = true, + }, + { + id = "checkstatus", + title = "Check status", + icon = "question", + type = "client", + event = "police:client:CheckStatus", + shouldClose = true, + }, + { + id = "escort", + title = "Escort", + icon = "user-group", + type = "client", + event = "police:client:EscortPlayer", + shouldClose = true, + }, + { + id = "searchplayer", + title = "Search", + icon = "magnifying-glass", + type = "client", + event = "police:client:SearchPlayer", + shouldClose = true, + }, + { + id = "jailplayer", + title = "Jail", + icon = "user-lock", + type = "client", + event = "police:client:JailPlayer", + shouldClose = true, + }, + }, + }, + { + id = "policeobjects", + title = "Objects", + icon = "road", + items = { + { + id = "spawnpion", + title = "Cone", + icon = "triangle-exclamation", + type = "client", + event = "police:client:spawnCone", + shouldClose = false, + }, + { + id = "spawnhek", + title = "Gate", + icon = "torii-gate", + type = "client", + event = "police:client:spawnBarrier", + shouldClose = false, + }, + { + id = "spawnschotten", + title = "Speed Limit Sign", + icon = "sign-hanging", + type = "client", + event = "police:client:spawnRoadSign", + shouldClose = false, + }, + { + id = "spawntent", + title = "Tent", + icon = "campground", + type = "client", + event = "police:client:spawnTent", + shouldClose = false, + }, + { + id = "spawnverlichting", + title = "Lighting", + icon = "lightbulb", + type = "client", + event = "police:client:spawnLight", + shouldClose = false, + }, + { + id = "spikestrip", + title = "Spike Strips", + icon = "caret-up", + type = "client", + event = "police:client:SpawnSpikeStrip", + shouldClose = false, + }, + { + id = "deleteobject", + title = "Remove object", + icon = "trash", + type = "client", + event = "police:client:deleteObject", + shouldClose = false, + }, + }, + }, + }, + ["hotdog"] = { + { + id = "togglesell", + title = "Toggle sell", + icon = "hotdog", + type = "client", + event = "esx_hotdogjob:client:ToggleSell", + shouldClose = true, + }, + }, } Config.TrunkClasses = { - [0] = {allowed = true, x = 0.0, y = -1.5, z = 0.0}, -- Coupes - [1] = {allowed = true, x = 0.0, y = -2.0, z = 0.0}, -- Sedans - [2] = {allowed = true, x = 0.0, y = -1.0, z = 0.25}, -- SUVs - [3] = {allowed = true, x = 0.0, y = -1.5, z = 0.0}, -- Coupes - [4] = {allowed = true, x = 0.0, y = -2.0, z = 0.0}, -- Muscle - [5] = {allowed = true, x = 0.0, y = -2.0, z = 0.0}, -- Sports Classics - [6] = {allowed = true, x = 0.0, y = -2.0, z = 0.0}, -- Sports - [7] = {allowed = true, x = 0.0, y = -2.0, z = 0.0}, -- Super - [8] = {allowed = false, x = 0.0, y = -1.0, z = 0.25}, -- Motorcycles - [9] = {allowed = true, x = 0.0, y = -1.0, z = 0.25}, -- Off-road - [10] = {allowed = true, x = 0.0, y = -1.0, z = 0.25}, -- Industrial - [11] = {allowed = true, x = 0.0, y = -1.0, z = 0.25}, -- Utility - [12] = {allowed = true, x = 0.0, y = -1.0, z = 0.25}, -- Vans - [13] = {allowed = true, x = 0.0, y = -1.0, z = 0.25}, -- Cycles - [14] = {allowed = true, x = 0.0, y = -1.0, z = 0.25}, -- Boats - [15] = {allowed = true, x = 0.0, y = -1.0, z = 0.25}, -- Helicopters - [16] = {allowed = true, x = 0.0, y = -1.0, z = 0.25}, -- Planes - [17] = {allowed = true, x = 0.0, y = -1.0, z = 0.25}, -- Service - [18] = {allowed = true, x = 0.0, y = -1.0, z = 0.25}, -- Emergency - [19] = {allowed = true, x = 0.0, y = -1.0, z = 0.25}, -- Military - [20] = {allowed = true, x = 0.0, y = -1.0, z = 0.25}, -- Commercial - [21] = {allowed = true, x = 0.0, y = -1.0, z = 0.25} -- Trains + [0] = { allowed = true, x = 0.0, y = -1.5, z = 0.0 }, -- Coupes + [1] = { allowed = true, x = 0.0, y = -2.0, z = 0.0 }, -- Sedans + [2] = { allowed = true, x = 0.0, y = -1.0, z = 0.25 }, -- SUVs + [3] = { allowed = true, x = 0.0, y = -1.5, z = 0.0 }, -- Coupes + [4] = { allowed = true, x = 0.0, y = -2.0, z = 0.0 }, -- Muscle + [5] = { allowed = true, x = 0.0, y = -2.0, z = 0.0 }, -- Sports Classics + [6] = { allowed = true, x = 0.0, y = -2.0, z = 0.0 }, -- Sports + [7] = { allowed = true, x = 0.0, y = -2.0, z = 0.0 }, -- Super + [8] = { allowed = false, x = 0.0, y = -1.0, z = 0.25 }, -- Motorcycles + [9] = { allowed = true, x = 0.0, y = -1.0, z = 0.25 }, -- Off-road + [10] = { allowed = true, x = 0.0, y = -1.0, z = 0.25 }, -- Industrial + [11] = { allowed = true, x = 0.0, y = -1.0, z = 0.25 }, -- Utility + [12] = { allowed = true, x = 0.0, y = -1.0, z = 0.25 }, -- Vans + [13] = { allowed = true, x = 0.0, y = -1.0, z = 0.25 }, -- Cycles + [14] = { allowed = true, x = 0.0, y = -1.0, z = 0.25 }, -- Boats + [15] = { allowed = true, x = 0.0, y = -1.0, z = 0.25 }, -- Helicopters + [16] = { allowed = true, x = 0.0, y = -1.0, z = 0.25 }, -- Planes + [17] = { allowed = true, x = 0.0, y = -1.0, z = 0.25 }, -- Service + [18] = { allowed = true, x = 0.0, y = -1.0, z = 0.25 }, -- Emergency + [19] = { allowed = true, x = 0.0, y = -1.0, z = 0.25 }, -- Military + [20] = { allowed = true, x = 0.0, y = -1.0, z = 0.25 }, -- Commercial + [21] = { allowed = true, x = 0.0, y = -1.0, z = 0.25 }, -- Trains } Config.ExtrasEnabled = true Config.Commands = { - ["top"] = { - Func = function() ToggleClothing("Top") end, - Sprite = "top", - Desc = "Take your shirt off/on", - Button = 1, - Name = "Torso" - }, - ["gloves"] = { - Func = function() ToggleClothing("gloves") end, - Sprite = "gloves", - Desc = "Take your gloves off/on", - Button = 2, - Name = "Gloves" - }, - ["visor"] = { - Func = function() ToggleProps("visor") end, - Sprite = "visor", - Desc = "Toggle hat variation", - Button = 3, - Name = "Visor" - }, - ["bag"] = { - Func = function() ToggleClothing("Bag") end, - Sprite = "bag", - Desc = "Opens or closes your bag", - Button = 8, - Name = "Bag" - }, - ["shoes"] = { - Func = function() ToggleClothing("Shoes") end, - Sprite = "shoes", - Desc = "Take your shoes off/on", - Button = 5, - Name = "Shoes" - }, - ["vest"] = { - Func = function() ToggleClothing("Vest") end, - Sprite = "vest", - Desc = "Take your vest off/on", - Button = 14, - Name = "Vest" - }, - ["hair"] = { - Func = function() ToggleClothing("hair") end, - Sprite = "hair", - Desc = "Put your hair up/down/in a bun/ponytail.", - Button = 7, - Name = "Hair" - }, - ["hat"] = { - Func = function() ToggleProps("Hat") end, - Sprite = "hat", - Desc = "Take your hat off/on", - Button = 4, - Name = "Hat" - }, - ["glasses"] = { - Func = function() ToggleProps("Glasses") end, - Sprite = "glasses", - Desc = "Take your glasses off/on", - Button = 9, - Name = "Glasses" - }, - ["ear"] = { - Func = function() ToggleProps("Ear") end, - Sprite = "ear", - Desc = "Take your ear accessory off/on", - Button = 10, - Name = "Ear" - }, - ["neck"] = { - Func = function() ToggleClothing("Neck") end, - Sprite = "neck", - Desc = "Take your neck accessory off/on", - Button = 11, - Name = "Neck" - }, - ["watch"] = { - Func = function() ToggleProps("Watch") end, - Sprite = "watch", - Desc = "Take your watch off/on", - Button = 12, - Name = "Watch", - Rotation = 5.0 - }, - ["bracelet"] = { - Func = function() ToggleProps("Bracelet") end, - Sprite = "bracelet", - Desc = "Take your bracelet off/on", - Button = 13, - Name = "Bracelet" - }, - ["mask"] = { - Func = function() ToggleClothing("Mask") end, - Sprite = "mask", - Desc = "Take your mask off/on", - Button = 6, - Name = "Mask" - } + ["top"] = { + Func = function() + ToggleClothing("Top") + end, + Sprite = "top", + Desc = "Take your shirt off/on", + Button = 1, + Name = "Torso", + }, + ["gloves"] = { + Func = function() + ToggleClothing("gloves") + end, + Sprite = "gloves", + Desc = "Take your gloves off/on", + Button = 2, + Name = "Gloves", + }, + ["visor"] = { + Func = function() + ToggleProps("visor") + end, + Sprite = "visor", + Desc = "Toggle hat variation", + Button = 3, + Name = "Visor", + }, + ["bag"] = { + Func = function() + ToggleClothing("Bag") + end, + Sprite = "bag", + Desc = "Opens or closes your bag", + Button = 8, + Name = "Bag", + }, + ["shoes"] = { + Func = function() + ToggleClothing("Shoes") + end, + Sprite = "shoes", + Desc = "Take your shoes off/on", + Button = 5, + Name = "Shoes", + }, + ["vest"] = { + Func = function() + ToggleClothing("Vest") + end, + Sprite = "vest", + Desc = "Take your vest off/on", + Button = 14, + Name = "Vest", + }, + ["hair"] = { + Func = function() + ToggleClothing("hair") + end, + Sprite = "hair", + Desc = "Put your hair up/down/in a bun/ponytail.", + Button = 7, + Name = "Hair", + }, + ["hat"] = { + Func = function() + ToggleProps("Hat") + end, + Sprite = "hat", + Desc = "Take your hat off/on", + Button = 4, + Name = "Hat", + }, + ["glasses"] = { + Func = function() + ToggleProps("Glasses") + end, + Sprite = "glasses", + Desc = "Take your glasses off/on", + Button = 9, + Name = "Glasses", + }, + ["ear"] = { + Func = function() + ToggleProps("Ear") + end, + Sprite = "ear", + Desc = "Take your ear accessory off/on", + Button = 10, + Name = "Ear", + }, + ["neck"] = { + Func = function() + ToggleClothing("Neck") + end, + Sprite = "neck", + Desc = "Take your neck accessory off/on", + Button = 11, + Name = "Neck", + }, + ["watch"] = { + Func = function() + ToggleProps("Watch") + end, + Sprite = "watch", + Desc = "Take your watch off/on", + Button = 12, + Name = "Watch", + Rotation = 5.0, + }, + ["bracelet"] = { + Func = function() + ToggleProps("Bracelet") + end, + Sprite = "bracelet", + Desc = "Take your bracelet off/on", + Button = 13, + Name = "Bracelet", + }, + ["mask"] = { + Func = function() + ToggleClothing("Mask") + end, + Sprite = "mask", + Desc = "Take your mask off/on", + Button = 6, + Name = "Mask", + }, } -local bags = {[40] = true, [41] = true, [44] = true, [45] = true} +local bags = { [40] = true, [41] = true, [44] = true, [45] = true } Config.ExtraCommands = { - ["pants"] = { - Func = function() ToggleClothing("Pants", true) end, - Sprite = "pants", - Desc = "Take your pants off/on", - Name = "Pants", - OffsetX = -0.04, - OffsetY = 0.0 - }, - ["shirt"] = { - Func = function() ToggleClothing("Shirt", true) end, - Sprite = "shirt", - Desc = "Take your shirt off/on", - Name = "shirt", - OffsetX = 0.04, - OffsetY = 0.0 - }, - ["reset"] = { - Func = function() - if not ResetClothing(true) then - Notify('Nothing To Reset', 'error') - end - end, - Sprite = "reset", - Desc = "Revert everything back to normal", - Name = "reset", - OffsetX = 0.12, - OffsetY = 0.2, - Rotate = true - }, - ["bagoff"] = { - Func = function() ToggleClothing("Bagoff", true) end, - Sprite = "bagoff", - SpriteFunc = function() - local Bag = GetPedDrawableVariation(PlayerPedId(), 5) - local BagOff = LastEquipped["Bagoff"] - if LastEquipped["Bagoff"] then - if bags[BagOff.Drawable] then - return "bagoff" - else - return "paraoff" - end - end - if Bag ~= 0 then - if bags[Bag] then - return "bagoff" - else - return "paraoff" - end - else - return false - end - end, - Desc = "Take your bag off/on", - Name = "bagoff", - OffsetX = -0.12, - OffsetY = 0.2 - } + ["pants"] = { + Func = function() + ToggleClothing("Pants", true) + end, + Sprite = "pants", + Desc = "Take your pants off/on", + Name = "Pants", + OffsetX = -0.04, + OffsetY = 0.0, + }, + ["shirt"] = { + Func = function() + ToggleClothing("Shirt", true) + end, + Sprite = "shirt", + Desc = "Take your shirt off/on", + Name = "shirt", + OffsetX = 0.04, + OffsetY = 0.0, + }, + ["reset"] = { + Func = function() + if not ResetClothing(true) then + Notify("Nothing To Reset", "error") + end + end, + Sprite = "reset", + Desc = "Revert everything back to normal", + Name = "reset", + OffsetX = 0.12, + OffsetY = 0.2, + Rotate = true, + }, + ["bagoff"] = { + Func = function() + ToggleClothing("Bagoff", true) + end, + Sprite = "bagoff", + SpriteFunc = function() + local Bag = GetPedDrawableVariation(PlayerPedId(), 5) + local BagOff = LastEquipped["Bagoff"] + if LastEquipped["Bagoff"] then + if bags[BagOff.Drawable] then + return "bagoff" + else + return "paraoff" + end + end + if Bag ~= 0 then + if bags[Bag] then + return "bagoff" + else + return "paraoff" + end + else + return false + end + end, + Desc = "Take your bag off/on", + Name = "bagoff", + OffsetX = -0.12, + OffsetY = 0.2, + }, } function _U(keyToFind) - return Config.Locales[Config.Locale][keyToFind] -end \ No newline at end of file + return Config.Locales[Config.Locale][keyToFind] +end diff --git a/server-data/resources/[esx_addons]/esx-radialmenu/fxmanifest.lua b/server-data/resources/[esx_addons]/esx-radialmenu/fxmanifest.lua index ca665f4a5..8bef68ba4 100644 --- a/server-data/resources/[esx_addons]/esx-radialmenu/fxmanifest.lua +++ b/server-data/resources/[esx_addons]/esx-radialmenu/fxmanifest.lua @@ -1,29 +1,29 @@ -fx_version 'cerulean' -game 'gta5' -lua54 'yes' -description 'esx-radialmenu' -version '1.0.0' +fx_version("cerulean") +game("gta5") +lua54("yes") +description("esx-radialmenu") +version("1.0.0") -ui_page 'html/index.html' +ui_page("html/index.html") -shared_scripts { - '@es_extended/imports.lua', - 'config.lua', -} +shared_scripts({ + "@es_extended/imports.lua", + "config.lua", +}) -client_scripts { - 'locales/*.lua', - 'client/*.lua', -} +client_scripts({ + "locales/*.lua", + "client/*.lua", +}) -server_scripts { - 'locales/*.lua', - 'server/*.lua', -} +server_scripts({ + "locales/*.lua", + "server/*.lua", +}) -files { - 'html/index.html', - 'html/css/main.css', - 'html/js/main.js', - 'html/js/RadialMenu.js', -} \ No newline at end of file +files({ + "html/index.html", + "html/css/main.css", + "html/js/main.js", + "html/js/RadialMenu.js", +}) diff --git a/server-data/resources/[esx_addons]/esx-radialmenu/html/css/main.css b/server-data/resources/[esx_addons]/esx-radialmenu/html/css/main.css index 8604e16c4..412c81aaf 100644 --- a/server-data/resources/[esx_addons]/esx-radialmenu/html/css/main.css +++ b/server-data/resources/[esx_addons]/esx-radialmenu/html/css/main.css @@ -15,7 +15,7 @@ div.info * { #icons { display: none; - filter:url(#drop-shadow); + filter: url(#drop-shadow); } .container { @@ -61,16 +61,16 @@ svg.menu.outer { visibility: hidden; } -svg.menu > g > path { +svg.menu>g>path { fill: rgb(23 23 23 / 80%); } -svg.menu > g.sector > path { +svg.menu>g.sector>path { cursor: pointer; } -svg.menu > g.sector > text, -svg.menu > g.sector > use { +svg.menu>g.sector>text, +svg.menu>g.sector>use { font-family: 'Poppins', sans-serif; margin-top: 5px; font-size: 2.8px; @@ -80,22 +80,22 @@ svg.menu > g.sector > use { fill: white; } -svg.menu > g.sector:hover > path { +svg.menu>g.sector:hover>path { fill: #0091ff; } -svg.menu > g.center:hover > circle { - fill:#0091ff; +svg.menu>g.center:hover>circle { + fill: #0091ff; } -svg.menu > g.center > circle { +svg.menu>g.center>circle { cursor: pointer; fill: rgb(23 23 23 / 80%); } -svg.menu > g.center > text, -svg.menu > g.center > use { +svg.menu>g.center>text, +svg.menu>g.center>use { margin-top: 5px; font-size: 2.5px; cursor: pointer; diff --git a/server-data/resources/[esx_addons]/esx-radialmenu/html/index.html b/server-data/resources/[esx_addons]/esx-radialmenu/html/index.html index 16b004d68..3b94eb81b 100644 --- a/server-data/resources/[esx_addons]/esx-radialmenu/html/index.html +++ b/server-data/resources/[esx_addons]/esx-radialmenu/html/index.html @@ -1,15 +1,20 @@ + Radial Menu - - + + + + \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/esx-radialmenu/html/js/RadialMenu.js b/server-data/resources/[esx_addons]/esx-radialmenu/html/js/RadialMenu.js index 63b1571ac..2bd3c4d12 100644 --- a/server-data/resources/[esx_addons]/esx-radialmenu/html/js/RadialMenu.js +++ b/server-data/resources/[esx_addons]/esx-radialmenu/html/js/RadialMenu.js @@ -1,29 +1,29 @@ 'use strict'; var DEFAULT_SIZE = 150; -var MIN_SECTORS = 3; +var MIN_SECTORS = 3; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function RadialMenu(params) { var self = this; - self.parent = params.parent || []; + self.parent = params.parent || []; - self.size = params.size || DEFAULT_SIZE; - self.onClick = params.onClick || null; - self.menuItems = params.menuItems ? params.menuItems : [{id: 'one', title: 'One'}, {id: 'two', title: 'Two'}]; + self.size = params.size || DEFAULT_SIZE; + self.onClick = params.onClick || null; + self.menuItems = params.menuItems ? params.menuItems : [{ id: 'one', title: 'One' }, { id: 'two', title: 'Two' }]; - self.radius = 55; + self.radius = 55; self.innerRadius = 18; self.sectorSpace = 3.5; self.sectorCount = Math.max(self.menuItems.length, MIN_SECTORS); self.closeOnClick = params.closeOnClick !== undefined ? !!params.closeOnClick : false; - self.scale = 1; - self.holder = null; - self.parentMenu = []; + self.scale = 1; + self.holder = null; + self.parentMenu = []; self.parentItems = []; - self.levelItems = null; + self.levelItems = null; self.createHolder(); //self.addIconSymbols(); @@ -51,7 +51,7 @@ RadialMenu.prototype.close = function (bool) { var self = this; if (self.currentMenu) { - $.post(`https://esx-radialmenu/closeRadial`, JSON.stringify({ delay: bool }) ); + $.post(`https://esx-radialmenu/closeRadial`, JSON.stringify({ delay: bool })); var parentMenu; while (parentMenu = self.parentMenu.pop()) { parentMenu.remove(); @@ -83,7 +83,7 @@ RadialMenu.prototype.createHolder = function () { self.holder = document.createElement('div'); self.holder.className = 'menuHolder'; - self.holder.style.width = self.size + 'px'; + self.holder.style.width = self.size + 'px'; self.holder.style.height = self.size + 'px'; self.parent.appendChild(self.holder); @@ -158,12 +158,12 @@ RadialMenu.prototype.createCenter = function (svg, title, icon, size) { var centerCircle = self.createCircle(0, 0, self.innerRadius - self.sectorSpace); g.appendChild(centerCircle); if (text) { - var text = self.createText(0,0, title); + var text = self.createText(0, 0, title); g.appendChild(text); } if (icon) { - var use = self.createUseTag(0,0, icon, g, true); + var use = self.createUseTag(0, 0, icon, g, true); use.setAttribute('width', size); use.setAttribute('height', size); use.setAttribute('transform', 'translate(-' + RadialMenu.numberToString(size / 2) + ',-' + RadialMenu.numberToString(size / 2) + ')'); @@ -202,7 +202,7 @@ RadialMenu.prototype.createMenu = function (classValue, levelItems, nested) { self.levelItems = levelItems; self.sectorCount = Math.max(self.levelItems.length, MIN_SECTORS); - self.scale = self.calcScale(); + self.scale = self.calcScale(); var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); svg.setAttribute('class', classValue); @@ -210,10 +210,10 @@ RadialMenu.prototype.createMenu = function (classValue, levelItems, nested) { svg.setAttribute('width', self.size); svg.setAttribute('height', self.size); - var angleStep = 360 / self.sectorCount; + var angleStep = 360 / self.sectorCount; var angleShift - for(i = 1; i < self.levelItems.length; i++) { + for (i = 1; i < self.levelItems.length; i++) { menuItems = i } @@ -239,7 +239,7 @@ RadialMenu.prototype.createMenu = function (classValue, levelItems, nested) { for (var i = 0; i < self.sectorCount; ++i) { var startAngle = angleShift + angleStep * i; - var endAngle = angleShift + angleStep * (i + 0.99); + var endAngle = angleShift + angleStep * (i + 0.99); var itemIndex = RadialMenu.resolveLoopIndex(self.sectorCount - i + indexOffset, self.sectorCount); var item; @@ -368,7 +368,7 @@ RadialMenu.prototype.getSelectedIndex = function () { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RadialMenu.prototype.setSelectedIndex = function (index) { var self = this; - if (index >=0 && index < self.levelItems.length) { + if (index >= 0 && index < self.levelItems.length) { var items = self.currentMenu.querySelectorAll('g[data-index="' + index + '"]'); if (items.length > 0) { var itemToSelect = items[0]; @@ -423,7 +423,7 @@ RadialMenu.prototype.appendSectorPath = function (startAngleDeg, endAngleDeg, sv }; var g = document.createElementNS('http://www.w3.org/2000/svg', 'g'); - g.setAttribute('transform','translate(' +translate.x + ' ,' + translate.y + ') scale(' + self.scale + ')'); + g.setAttribute('transform', 'translate(' + translate.x + ' ,' + translate.y + ') scale(' + self.scale + ')'); var path = document.createElementNS('http://www.w3.org/2000/svg', 'path'); path.setAttribute('d', self.createSectorCmds(startAngleDeg, endAngleDeg)); @@ -501,9 +501,9 @@ RadialMenu.prototype.createText = function (x, y, title) { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RadialMenu.prototype.createCircle = function (x, y, r) { var circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle'); - circle.setAttribute('cx',RadialMenu.numberToString(x)); - circle.setAttribute('cy',RadialMenu.numberToString(y)); - circle.setAttribute('r',r); + circle.setAttribute('cx', RadialMenu.numberToString(x)); + circle.setAttribute('cy', RadialMenu.numberToString(y)); + circle.setAttribute('r', r); return circle; }; @@ -532,7 +532,7 @@ RadialMenu.prototype.addIconSymbols = function () { var returnSymbol = document.createElementNS('http://www.w3.org/2000/svg', 'symbol'); returnSymbol.setAttribute('id', 'return'); returnSymbol.setAttribute('viewBox', '0 0 489.394 489.394'); - var returnPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); + var returnPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); returnPath.setAttribute('d', "M375.789,92.867H166.864l17.507-42.795c3.724-9.132,1-19.574-6.691-25.744c-7.701-6.166-18.538-6.508-26.639-0.879" + "L9.574,121.71c-6.197,4.304-9.795,11.457-9.563,18.995c0.231,7.533,4.261,14.446,10.71,18.359l147.925,89.823" + "c8.417,5.108,19.18,4.093,26.481-2.499c7.312-6.591,9.427-17.312,5.219-26.202l-19.443-41.132h204.886" + diff --git a/server-data/resources/[esx_addons]/esx-radialmenu/html/js/main.js b/server-data/resources/[esx_addons]/esx-radialmenu/html/js/main.js index ad950bfa8..ed52d206c 100644 --- a/server-data/resources/[esx_addons]/esx-radialmenu/html/js/main.js +++ b/server-data/resources/[esx_addons]/esx-radialmenu/html/js/main.js @@ -3,8 +3,8 @@ var ESXRadialMenu = null; var toggleConfig = false; var keybindConfig = false; -$(document).ready(function(){ - window.addEventListener('message', function(event){ +$(document).ready(function () { + window.addEventListener('message', function (event) { switch (event.data.action) { case "ui": toggleConfig = event.data.toggle; @@ -15,34 +15,34 @@ $(document).ready(function(){ } else { ESXRadialMenu.close(true); } - if (toggleConfig === false){ - $(document).on('keyup', function(e) { - if(e.key == keybindConfig | e.key === keybindConfig.toLowerCase()){ - ESXRadialMenu.close(); - } - }); - } else { - $(document).on('keydown', function(e) { - switch(e.key) { + if (toggleConfig === false) { + $(document).on('keyup', function (e) { + if (e.key == keybindConfig | e.key === keybindConfig.toLowerCase()) { + ESXRadialMenu.close(); + } + }); + } else { + $(document).on('keydown', function (e) { + switch (e.key) { case keybindConfig: ESXRadialMenu.close(); break; } }); - } + } } }); }); function createMenu(items) { ESXRadialMenu = new RadialMenu({ - parent : document.body, - size : 375, - menuItems : items, - onClick : function(item) { + parent: document.body, + size: 375, + menuItems: items, + onClick: function (item) { if (item.shouldClose) { ESXRadialMenu.close(true); } - + if (item.items == null && item.shouldClose != null) { $.post('https://esx-radialmenu/selectItem', JSON.stringify({ itemData: item @@ -53,8 +53,8 @@ function createMenu(items) { } // Close on escape pressed -$(document).on('keydown', function(e) { - switch(e.key) { +$(document).on('keydown', function (e) { + switch (e.key) { case "Escape": ESXRadialMenu.close(); break; diff --git a/server-data/resources/[esx_addons]/esx-radialmenu/locales/fr.lua b/server-data/resources/[esx_addons]/esx-radialmenu/locales/fr.lua index a16eba93a..a58efbc33 100644 --- a/server-data/resources/[esx_addons]/esx-radialmenu/locales/fr.lua +++ b/server-data/resources/[esx_addons]/esx-radialmenu/locales/fr.lua @@ -1,45 +1,45 @@ Config.Locales = { - ['fr'] = { - ['no_people_nearby'] = "Aucun joueur n'est à proximité.", - ['no_vehicle_found'] = "Aucun véhicule n'a été retrouvé.", - ['extra_deactivated'] = "%{extra} supplémentaires ont été désactivés.", - ['extra_not_present'] = "%{extra} supplémentaires ne sont pas présents sur ce véhicule.", - ['not_driver'] = "Tu n'es pas le conducteur de véhicule.", - ['vehicle_driving_fast'] = "Ce véhicule va trop vite.", - ['seat_occupied'] = "Ce siège est occupé.", - ['race_harness_on'] = "Tu as un harnais de course. Tu ne peux pas changer.", - ['obj_not_found'] = "Impossible de créer l'objet demandé.", - ['not_near_ambulance'] = "Tu n'es pas près d'une ambulance.", - ['far_away'] = "Tu es trop loin.", - ['stretcher_in_use'] = "Cette civière est déjà utilisée.", - ['not_kidnapped'] = "Tu n'as pas kidnappé cette personne.", - ['trunk_closed'] = "Le coffre est fermé.", - ['cant_enter_trunk'] = "Tu ne peux pas entrer dans ce coffre.", - ['already_in_trunk'] = "Tu es déjà dans le coffre.", - ['someone_in_trunk'] = "Quelqu'un est déjà dans le coffre.", - ['extra_activated'] = "%{extra} supplémentaires ont été activés.", - ['entered_trunk'] = "Tu es dans le coffre.", - ['no_variants'] = "Il ne semble pas y avoir de variantes pour cela.", - ['wrong_ped'] = "Ce modèle ped ne permet pas cette option.", - ['nothing_to_remove'] = "Tu n'as rien à enlever.", - ['already_wearing'] = "Tu le portes déjà.", - ['switched_seats'] = "Tu es maintenant dans le %{seat}.", - ['command_description'] = "Ouvrer le Menu Radial", - ['push_stretcher_button'] = "[E] - Pousser la Civière", - ['stop_pushing_stretcher_button'] = "~g~E~w~ - Arrêter de Pousser", - ['lay_stretcher_button'] = "[G] - Se Coucher sur la Civière", - ['push_position_drawtext'] = "Poussez Ici", - ['get_off_stretcher_button'] = "[G] - Descendre de la Civière", - ['get_out_trunk_button'] = "[E] Sortir du Coffre", - ['close_trunk_button'] = "[G] Fermer le Coffre", - ['open_trunk_button'] = "[G] Ouvrir le Coffre", - ['getintrunk_command_desc'] = "Entrer dans le Coffre", - ['putintrunk_command_desc'] = "Mettre le Joueur dans le Coffre", - ['emergency_button'] = "Le Bouton d'Urgence", - ['driver_seat'] = "Le Siège du Conducteur", - ['passenger_seat'] = "Le Siège Passager", - ['other_seats'] = "L'Autre Siège", - ['rear_left_seat'] = "Le Siège Arrière Gauche", - ['rear_right_seat'] = "Le Siège Arrière Droit", - }, -} \ No newline at end of file + ["fr"] = { + ["no_people_nearby"] = "Aucun joueur n'est à proximité.", + ["no_vehicle_found"] = "Aucun véhicule n'a été retrouvé.", + ["extra_deactivated"] = "%{extra} supplémentaires ont été désactivés.", + ["extra_not_present"] = "%{extra} supplémentaires ne sont pas présents sur ce véhicule.", + ["not_driver"] = "Tu n'es pas le conducteur de véhicule.", + ["vehicle_driving_fast"] = "Ce véhicule va trop vite.", + ["seat_occupied"] = "Ce siège est occupé.", + ["race_harness_on"] = "Tu as un harnais de course. Tu ne peux pas changer.", + ["obj_not_found"] = "Impossible de créer l'objet demandé.", + ["not_near_ambulance"] = "Tu n'es pas près d'une ambulance.", + ["far_away"] = "Tu es trop loin.", + ["stretcher_in_use"] = "Cette civière est déjà utilisée.", + ["not_kidnapped"] = "Tu n'as pas kidnappé cette personne.", + ["trunk_closed"] = "Le coffre est fermé.", + ["cant_enter_trunk"] = "Tu ne peux pas entrer dans ce coffre.", + ["already_in_trunk"] = "Tu es déjà dans le coffre.", + ["someone_in_trunk"] = "Quelqu'un est déjà dans le coffre.", + ["extra_activated"] = "%{extra} supplémentaires ont été activés.", + ["entered_trunk"] = "Tu es dans le coffre.", + ["no_variants"] = "Il ne semble pas y avoir de variantes pour cela.", + ["wrong_ped"] = "Ce modèle ped ne permet pas cette option.", + ["nothing_to_remove"] = "Tu n'as rien à enlever.", + ["already_wearing"] = "Tu le portes déjà.", + ["switched_seats"] = "Tu es maintenant dans le %{seat}.", + ["command_description"] = "Ouvrer le Menu Radial", + ["push_stretcher_button"] = "[E] - Pousser la Civière", + ["stop_pushing_stretcher_button"] = "~g~E~w~ - Arrêter de Pousser", + ["lay_stretcher_button"] = "[G] - Se Coucher sur la Civière", + ["push_position_drawtext"] = "Poussez Ici", + ["get_off_stretcher_button"] = "[G] - Descendre de la Civière", + ["get_out_trunk_button"] = "[E] Sortir du Coffre", + ["close_trunk_button"] = "[G] Fermer le Coffre", + ["open_trunk_button"] = "[G] Ouvrir le Coffre", + ["getintrunk_command_desc"] = "Entrer dans le Coffre", + ["putintrunk_command_desc"] = "Mettre le Joueur dans le Coffre", + ["emergency_button"] = "Le Bouton d'Urgence", + ["driver_seat"] = "Le Siège du Conducteur", + ["passenger_seat"] = "Le Siège Passager", + ["other_seats"] = "L'Autre Siège", + ["rear_left_seat"] = "Le Siège Arrière Gauche", + ["rear_right_seat"] = "Le Siège Arrière Droit", + }, +} diff --git a/server-data/resources/[esx_addons]/esx-radialmenu/server/stretcher.lua b/server-data/resources/[esx_addons]/esx-radialmenu/server/stretcher.lua index d7854fb1d..52c79137e 100644 --- a/server-data/resources/[esx_addons]/esx-radialmenu/server/stretcher.lua +++ b/server-data/resources/[esx_addons]/esx-radialmenu/server/stretcher.lua @@ -1,11 +1,11 @@ -RegisterNetEvent('esx-radialmenu:server:RemoveStretcher', function(pos, stretcherObject) - TriggerClientEvent('esx-radialmenu:client:RemoveStretcherFromArea', -1, pos, stretcherObject) +RegisterNetEvent("esx-radialmenu:server:RemoveStretcher", function(pos, stretcherObject) + TriggerClientEvent("esx-radialmenu:client:RemoveStretcherFromArea", -1, pos, stretcherObject) end) -RegisterNetEvent('esx-radialmenu:Stretcher:BusyCheck', function(id, type) - TriggerClientEvent('esx-radialmenu:Stretcher:client:BusyCheck', id, source, type) +RegisterNetEvent("esx-radialmenu:Stretcher:BusyCheck", function(id, type) + TriggerClientEvent("esx-radialmenu:Stretcher:client:BusyCheck", id, source, type) end) -RegisterNetEvent('esx-radialmenu:server:BusyResult', function(isBusy, otherId, type) - TriggerClientEvent('esx-radialmenu:client:Result', otherId, isBusy, type) -end) \ No newline at end of file +RegisterNetEvent("esx-radialmenu:server:BusyResult", function(isBusy, otherId, type) + TriggerClientEvent("esx-radialmenu:client:Result", otherId, isBusy, type) +end) diff --git a/server-data/resources/[esx_addons]/esx-radialmenu/server/trunk.lua b/server-data/resources/[esx_addons]/esx-radialmenu/server/trunk.lua index e074e36af..1878f9626 100644 --- a/server-data/resources/[esx_addons]/esx-radialmenu/server/trunk.lua +++ b/server-data/resources/[esx_addons]/esx-radialmenu/server/trunk.lua @@ -1,26 +1,29 @@ local trunkBusy = {} -RegisterNetEvent('esx-radialmenu:trunk:server:Door', function(open, plate, door) - TriggerClientEvent('esx-radialmenu:trunk:client:Door', -1, plate, door, open) +RegisterNetEvent("esx-radialmenu:trunk:server:Door", function(open, plate, door) + TriggerClientEvent("esx-radialmenu:trunk:client:Door", -1, plate, door, open) end) -RegisterNetEvent('esx-trunk:server:setTrunkBusy', function(plate, busy) - trunkBusy[plate] = busy +RegisterNetEvent("esx-trunk:server:setTrunkBusy", function(plate, busy) + trunkBusy[plate] = busy end) -RegisterNetEvent('esx-trunk:server:KidnapTrunk', function(targetId, closestVehicle) - TriggerClientEvent('esx-trunk:client:KidnapGetIn', targetId, closestVehicle) +RegisterNetEvent("esx-trunk:server:KidnapTrunk", function(targetId, closestVehicle) + TriggerClientEvent("esx-trunk:client:KidnapGetIn", targetId, closestVehicle) end) -ESX.RegisterServerCallback('esx-trunk:server:getTrunkBusy', function(_, cb, plate) - if trunkBusy[plate] then cb(true) return end - cb(false) +ESX.RegisterServerCallback("esx-trunk:server:getTrunkBusy", function(_, cb, plate) + if trunkBusy[plate] then + cb(true) + return + end + cb(false) end) -ESX.RegisterCommand({"getintrunk"}, 'user', function(xPlayer) - TriggerClientEvent('esx-trunk:client:GetIn', xPlayer.source) -end, false, {help = _U("getintrunk_command_desc")}) +ESX.RegisterCommand({ "getintrunk" }, "user", function(xPlayer) + TriggerClientEvent("esx-trunk:client:GetIn", xPlayer.source) +end, false, { help = _U("getintrunk_command_desc") }) -ESX.RegisterCommand({"putintrunk"}, 'user', function(xPlayer, args) - TriggerClientEvent('esx-trunk:server:KidnapTrunk', xPlayer.source) -end, false, {help = _U("putintrunk_command_desc")}) \ No newline at end of file +ESX.RegisterCommand({ "putintrunk" }, "user", function(xPlayer, args) + TriggerClientEvent("esx-trunk:server:KidnapTrunk", xPlayer.source) +end, false, { help = _U("putintrunk_command_desc") })