From 251af1f8c3fdc86fc478100740b0af86a679ef48 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Wed, 24 Jul 2024 17:53:54 +0200 Subject: [PATCH 1/9] refactor: reconstruction of esx_mechanicjob for adaptation to the framework --- .../esx_mechanicjob/client/main.lua | 103 +--------- .../[esx_addons]/esx_mechanicjob/config.lua | 7 - .../esx_mechanicjob/locales/en.lua | 4 - .../esx_mechanicjob/locales/it.lua | 8 +- .../esx_mechanicjob/server/main.lua | 184 ------------------ 5 files changed, 11 insertions(+), 295 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 ff798ec4c..3f73ba936 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 @@ -114,7 +112,7 @@ function OpenMechanicActionsMenu() } end - ESX.OpenContext("right", elements2, function(menu2, element2) + ESX.OpenContext("right", elements2, function(_, element2) if Config.MaxInService == -1 then ESX.CloseContext() ESX.Game.SpawnVehicle(element2.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle) @@ -162,67 +160,13 @@ function OpenMechanicActionsMenu() ESX.CloseContext() end) end - end, function(menu) + end, function() CurrentAction = "mechanic_actions_menu" CurrentActionMsg = TranslateCap("open_actions") CurrentActionData = {} end) end -function OpenMechanicHarvestMenu() - if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name ~= "recrue" then - local elements = { - { unselectable = true, icon = "fas fa-gear", title = "Mechanic Harvest Menu" }, - { icon = "fas fa-gear", title = TranslateCap("gas_can"), value = "gaz_bottle" }, - { icon = "fas fa-gear", title = TranslateCap("repair_tools"), value = "fix_tool" }, - { icon = "fas fa-gear", title = TranslateCap("body_work_tools"), value = "caro_tool" }, - } - - ESX.OpenContext("right", elements, function(menu, element) - if element.value == "gaz_bottle" then - TriggerServerEvent("esx_mechanicjob:startHarvest") - elseif element.value == "fix_tool" then - TriggerServerEvent("esx_mechanicjob:startHarvest2") - elseif element.value == "caro_tool" then - TriggerServerEvent("esx_mechanicjob:startHarvest3") - end - end, function(menu) - CurrentAction = "mechanic_harvest_menu" - CurrentActionMsg = TranslateCap("harvest_menu") - CurrentActionData = {} - end) - else - ESX.ShowNotification(TranslateCap("not_experienced_enough")) - end -end - -function OpenMechanicCraftMenu() - if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name ~= "recrue" then - local elements = { - { unselectable = true, icon = "fas fa-gear", title = "Mechanic Craft Menu" }, - { icon = "fas fa-gear", title = TranslateCap("blowtorch"), value = "blow_pipe" }, - { icon = "fas fa-gear", title = TranslateCap("repair_kit"), value = "fix_kit" }, - { icon = "fas fa-gear", title = TranslateCap("body_kit"), value = "caro_kit" }, - } - - ESX.OpenContext("right", elements, function(menu, element) - if element.value == "blow_pipe" then - TriggerServerEvent("esx_mechanicjob:startCraft") - elseif element.value == "fix_kit" then - TriggerServerEvent("esx_mechanicjob:startCraft2") - elseif element.value == "caro_kit" then - TriggerServerEvent("esx_mechanicjob:startCraft3") - end - end, function(menu) - CurrentAction = "mechanic_craft_menu" - CurrentActionMsg = TranslateCap("craft_menu") - CurrentActionData = {} - end) - else - ESX.ShowNotification(TranslateCap("not_experienced_enough")) - end -end - function OpenMobileMechanicActionsMenu() local elements = { { unselectable = true, icon = "fas fa-gear", title = TranslateCap("mechanic") }, @@ -235,7 +179,7 @@ function OpenMobileMechanicActionsMenu() { icon = "fas fa-gear", title = TranslateCap("place_objects"), value = "object_spawner" }, } - ESX.OpenContext("right", elements, function(menu, element) + ESX.OpenContext("right", elements, function(_, element) if isBusy then return end @@ -247,7 +191,7 @@ function OpenMobileMechanicActionsMenu() { icon = "fas fa-check-double", title = "Confirm", value = "confirm" }, } - ESX.OpenContext("right", elements2, function(menu2, element2) + ESX.OpenContext("right", elements2, function(menu2) local amount = tonumber(menu2.eles[2].inputValue) if amount == nil or amount < 0 then @@ -521,7 +465,7 @@ function OpenPutStocksMenu() end end - ESX.OpenContext("right", elements, function(menu, element) + ESX.OpenContext("right", elements, function(_, element) local itemName = element.value local elements2 = { @@ -530,7 +474,7 @@ function OpenPutStocksMenu() { icon = "fas fa-check-double", title = "Confirm", value = "confirm" }, } - ESX.OpenContext("right", elements2, function(menu2, element2) + ESX.OpenContext("right", elements2, function(menu2) local count = tonumber(menu2.eles[2].inputValue) if count == nil then @@ -662,14 +606,6 @@ AddEventHandler("esx_mechanicjob:hasEnteredMarker", function(zone) CurrentAction = "mechanic_actions_menu" CurrentActionMsg = TranslateCap("open_actions") CurrentActionData = {} - elseif zone == "Garage" then - CurrentAction = "mechanic_harvest_menu" - CurrentActionMsg = TranslateCap("harvest_menu") - CurrentActionData = {} - elseif zone == "Craft" then - CurrentAction = "mechanic_craft_menu" - CurrentActionMsg = TranslateCap("craft_menu") - CurrentActionData = {} elseif zone == "VehicleDeleter" then local playerPed = PlayerPedId() @@ -684,24 +620,6 @@ AddEventHandler("esx_mechanicjob:hasEnteredMarker", function(zone) ESX.TextUI(CurrentActionMsg) end) -AddEventHandler("esx_mechanicjob:hasExitedMarker", function(zone) - if zone == "VehicleDelivery" then - NPCTargetDeleterZone = false - elseif zone == "Craft" then - TriggerServerEvent("esx_mechanicjob:stopCraft") - TriggerServerEvent("esx_mechanicjob:stopCraft2") - TriggerServerEvent("esx_mechanicjob:stopCraft3") - elseif zone == "Garage" then - TriggerServerEvent("esx_mechanicjob:stopHarvest") - TriggerServerEvent("esx_mechanicjob:stopHarvest2") - TriggerServerEvent("esx_mechanicjob:stopHarvest3") - end - - CurrentAction = nil - ESX.CloseContext() - ESX.HideUI() -end) - AddEventHandler("esx_mechanicjob:hasEnteredEntityZone", function(entity) local playerPed = PlayerPedId() @@ -888,10 +806,6 @@ CreateThread(function() if IsControlJustReleased(0, 38) and ESX.PlayerData.job and ESX.PlayerData.job.name == "mechanic" then if CurrentAction == "mechanic_actions_menu" then OpenMechanicActionsMenu() - elseif CurrentAction == "mechanic_harvest_menu" then - OpenMechanicHarvestMenu() - elseif CurrentAction == "mechanic_craft_menu" then - OpenMechanicCraftMenu() elseif CurrentAction == "delete_vehicle" then if Config.EnableSocietyOwnedVehicles then local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) @@ -943,9 +857,10 @@ end, false) RegisterKeyMapping("mechanicMenu", "Open Mechanic Menu", "keyboard", Config.Controls.mechanicMenu) RegisterKeyMapping("mechanicjob", "Togggle NPC Job", "keyboard", Config.Controls.toggleNPCJob) -AddEventHandler("esx:onPlayerDeath", function(data) +AddEventHandler("esx:onPlayerDeath", function() isDead = true end) -AddEventHandler("esx:onPlayerSpawn", function(spawn) + +AddEventHandler("esx:onPlayerSpawn", function() isDead = false end) diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/config.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/config.lua index 69a1851eb..78dde6a07 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/config.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/config.lua @@ -43,13 +43,6 @@ Config.Zones = { Type = 21, }, - Craft = { - Pos = vector3(-323.140, -129.882, 38.999), - Size = { x = 1.0, y = 1.0, z = 1.0 }, - Color = { r = 50, g = 200, b = 50 }, - Type = 21, - }, - VehicleSpawnPoint = { Pos = vector3(-366.354, -110.766, 37.696), Size = { x = 1.5, y = 1.5, z = 1.0 }, diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua index dc0ca2563..9274165aa 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua @@ -13,8 +13,6 @@ Locales["en"] = { ["tow_truck"] = "tow Truck", ["service_full"] = "service full: ", ["open_actions"] = "Press [E] to access the menu.", - ["harvest"] = "harvest", - ["harvest_menu"] = "press [E] to access the harvest menu.", ["not_experienced_enough"] = "you are not experienced enough to perform this action.", ["gas_can"] = "gas Can", ["repair_tools"] = "repair Tools", @@ -22,8 +20,6 @@ Locales["en"] = { ["blowtorch"] = "blowtorch", ["repair_kit"] = "repair Kit", ["body_kit"] = "body Kit", - ["craft"] = "craft", - ["craft_menu"] = "press [E] to access the crafting menu.", ["billing"] = "billing", ["hijack"] = "hijack", ["repair"] = "repair", diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua index e95df3426..0b210f0f8 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua @@ -9,12 +9,10 @@ Locales["it"] = { ["withdraw_stock"] = "ritira", ["boss_actions"] = "azioni boss", ["service_vehicle"] = "veicoli di servizio", - ["flat_bed"] = "flatbed", + ["flat_bed"] = "carica/scarica", ["tow_truck"] = "carro attrezzi", ["service_full"] = "servizio completo: ", ["open_actions"] = "premi [E] per accedere al menu.", - ["harvest"] = "raccolto", - ["harvest_menu"] = "premi [E] per accedere al menu raccolto.", ["not_experienced_enough"] = "non hai abbastanza esperienza per eseguire questa azione.", ["gas_can"] = "bombola del gas", ["repair_tools"] = "riparazione strumenti", @@ -22,10 +20,8 @@ Locales["it"] = { ["blowtorch"] = "fiamma ossidrica", ["repair_kit"] = "kit di riparazione", ["body_kit"] = "body Kit", - ["craft"] = "creazione", - ["craft_menu"] = "premi [E] per accedere al menu di creazione.", ["billing"] = "fattura", - ["hijack"] = "trasportare", + ["hijack"] = "scassinare", ["repair"] = "riparazione", ["clean"] = "pulito", ["imp_veh"] = "sequestrato", 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 339a8736f..69e5f41bf 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua @@ -1,5 +1,3 @@ -local PlayersHarvesting, PlayersHarvesting2, PlayersHarvesting3, PlayersCrafting, PlayersCrafting2, PlayersCrafting3 = {}, {}, {}, {}, {}, {} - if Config.MaxInService ~= -1 then TriggerEvent("esx_service:activateService", "mechanic", Config.MaxInService) end @@ -7,188 +5,6 @@ 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" }) -local function Harvest(source) - SetTimeout(4000, function() - if PlayersHarvesting[source] == true then - local xPlayer = ESX.GetPlayerFromId(source) - local GazBottleQuantity = xPlayer.getInventoryItem("gazbottle").count - - if GazBottleQuantity >= 5 then - TriggerClientEvent("esx:showNotification", source, TranslateCap("you_do_not_room")) - else - xPlayer.addInventoryItem("gazbottle", 1) - Harvest(source) - end - end - end) -end - -RegisterServerEvent("esx_mechanicjob:startHarvest") -AddEventHandler("esx_mechanicjob:startHarvest", function() - local source = source - PlayersHarvesting[source] = true - TriggerClientEvent("esx:showNotification", source, TranslateCap("recovery_gas_can")) - Harvest(source) -end) - -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 - - if FixToolQuantity >= 5 then - TriggerClientEvent("esx:showNotification", source, TranslateCap("you_do_not_room")) - else - xPlayer.addInventoryItem("fixtool", 1) - Harvest2(source) - end - end - end) -end - -RegisterServerEvent("esx_mechanicjob:startHarvest2") -AddEventHandler("esx_mechanicjob:startHarvest2", function() - local source = source - PlayersHarvesting2[source] = true - TriggerClientEvent("esx:showNotification", source, TranslateCap("recovery_repair_tools")) - Harvest2(source) -end) - -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 - if CaroToolQuantity >= 5 then - TriggerClientEvent("esx:showNotification", source, TranslateCap("you_do_not_room")) - else - xPlayer.addInventoryItem("carotool", 1) - Harvest3(source) - end - end - end) -end - -RegisterServerEvent("esx_mechanicjob:startHarvest3") -AddEventHandler("esx_mechanicjob:startHarvest3", function() - local source = source - PlayersHarvesting3[source] = true - TriggerClientEvent("esx:showNotification", source, TranslateCap("recovery_body_tools")) - Harvest3(source) -end) - -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 - - if GazBottleQuantity <= 0 then - TriggerClientEvent("esx:showNotification", source, TranslateCap("not_enough_gas_can")) - else - xPlayer.removeInventoryItem("gazbottle", 1) - xPlayer.addInventoryItem("blowpipe", 1) - Craft(source) - end - end - end) -end - -RegisterServerEvent("esx_mechanicjob:startCraft") -AddEventHandler("esx_mechanicjob:startCraft", function() - local source = source - PlayersCrafting[source] = true - TriggerClientEvent("esx:showNotification", source, TranslateCap("assembling_blowtorch")) - Craft(source) -end) - -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 - - if FixToolQuantity <= 0 then - TriggerClientEvent("esx:showNotification", source, TranslateCap("not_enough_repair_tools")) - else - xPlayer.removeInventoryItem("fixtool", 1) - xPlayer.addInventoryItem("fixkit", 1) - Craft2(source) - end - end - end) -end - -RegisterServerEvent("esx_mechanicjob:startCraft2") -AddEventHandler("esx_mechanicjob:startCraft2", function() - local source = source - PlayersCrafting2[source] = true - TriggerClientEvent("esx:showNotification", source, TranslateCap("assembling_repair_kit")) - Craft2(source) -end) - -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 - - if CaroToolQuantity <= 0 then - TriggerClientEvent("esx:showNotification", source, TranslateCap("not_enough_body_tools")) - else - xPlayer.removeInventoryItem("carotool", 1) - xPlayer.addInventoryItem("carokit", 1) - Craft3(source) - end - end - end) -end - -RegisterServerEvent("esx_mechanicjob:startCraft3") -AddEventHandler("esx_mechanicjob:startCraft3", function() - local source = source - PlayersCrafting3[source] = true - TriggerClientEvent("esx:showNotification", source, TranslateCap("assembling_body_kit")) - Craft3(source) -end) - -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() local source = source From bd675008ca08596a836868be1d0a22373156fe8e Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Wed, 24 Jul 2024 18:22:08 +0200 Subject: [PATCH 2/9] fix: variable isDead is never accessed + correction of translations --- .../[esx_addons]/esx_mechanicjob/client/main.lua | 12 ++++-------- .../[esx_addons]/esx_mechanicjob/locales/en.lua | 1 + .../[esx_addons]/esx_mechanicjob/locales/it.lua | 3 ++- 3 files changed, 7 insertions(+), 9 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 3f73ba936..76cd6cf89 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua @@ -2,7 +2,7 @@ local HasAlreadyEnteredMarker, LastZone = false, nil local CurrentAction, CurrentActionMsg, CurrentActionData = nil, "", {} local CurrentlyTowedVehicle, Blips, NPCOnJob, NPCTargetTowable, NPCTargetTowableZone = nil, {}, false, nil, nil local NPCHasSpawnedTowable, NPCLastCancel, NPCHasBeenNextToTowable, NPCTargetDeleterZone = false, GetGameTimer() - 5 * 60000, false, false -local isDead, isBusy = false, false +local isBusy = false function SelectRandomTowable() local index = GetRandomIntInRange(1, #Config.Towables) @@ -175,7 +175,7 @@ function OpenMobileMechanicActionsMenu() { icon = "fas fa-gear", title = TranslateCap("repair"), value = "fix_vehicle" }, { icon = "fas fa-gear", title = TranslateCap("clean"), value = "clean_vehicle" }, { icon = "fas fa-gear", title = TranslateCap("imp_veh"), value = "del_vehicle" }, - { icon = "fas fa-gear", title = TranslateCap("flat_bed"), value = "dep_vehicle" }, + { icon = "fas fa-gear", title = TranslateCap("tow"), value = "dep_vehicle" }, { icon = "fas fa-gear", title = TranslateCap("place_objects"), value = "object_spawner" }, } @@ -857,10 +857,6 @@ end, false) RegisterKeyMapping("mechanicMenu", "Open Mechanic Menu", "keyboard", Config.Controls.mechanicMenu) RegisterKeyMapping("mechanicjob", "Togggle NPC Job", "keyboard", Config.Controls.toggleNPCJob) -AddEventHandler("esx:onPlayerDeath", function() - isDead = true -end) +AddEventHandler("esx:onPlayerDeath", function() end) -AddEventHandler("esx:onPlayerSpawn", function() - isDead = false -end) +AddEventHandler("esx:onPlayerSpawn", function() end) diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua index 9274165aa..fba3ae4c8 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua @@ -10,6 +10,7 @@ Locales["en"] = { ["boss_actions"] = "boss Actions", ["service_vehicle"] = "service Vehicle", ["flat_bed"] = "flatbed", + ["tow"] = "tow", ["tow_truck"] = "tow Truck", ["service_full"] = "service full: ", ["open_actions"] = "Press [E] to access the menu.", diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua index 0b210f0f8..31736326b 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua @@ -9,7 +9,8 @@ Locales["it"] = { ["withdraw_stock"] = "ritira", ["boss_actions"] = "azioni boss", ["service_vehicle"] = "veicoli di servizio", - ["flat_bed"] = "carica/scarica", + ["flat_bed"] = "pianale", + ["tow"] = "carica/scarica", ["tow_truck"] = "carro attrezzi", ["service_full"] = "servizio completo: ", ["open_actions"] = "premi [E] per accedere al menu.", From bbb7eff77657cbfd6186cb73c634e36ff8127318 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Wed, 24 Jul 2024 18:40:11 +0200 Subject: [PATCH 3/9] fix: shadowing upvalue argument menu on line 71 --- .../esx_mechanicjob/client/main.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 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 76cd6cf89..2235e9f84 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua @@ -68,7 +68,7 @@ function OpenMechanicActionsMenu() } end - ESX.OpenContext("right", elements, function(menu, element) + ESX.OpenContext("right", elements, function(_, element) if element.value == "vehicle_list" then if Config.EnableSocietyOwnedVehicles then local elements2 = { @@ -84,7 +84,7 @@ function OpenMechanicActionsMenu() } end - ESX.OpenContext("right", elements2, function(menu2, element2) + ESX.OpenContext("right", elements2, function(_, element2) ESX.CloseContext() local vehicleProps = element2.value @@ -145,7 +145,7 @@ function OpenMechanicActionsMenu() end) elseif element.value == "cloakroom2" then ESX.CloseContext() - ESX.TriggerServerCallback("esx_skin:getPlayerSkin", function(skin, jobSkin) + ESX.TriggerServerCallback("esx_skin:getPlayerSkin", function(skin) TriggerEvent("skinchanger:loadSkin", skin) end) elseif Config.OxInventory and (element.value == "put_stock" or element.value == "get_stock") then @@ -156,7 +156,7 @@ function OpenMechanicActionsMenu() elseif element.value == "get_stock" then OpenGetStocksMenu() elseif element.value == "boss_actions" then - TriggerEvent("esx_society:openBossMenu", "mechanic", function(data, menu) + TriggerEvent("esx_society:openBossMenu", "mechanic", function() ESX.CloseContext() end) end @@ -209,7 +209,7 @@ function OpenMobileMechanicActionsMenu() elseif element.value == "hijack_vehicle" then local playerPed = PlayerPedId() local vehicle = ESX.Game.GetVehicleInDirection() - local coords = GetEntityCoords(playerPed) + local _ = GetEntityCoords(playerPed) if IsPedSittingInAnyVehicle(playerPed) then ESX.ShowNotification(TranslateCap("inside_vehicle")) @@ -235,7 +235,7 @@ function OpenMobileMechanicActionsMenu() elseif element.value == "fix_vehicle" then local playerPed = PlayerPedId() local vehicle = ESX.Game.GetVehicleInDirection() - local coords = GetEntityCoords(playerPed) + local _ = GetEntityCoords(playerPed) if IsPedSittingInAnyVehicle(playerPed) then ESX.ShowNotification(TranslateCap("inside_vehicle")) @@ -263,7 +263,7 @@ function OpenMobileMechanicActionsMenu() elseif element.value == "clean_vehicle" then local playerPed = PlayerPedId() local vehicle = ESX.Game.GetVehicleInDirection() - local coords = GetEntityCoords(playerPed) + local _ = GetEntityCoords(playerPed) if IsPedSittingInAnyVehicle(playerPed) then ESX.ShowNotification(TranslateCap("inside_vehicle")) @@ -385,7 +385,7 @@ function OpenMobileMechanicActionsMenu() { icon = "fas fa-object", title = TranslateCap("toolbox"), value = "prop_toolchest_01" }, } - ESX.OpenContext("right", elements2, function(menuObj, elementObj) + ESX.OpenContext("right", elements2, function(_, elementObj) local model = elementObj.value local coords = GetEntityCoords(playerPed) local forward = GetEntityForwardVector(playerPed) @@ -429,7 +429,7 @@ function OpenGetStocksMenu() { icon = "fas fa-check-double", title = "Confirm", value = "confirm" }, } - ESX.OpenContext("right", elements2, function(menu2, element2) + ESX.OpenContext("right", elements2, function(menu2) local count = tonumber(menu2.eles[2].inputValue) if count == nil then From ea68122545b1f61ddacbcd49fac19c1c9957d8da Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Wed, 24 Jul 2024 19:00:57 +0200 Subject: [PATCH 4/9] chore: removed esx_phone support - removed esx_phone support as the framework uses npwd --- .../esx_mechanicjob/client/main.lua | 18 +++--------------- .../esx_mechanicjob/locales/en.lua | 1 - .../esx_mechanicjob/locales/it.lua | 1 - .../esx_mechanicjob/server/main.lua | 1 - 4 files changed, 3 insertions(+), 18 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 2235e9f84..edb8f9212 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua @@ -420,7 +420,7 @@ function OpenGetStocksMenu() } end - ESX.OpenContext("right", elements, function(menu, element) + ESX.OpenContext("right", elements, function(_, element) local itemName = element.value local elements2 = { @@ -638,17 +638,6 @@ AddEventHandler("esx_mechanicjob:hasExitedEntityZone", function(entity) ESX.HideUI() end) -RegisterNetEvent("esx_phone:loaded") -AddEventHandler("esx_phone:loaded", function(phoneNumber, contacts) - local specialContact = { - name = TranslateCap("mechanic"), - number = "mechanic", - base64Icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAA4BJREFUWIXtll9oU3cUx7/nJA02aSSlFouWMnXVB0ejU3wcRteHjv1puoc9rA978cUi2IqgRYWIZkMwrahUGfgkFMEZUdg6C+u21z1o3fbgqigVi7NzUtNcmsac40Npltz7S3rvUHzxQODec87vfD+/e0/O/QFv7Q0beV3QeXqmgV74/7H7fZJvuLwv8q/Xeux1gUrNBpN/nmtavdaqDqBK8VT2RDyV2VHmF1lvLERSBtCVynzYmcp+A9WqT9kcVKX4gHUehF0CEVY+1jYTTIwvt7YSIQnCTvsSUYz6gX5uDt7MP7KOKuQAgxmqQ+neUA+I1B1AiXi5X6ZAvKrabirmVYFwAMRT2RMg7F9SyKspvk73hfrtbkMPyIhA5FVqi0iBiEZMMQdAui/8E4GPv0oAJkpc6Q3+6goAAGpWBxNQmTLFmgL3jSJNgQdGv4pMts2EKm7ICJB/aG0xNdz74VEk13UYCx1/twPR8JjDT8wttyLZtkoAxSb8ZDCz0gdfKxWkFURf2v9qTYH7SK7rQIDn0P3nA0ehixvfwZwE0X9vBE/mW8piohhl1WH18UQBhYnre8N/L8b8xQvlx4ACbB4NnzaeRYDnKm0EALCMLXy84hwuTCXL/ExoB1E7qcK/8NCLIq5HcTT0i6u8TYbXUM1cAyyveVq8Xls7XhYrvY/4n3gC8C+dsmAzL1YUiyfWxvHzsy/w/dNd+KjhW2yvv/RfXr7x9QDcmo1he2RBiCCI1Q8jVj9szPNixVfgz+UiIGyDSrcoRu2J16d3I6e1VYvNSQjXpnucAcEPUOkGYZs/l4uUhowt/3kqu1UIv9n90fAY9jT3YBlbRvFTD4fw++wHjhiTRL/bG75t0jI2ITcHb5om4Xgmhv57xpGOg3d/NIqryOR7z+r+MC6qBJB/ZB2t9Om1D5lFm843G/3E3HI7Yh1xDRAfzLQr5EClBf/HBHK462TG2J0OABXeyWDPZ8VqxmBWYscpyghwtTd4EKpDTjCZdCNmzFM9k+4LHXIFACJN94Z6FiFEpKDQw9HndWsEuhnADVMhAUaYJBp9XrcGQKJ4qFE9k+6r2+MG3k5N8VQ22TVglbX2ZwOzX2VvNKr91zmY6S7N6zqZicVT2WNLyVSehESaBhxnOALfMeYX+K/S2yv7wmMAlvwyuR7FxQUyf0fgc/jztfkJr7XeGgC8BJJgWNV8ImT+AAAAAElFTkSuQmCC", - } - - TriggerEvent("esx_phone:addSpecialContact", specialContact.name, specialContact.number, specialContact.base64Icon) -end) - -- Pop NPC mission vehicle when inside area CreateThread(function() while true do @@ -707,13 +696,12 @@ CreateThread(function() if ESX.PlayerData.job and ESX.PlayerData.job.name == "mechanic" then Sleep = 500 - local coords, letSleep = GetEntityCoords(PlayerPedId()), true + local coords = GetEntityCoords(PlayerPedId()) - for k, v in pairs(Config.Zones) do + for _, v in pairs(Config.Zones) do if v.Type ~= -1 and #(coords - v.Pos) < Config.DrawDistance then Sleep = 0 DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, true, true, 2, true, nil, nil, false) - letSleep = false end end end diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua index fba3ae4c8..db87b1361 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua @@ -62,7 +62,6 @@ Locales["en"] = { ["please_tow"] = "please tow the vehicle", ["wait_five"] = "you must wait 5 minutes", ["must_in_flatbed"] = "you must be in a flatbed to being the mission", - ["mechanic_customer"] = "mechanic Customer", ["you_do_not_room"] = "You do not have more room", ["recovery_gas_can"] = "Gas Can Retrieval...", ["recovery_repair_tools"] = "Repair Tools Retrieval...", diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua index 31736326b..975d4b4e0 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua @@ -62,7 +62,6 @@ Locales["it"] = { ["please_tow"] = "perfavore traina il veicolo", ["wait_five"] = "devi attendere 5 minuti", ["must_in_flatbed"] = "devi essere in un flatbed per avviare la missione", - ["mechanic_customer"] = "cliente meccanico", ["you_do_not_room"] = "non hai più spazio", ["recovery_gas_can"] = "recupero bomboletta di gas...", ["recovery_repair_tools"] = "recupero degli strumenti di riparazione...", 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 69e5f41bf..99c660bd7 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua @@ -2,7 +2,6 @@ if Config.MaxInService ~= -1 then 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" }) RegisterServerEvent("esx_mechanicjob:onNPCJobMissionCompleted") From 8279246ca05b2c5a4cd5621c26487abb7c737b6c Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Thu, 25 Jul 2024 08:34:14 +0200 Subject: [PATCH 5/9] chore: removed the part of code relating to objs --- .../esx_mechanicjob/client/main.lua | 61 ------------------- .../esx_mechanicjob/esx_mechanicjob.sql | 1 - .../localization/en_esx_mecanojob.sql | 1 - .../localization/it_esx_mecanojob.sql | 1 - .../esx_mechanicjob/server/main.lua | 2 +- 5 files changed, 1 insertion(+), 65 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 edb8f9212..d8798902b 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua @@ -620,24 +620,6 @@ AddEventHandler("esx_mechanicjob:hasEnteredMarker", function(zone) ESX.TextUI(CurrentActionMsg) end) -AddEventHandler("esx_mechanicjob:hasEnteredEntityZone", function(entity) - local playerPed = PlayerPedId() - - if ESX.PlayerData.job and ESX.PlayerData.job.name == "mechanic" and not IsPedInAnyVehicle(playerPed, false) then - CurrentAction = "remove_entity" - CurrentActionMsg = TranslateCap("press_remove_obj") - CurrentActionData = { entity = entity } - ESX.TextUI(CurrentActionMsg) - end -end) - -AddEventHandler("esx_mechanicjob:hasExitedEntityZone", function(entity) - if CurrentAction == "remove_entity" then - CurrentAction = nil - end - ESX.HideUI() -end) - -- Pop NPC mission vehicle when inside area CreateThread(function() while true do @@ -742,49 +724,6 @@ CreateThread(function() end end) -CreateThread(function() - local trackedEntities = { - "prop_roadcone02a", - "prop_toolchest_01", - } - - while true do - Wait(500) - - local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) - - local closestDistance = -1 - local closestEntity = nil - - for i = 1, #trackedEntities, 1 do - local object = GetClosestObjectOfType(coords, 3.0, joaat(trackedEntities[i]), false, false, false) - - if DoesEntityExist(object) then - local objCoords = GetEntityCoords(object) - local distance = #(coords - objCoords) - - if closestDistance == -1 or closestDistance > distance then - closestDistance = distance - closestEntity = object - end - end - end - - if closestDistance ~= -1 and closestDistance <= 3.0 then - if LastEntity ~= closestEntity then - TriggerEvent("esx_mechanicjob:hasEnteredEntityZone", closestEntity) - LastEntity = closestEntity - end - else - if LastEntity then - TriggerEvent("esx_mechanicjob:hasExitedEntityZone", LastEntity) - LastEntity = nil - end - end - end -end) - -- Key Controls CreateThread(function() while true do diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/esx_mechanicjob.sql b/server-data/resources/[esx_addons]/esx_mechanicjob/esx_mechanicjob.sql index e8deb2693..9d555c43a 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/esx_mechanicjob.sql +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/esx_mechanicjob.sql @@ -23,7 +23,6 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ; INSERT INTO `items` (name, label, weight) VALUES - ('gazbottle', 'bouteille de gaz', 2), ('fixtool', 'outils réparation', 2), ('carotool', 'outils carosserie', 2), ('blowpipe', 'Chalumeaux', 2), diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/localization/en_esx_mecanojob.sql b/server-data/resources/[esx_addons]/esx_mechanicjob/localization/en_esx_mecanojob.sql index ac1f7fb9c..3bb1e3079 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/localization/en_esx_mecanojob.sql +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/localization/en_esx_mecanojob.sql @@ -23,7 +23,6 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ; INSERT INTO `items` (name, label, weight) VALUES - ('gazbottle', 'Gas Bottle', 2), ('fixtool', 'Repair Tools', 2), ('carotool', 'Tools', 2), ('blowpipe', 'Blowtorch', 2), diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/localization/it_esx_mecanojob.sql b/server-data/resources/[esx_addons]/esx_mechanicjob/localization/it_esx_mecanojob.sql index 4eb733e9c..09aae21de 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/localization/it_esx_mecanojob.sql +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/localization/it_esx_mecanojob.sql @@ -23,7 +23,6 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ; INSERT INTO `items` (name, label, weight) VALUES - ('gazbottle', 'Bottiglia di gas', 2), ('fixtool', 'Strumenti di riparazione', 2), ('carotool', 'Strumenti', 2), ('blowpipe', 'Fiamma ossidrica', 2), 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 99c660bd7..88ce83e99 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua @@ -74,7 +74,7 @@ AddEventHandler("esx_mechanicjob:getStockItem", function(itemName, count) end) end) -ESX.RegisterServerCallback("esx_mechanicjob:getStockItems", function(source, cb) +ESX.RegisterServerCallback("esx_mechanicjob:getStockItems", function(_, cb) TriggerEvent("bpt_addoninventory:getSharedInventory", "society_mechanic", function(inventory) cb(inventory.items) end) From 8b769947e672155140a13aa508975cbd1360dbe2 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Thu, 25 Jul 2024 08:45:58 +0200 Subject: [PATCH 6/9] chore: remove blowpipe + carokit --- .../esx_mechanicjob/client/main.lua | 27 ------------------- .../esx_mechanicjob/esx_mechanicjob.sql | 4 +-- .../esx_mechanicjob/locales/en.lua | 1 - .../esx_mechanicjob/locales/it.lua | 1 - .../localization/en_esx_mecanojob.sql | 4 +-- .../localization/it_esx_mecanojob.sql | 4 +-- .../esx_mechanicjob/server/main.lua | 20 -------------- 7 files changed, 3 insertions(+), 58 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 d8798902b..dfde9b46d 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua @@ -532,33 +532,6 @@ AddEventHandler("esx_mechanicjob:onHijack", function() end end) -RegisterNetEvent("esx_mechanicjob:onCarokit") -AddEventHandler("esx_mechanicjob:onCarokit", function() - local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) - - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - local vehicle - - if IsPedInAnyVehicle(playerPed, false) then - vehicle = GetVehiclePedIsIn(playerPed, false) - else - vehicle = ESX.Game.GetClosestVehicle(coords) - end - - if DoesEntityExist(vehicle) then - TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_HAMMERING", 0, true) - CreateThread(function() - Wait(10000) - SetVehicleFixed(vehicle) - SetVehicleDeformationFixed(vehicle) - ClearPedTasksImmediately(playerPed) - ESX.ShowNotification(TranslateCap("body_repaired")) - end) - end - end -end) - RegisterNetEvent("esx_mechanicjob:onFixkit") AddEventHandler("esx_mechanicjob:onFixkit", function() local playerPed = PlayerPedId() diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/esx_mechanicjob.sql b/server-data/resources/[esx_addons]/esx_mechanicjob/esx_mechanicjob.sql index 9d555c43a..d73d6b38c 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/esx_mechanicjob.sql +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/esx_mechanicjob.sql @@ -25,7 +25,5 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ INSERT INTO `items` (name, label, weight) VALUES ('fixtool', 'outils réparation', 2), ('carotool', 'outils carosserie', 2), - ('blowpipe', 'Chalumeaux', 2), - ('fixkit', 'Kit réparation', 3), - ('carokit', 'Kit carosserie', 3) + ('fixkit', 'Kit réparation', 3) ; diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua index db87b1361..c00d7c1fc 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua @@ -18,7 +18,6 @@ Locales["en"] = { ["gas_can"] = "gas Can", ["repair_tools"] = "repair Tools", ["body_work_tools"] = "bodywork Tools", - ["blowtorch"] = "blowtorch", ["repair_kit"] = "repair Kit", ["body_kit"] = "body Kit", ["billing"] = "billing", diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua index 975d4b4e0..8c6e5d240 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua @@ -18,7 +18,6 @@ Locales["it"] = { ["gas_can"] = "bombola del gas", ["repair_tools"] = "riparazione strumenti", ["body_work_tools"] = "strumenti carrozzeria", - ["blowtorch"] = "fiamma ossidrica", ["repair_kit"] = "kit di riparazione", ["body_kit"] = "body Kit", ["billing"] = "fattura", diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/localization/en_esx_mecanojob.sql b/server-data/resources/[esx_addons]/esx_mechanicjob/localization/en_esx_mecanojob.sql index 3bb1e3079..c5663a3be 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/localization/en_esx_mecanojob.sql +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/localization/en_esx_mecanojob.sql @@ -25,7 +25,5 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ INSERT INTO `items` (name, label, weight) VALUES ('fixtool', 'Repair Tools', 2), ('carotool', 'Tools', 2), - ('blowpipe', 'Blowtorch', 2), - ('fixkit', 'Repair Kit', 3), - ('carokit', 'Body Kit', 3) + ('fixkit', 'Repair Kit', 3) ; diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/localization/it_esx_mecanojob.sql b/server-data/resources/[esx_addons]/esx_mechanicjob/localization/it_esx_mecanojob.sql index 09aae21de..48a434c35 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/localization/it_esx_mecanojob.sql +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/localization/it_esx_mecanojob.sql @@ -25,8 +25,6 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ INSERT INTO `items` (name, label, weight) VALUES ('fixtool', 'Strumenti di riparazione', 2), ('carotool', 'Strumenti', 2), - ('blowpipe', 'Fiamma ossidrica', 2), - ('fixkit', 'Kit di riparazione', 3), - ('carokit', 'Kit per carrozzeria', 3) + ('fixkit', 'Kit di riparazione', 3) ; 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 88ce83e99..1a9b5fadb 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua @@ -21,16 +21,6 @@ AddEventHandler("esx_mechanicjob:onNPCJobMissionCompleted", function() TriggerClientEvent("esx:showNotification", source, TranslateCap("your_comp_earned") .. total) end) -ESX.RegisterUsableItem("blowpipe", function(source) - local source = source - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.removeInventoryItem("blowpipe", 1) - - TriggerClientEvent("esx_mechanicjob:onHijack", source) - TriggerClientEvent("esx:showNotification", source, TranslateCap("you_used_blowtorch")) -end) - ESX.RegisterUsableItem("fixkit", function(source) local source = source local xPlayer = ESX.GetPlayerFromId(source) @@ -41,16 +31,6 @@ ESX.RegisterUsableItem("fixkit", function(source) TriggerClientEvent("esx:showNotification", source, TranslateCap("you_used_repair_kit")) end) -ESX.RegisterUsableItem("carokit", function(source) - local source = source - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.removeInventoryItem("carokit", 1) - - 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) local xPlayer = ESX.GetPlayerFromId(source) From e70302039cebf957ef8c25249b33ad6a1dace6c4 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Thu, 25 Jul 2024 08:50:35 +0200 Subject: [PATCH 7/9] fix: variable source was previously defined as an argument on line 24 --- .../resources/[esx_addons]/esx_mechanicjob/server/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 1a9b5fadb..437782be3 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua @@ -21,7 +21,7 @@ AddEventHandler("esx_mechanicjob:onNPCJobMissionCompleted", function() TriggerClientEvent("esx:showNotification", source, TranslateCap("your_comp_earned") .. total) end) -ESX.RegisterUsableItem("fixkit", function(source) +ESX.RegisterUsableItem("fixkit", function() local source = source local xPlayer = ESX.GetPlayerFromId(source) From ed156a37ad7ca88947b49e72712fb0eb9aeac757 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Thu, 25 Jul 2024 09:13:06 +0200 Subject: [PATCH 8/9] fix: fixed an issue that prevented repair kits from being used --- .../resources/[esx_addons]/esx_mechanicjob/client/main.lua | 4 ++-- .../resources/[esx_addons]/esx_mechanicjob/server/main.lua | 6 +++--- server-data/resources/[ox]/ox_inventory/data/items.lua | 3 +-- 3 files changed, 6 insertions(+), 7 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 dfde9b46d..6d1f7e64f 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/client/main.lua @@ -532,8 +532,8 @@ AddEventHandler("esx_mechanicjob:onHijack", function() end end) -RegisterNetEvent("esx_mechanicjob:onFixkit") -AddEventHandler("esx_mechanicjob:onFixkit", function() +RegisterNetEvent("esx_mechanicjob:onfixkit") +AddEventHandler("esx_mechanicjob:onfixkit", function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) 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 437782be3..9bc18efb4 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/server/main.lua @@ -21,13 +21,13 @@ AddEventHandler("esx_mechanicjob:onNPCJobMissionCompleted", function() TriggerClientEvent("esx:showNotification", source, TranslateCap("your_comp_earned") .. total) end) -ESX.RegisterUsableItem("fixkit", function() - local source = source +ESX.RegisterUsableItem("fixkit", function(source) + local _ = source local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeInventoryItem("fixkit", 1) - TriggerClientEvent("esx_mechanicjob:onFixkit", source) + TriggerClientEvent("esx_mechanicjob:onfixkit", source) TriggerClientEvent("esx:showNotification", source, TranslateCap("you_used_repair_kit")) end) diff --git a/server-data/resources/[ox]/ox_inventory/data/items.lua b/server-data/resources/[ox]/ox_inventory/data/items.lua index a91ba340e..349b1b442 100644 --- a/server-data/resources/[ox]/ox_inventory/data/items.lua +++ b/server-data/resources/[ox]/ox_inventory/data/items.lua @@ -338,8 +338,7 @@ return { ["fixkit"] = { label = "kit di riparazione", - weight = 100, - consume = 1, + weight = 3, stack = true, close = true, }, From 5c953fea3a438ef4ebfe3577679ee8c3f554161c Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Thu, 25 Jul 2024 09:25:56 +0200 Subject: [PATCH 9/9] chore: removed irrelevant translation strings --- .../esx_mechanicjob/locales/en.lua | 17 --------------- .../esx_mechanicjob/locales/it.lua | 21 ++----------------- 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua index c00d7c1fc..11f4d57a3 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/en.lua @@ -14,12 +14,9 @@ Locales["en"] = { ["tow_truck"] = "tow Truck", ["service_full"] = "service full: ", ["open_actions"] = "Press [E] to access the menu.", - ["not_experienced_enough"] = "you are not experienced enough to perform this action.", - ["gas_can"] = "gas Can", ["repair_tools"] = "repair Tools", ["body_work_tools"] = "bodywork Tools", ["repair_kit"] = "repair Kit", - ["body_kit"] = "body Kit", ["billing"] = "billing", ["hijack"] = "hijack", ["repair"] = "repair", @@ -54,27 +51,13 @@ Locales["en"] = { ["inventory"] = "inventory", ["veh_unlocked"] = "Vehicle Unlocked", ["hijack_failed"] = "Hijack Failed", - ["body_repaired"] = "Body repaired", ["veh_repaired"] = "Vehicle Repaired", ["veh_stored"] = "press [E] to store the vehicle.", - ["press_remove_obj"] = "press [E] to remove the object", ["please_tow"] = "please tow the vehicle", ["wait_five"] = "you must wait 5 minutes", ["must_in_flatbed"] = "you must be in a flatbed to being the mission", - ["you_do_not_room"] = "You do not have more room", - ["recovery_gas_can"] = "Gas Can Retrieval...", - ["recovery_repair_tools"] = "Repair Tools Retrieval...", - ["recovery_body_tools"] = "Body Tools Retrieval...", - ["not_enough_gas_can"] = "You do not have enough gas cans.", - ["assembling_blowtorch"] = "Assembling Blowtorch...", - ["not_enough_repair_tools"] = "You do not have enough repair tools.", - ["assembling_repair_kit"] = "Assembling Repair Kit...", - ["not_enough_body_tools"] = "You do not have enough body tools.", - ["assembling_body_kit"] = "Assembling Body Kit...", ["your_comp_earned"] = "your company has earned $", - ["you_used_blowtorch"] = "you used a blowtorch", ["you_used_repair_kit"] = "you used a Repair Kit", - ["you_used_body_kit"] = "you used a Body Kit", ["have_withdrawn"] = "you have withdrawn x%s %s", ["have_deposited"] = "you have deposited x%s %s", ["player_cannot_hold"] = "you do not have enough free space in your inventory!", diff --git a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua index 8c6e5d240..a9219587b 100644 --- a/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua +++ b/server-data/resources/[esx_addons]/esx_mechanicjob/locales/it.lua @@ -14,12 +14,9 @@ Locales["it"] = { ["tow_truck"] = "carro attrezzi", ["service_full"] = "servizio completo: ", ["open_actions"] = "premi [E] per accedere al menu.", - ["not_experienced_enough"] = "non hai abbastanza esperienza per eseguire questa azione.", - ["gas_can"] = "bombola del gas", ["repair_tools"] = "riparazione strumenti", ["body_work_tools"] = "strumenti carrozzeria", ["repair_kit"] = "kit di riparazione", - ["body_kit"] = "body Kit", ["billing"] = "fattura", ["hijack"] = "scassinare", ["repair"] = "riparazione", @@ -54,28 +51,14 @@ Locales["it"] = { ["inventory"] = "inventario", ["veh_unlocked"] = "veicolo sbloccato", ["hijack_failed"] = "traino fallito", - ["body_repaired"] = "carrozzeria riparata", ["veh_repaired"] = "veicolo riparato", ["veh_stored"] = "press [E] per depositare il veicolo.", - ["press_remove_obj"] = "premi [E] per rimuovere", ["please_tow"] = "perfavore traina il veicolo", ["wait_five"] = "devi attendere 5 minuti", - ["must_in_flatbed"] = "devi essere in un flatbed per avviare la missione", - ["you_do_not_room"] = "non hai più spazio", - ["recovery_gas_can"] = "recupero bomboletta di gas...", - ["recovery_repair_tools"] = "recupero degli strumenti di riparazione...", - ["recovery_body_tools"] = "recupero body tools...", - ["not_enough_gas_can"] = "non hai abbastanza bomboletta di gas.", - ["assembling_blowtorch"] = "montaggio fiamma ossidrica...", - ["not_enough_repair_tools"] = "non hai abbastanza strumenti di riparazione.", - ["assembling_repair_kit"] = "assemblaggio kit di riparazione...", - ["not_enough_body_tools"] = "non hai abbastanza body tools.", - ["assembling_body_kit"] = "Assemblaggio Body Kit...", + ["must_in_flatbed"] = "devi essere nel pianale per avviare la missione", ["your_comp_earned"] = "la tua azienda ha guadagnato $", - ["you_used_blowtorch"] = "hai usato una fiamma ossidrica", ["you_used_repair_kit"] = "hai usato un Kit di riparazione", - ["you_used_body_kit"] = "hai usato un Body Kit", ["have_withdrawn"] = "hai prelevato x%s %s", ["have_deposited"] = "hai depositato x%s %s", - ["player_cannot_hold"] = "non hai abbastanza spazio libero nel tuo inventario!", + ["player_cannot_hold"] = "non hai abbastanza spazio nel tuo inventario!", }