diff --git a/client/main.lua b/client/main.lua index a12debb2..d1be3dd5 100644 --- a/client/main.lua +++ b/client/main.lua @@ -27,6 +27,7 @@ local NPCLastCancel = GetGameTimer() - 5 * 60000 local NPCHasBeenNextToTowable = false local NPCTargetDeleterZone = false local IsDead = false +local IsBusy = false ESX = nil @@ -97,10 +98,10 @@ end function OpenMecanoActionsMenu() local elements = { - {label = _U('vehicle_list'), value = 'vehicle_list'}, - {label = _U('work_wear'), value = 'cloakroom'}, - {label = _U('civ_wear'), value = 'cloakroom2'}, - {label = _U('deposit_stock'), value = 'put_stock'}, + {label = _U('vehicle_list'), value = 'vehicle_list'}, + {label = _U('work_wear'), value = 'cloakroom'}, + {label = _U('civ_wear'), value = 'cloakroom2'}, + {label = _U('deposit_stock'), value = 'put_stock'}, {label = _U('withdraw_stock'), value = 'get_stock'} } if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name == 'boss' then @@ -309,9 +310,9 @@ function OpenMecanoCraftMenu() if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then local elements = { - {label = _U('blowtorch'), value = 'blow_pipe'}, + {label = _U('blowtorch'), value = 'blow_pipe'}, {label = _U('repair_kit'), value = 'fix_kit'}, - {label = _U('body_kit'), value = 'caro_kit'} + {label = _U('body_kit'), value = 'caro_kit'} } ESX.UI.Menu.CloseAll() @@ -371,7 +372,9 @@ function OpenMobileMecanoActionsMenu() {label = _U('place_objects'), value = 'object_spawner'} } }, - function(data, menu) + function(data, menu) + if IsBusy then return end + if data.current.value == 'billing' then ESX.UI.Menu.Open( 'dialog', GetCurrentResourceName(), 'billing', @@ -383,11 +386,12 @@ function OpenMobileMecanoActionsMenu() if amount == nil or amount < 0 then ESX.ShowNotification(_U('amount_invalid')) else - menu.close() + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() if closestPlayer == -1 or closestDistance > 3.0 then ESX.ShowNotification(_U('no_players_nearby')) - else + else + menu.close() TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mecano', _U('mechanic'), amount) end end @@ -400,92 +404,90 @@ function OpenMobileMecanoActionsMenu() if data.current.value == 'hijack_vehicle' then - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local vehicle = ESX.Game.GetVehicleInDirection() + local coords = GetEntityCoords(playerPed) - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + if IsPedSittingInAnyVehicle(playerPed) then + ESX.ShowNotification(_U('inside_vehicle')) + return + end - local vehicle = nil + if DoesEntityExist(vehicle) then + IsBusy = true + TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_WELDING", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(10000) - if IsPedInAnyVehicle(playerPed, false) then - vehicle = GetVehiclePedIsIn(playerPed, false) - else - vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) - end + SetVehicleDoorsLocked(vehicle, 1) + SetVehicleDoorsLockedForAllPlayers(vehicle, false) + ClearPedTasksImmediately(playerPed) - if DoesEntityExist(vehicle) then - TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_WELDING", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(10000) - SetVehicleDoorsLocked(vehicle, 1) - SetVehicleDoorsLockedForAllPlayers(vehicle, false) - ClearPedTasksImmediately(playerPed) - ESX.ShowNotification(_U('vehicle_unlocked')) - end) - end + ESX.ShowNotification(_U('vehicle_unlocked')) + IsBusy = false + end) + else + ESX.ShowNotification(_U('no_vehicle_nearby')) + end - end + elseif data.current.value == 'fix_vehicle' then - end + local playerPed = GetPlayerPed(-1) + local vehicle = ESX.Game.GetVehicleInDirection() + local coords = GetEntityCoords(playerPed) - if data.current.value == 'fix_vehicle' then + if IsPedSittingInAnyVehicle(playerPed) then + ESX.ShowNotification(_U('inside_vehicle')) + return + end - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + if DoesEntityExist(vehicle) then + IsBusy = true + TaskStartScenarioInPlace(playerPed, "PROP_HUMAN_BUM_BIN", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(20000) - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + SetVehicleFixed(vehicle) + SetVehicleDeformationFixed(vehicle) + SetVehicleUndriveable(vehicle, false) + SetVehicleEngineOn(vehicle, true, true) + ClearPedTasksImmediately(playerPed) - local vehicle = nil + ESX.ShowNotification(_U('vehicle_repaired')) + IsBusy = false + end) + else + ESX.ShowNotification(_U('no_vehicle_nearby')) + end - if IsPedInAnyVehicle(playerPed, false) then - vehicle = GetVehiclePedIsIn(playerPed, false) - else - vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) - end + elseif data.current.value == 'clean_vehicle' then - if DoesEntityExist(vehicle) then - TaskStartScenarioInPlace(playerPed, "PROP_HUMAN_BUM_BIN", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(20000) - SetVehicleFixed(vehicle) - SetVehicleDeformationFixed(vehicle) - SetVehicleUndriveable(vehicle, false) - SetVehicleEngineOn(vehicle, true, true) - ClearPedTasksImmediately(playerPed) - ESX.ShowNotification(_U('vehicle_repaired')) - end) - end - end - end + local playerPed = GetPlayerPed(-1) + local vehicle = ESX.Game.GetVehicleInDirection() + local coords = GetEntityCoords(playerPed) - if data.current.value == 'clean_vehicle' then + if IsPedSittingInAnyVehicle(playerPed) then + ESX.ShowNotification(_U('inside_vehicle')) + return + end - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + if DoesEntityExist(vehicle) then + IsBusy = true + TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_MAID_CLEAN", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(10000) - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + SetVehicleDirtLevel(vehicle, 0) + ClearPedTasksImmediately(playerPed) - local vehicle = nil + ESX.ShowNotification(_U('vehicle_cleaned')) + IsBusy = false + end) + else + ESX.ShowNotification(_U('no_vehicle_nearby')) + end - if IsPedInAnyVehicle(playerPed, false) then - vehicle = GetVehiclePedIsIn(playerPed, false) - else - vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) - end - - if DoesEntityExist(vehicle) then - TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_MAID_CLEAN", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(10000) - SetVehicleDirtLevel(vehicle, 0) - ClearPedTasksImmediately(playerPed) - ESX.ShowNotification(_U('vehicle_cleaned')) - end) - end - end - end - - if data.current.value == 'del_vehicle' then + elseif data.current.value == 'del_vehicle' then local ped = GetPlayerPed(-1) @@ -595,6 +597,12 @@ function OpenMobileMecanoActionsMenu() end if data.current.value == 'object_spawner' then + local playerPed = GetPlayerPed(-1) + + if IsPedSittingInAnyVehicle(playerPed) then + ESX.ShowNotification(_U('inside_vehicle')) + return + end ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'mobile_mecano_actions_spawn', @@ -608,9 +616,7 @@ function OpenMobileMecanoActionsMenu() }, function(data2, menu2) - local model = data2.current.value - local playerPed = GetPlayerPed(-1) local coords = GetEntityCoords(playerPed) local forward = GetEntityForwardVector(playerPed) local x, y, z = table.unpack(coords + forward * 1.0) @@ -1130,7 +1136,7 @@ Citizen.CreateThread(function() AddTextComponentString(CurrentActionMsg) DisplayHelpTextFromStringLabel(0, 0, 1, -1) - if IsControlJustReleased(0, 38) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + if IsControlJustReleased(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then if CurrentAction == 'mecano_actions_menu' then OpenMecanoActionsMenu() diff --git a/config.lua b/config.lua index 2ecf3fce..f9932363 100644 --- a/config.lua +++ b/config.lua @@ -10,7 +10,7 @@ Config.Locale = 'fr' Config.Zones = { MecanoActions = { - Pos = { x = -347.291, y = -133.370, z = 38.009 }, + Pos = { x = -342.291, y = -133.370, z = 38.009 }, Size = { x = 1.5, y = 1.5, z = 1.0 }, Color = { r = 204, g = 204, b = 0 }, Type = 1, diff --git a/locales/br.lua b/locales/br.lua index e5dd9b0a..037aac1e 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -33,6 +33,8 @@ Locales['br'] = { ['invoice_amount'] = 'Valor da fatura', ['amount_invalid'] = 'Valor inválido', ['no_players_nearby'] = 'Sem jogadores nas proximidades', + ['no_vehicle_nearby'] = 'there is no nearby vehicle', + ['inside_vehicle'] = 'you can\'t do this from inside the vehicle!', ['vehicle_unlocked'] = 'Veículo ~g~Destrancado', ['vehicle_repaired'] = 'Veículo ~g~Reparado', ['vehicle_cleaned'] = 'Veículo ~g~Limpo', @@ -77,7 +79,7 @@ Locales['br'] = { ['you_used_blowtorch'] = 'Você usou um ~b~maçarico', ['you_used_repair_kit'] = 'Você usou um ~b~Kit de reparação', ['you_used_body_kit'] = 'Você usou um ~b~Kit de corpo', - ['you_removed'] = 'Você removeu x', - ['you_added'] = 'Você adicionou x', + ['have_withdrawn'] = 'você retirou ~y~x%s~s~ ~b~%s~s~', + ['have_deposited'] = 'você depositou ~y~x%s~s~ ~b~%s~s~', ['player_cannot_hold'] = 'you do ~r~not~w~ have enough ~y~free space~w~ in your inventory!', } diff --git a/locales/en.lua b/locales/en.lua index b04bee39..67cd091d 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -32,20 +32,22 @@ Locales['en'] = { ['place_objects'] = 'place Objects', ['invoice_amount'] = 'invoice Amount', ['amount_invalid'] = 'invalid amount', - ['no_players_nearby'] = 'no players nearby', - ['vehicle_unlocked'] = 'vehicle ~g~Unlocked', - ['vehicle_repaired'] = 'vehicle ~g~Repaired', - ['vehicle_cleaned'] = 'vehicle ~g~cleaned', - ['vehicle_impounded'] = 'vehicle ~r~Impounded', - ['must_seat_driver'] = 'you must be seated on the ~r~driver\'s side!', + ['no_players_nearby'] = 'there is no nearby player', + ['no_vehicle_nearby'] = 'there is no nearby vehicle', + ['inside_vehicle'] = 'you can\'t do this from inside the vehicle!', + ['vehicle_unlocked'] = 'the vehicle has been ~g~unlocked', + ['vehicle_repaired'] = 'the vehicle has been ~g~repaired', + ['vehicle_cleaned'] = 'the vehicle has been ~g~cleaned', + ['vehicle_impounded'] = 'the vehicle has been ~r~impounded', + ['must_seat_driver'] = 'you must be in the driver seat!', ['must_near'] = 'you must be ~r~near a vehicle~s~ to impound it.', - ['vehicle_success_attached'] = 'vehicle successfully ~b~attached~s~!.', - ['please_drop_off'] = 'please drop off the vehicle at the dealership', + ['vehicle_success_attached'] = 'vehicle successfully ~b~attached~s~', + ['please_drop_off'] = 'please drop off the vehicle at the garage', ['cant_attach_own_tt'] = '~r~you can\'t~s~ attach own tow truck', ['no_veh_att'] = 'there is no ~r~vehicle~s~ to be attached', ['not_right_veh'] = 'this is not the right vehicle', ['veh_det_succ'] = 'vehicle successfully ~b~dettached~s~!', - ['imp_flatbed'] = '~r~Action impossible!~s~ You need a ~b~Flatbed~s~ for it', + ['imp_flatbed'] = '~r~Action impossible!~s~ You need a ~b~Flatbed~s~ to load a vehicle', ['objects'] = 'objects', ['roadcone'] = 'roadcone', ['toolbox'] = 'toolbox', @@ -77,7 +79,7 @@ Locales['en'] = { ['you_used_blowtorch'] = 'you used a ~b~blowtorch', ['you_used_repair_kit'] = 'you used a ~b~Repair Kit', ['you_used_body_kit'] = 'you used a ~b~Body Kit', - ['you_removed'] = 'you have removed x', - ['you_added'] = 'you have added x', + ['have_withdrawn'] = 'you have withdrawn ~y~x%s~s~ ~b~%s~s~', + ['have_deposited'] = 'you have deposited ~y~x%s~s~ ~b~%s~s~', ['player_cannot_hold'] = 'you do ~r~not~w~ have enough ~y~free space~w~ in your inventory!', } diff --git a/locales/fi.lua b/locales/fi.lua index 14dc703a..390c60d2 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -33,6 +33,8 @@ Locales['fi'] = { ['invoice_amount'] = 'laskun summa', ['amount_invalid'] = 'virheellinen summa', ['no_players_nearby'] = 'ei pelaajia lähettyvillä', + ['no_vehicle_nearby'] = 'there is no nearby vehicle', + ['inside_vehicle'] = 'you can\'t do this from inside the vehicle!', ['vehicle_unlocked'] = 'ajoneuvo ~g~Avattu', ['vehicle_repaired'] = 'ajoneuvo ~g~Korjattu', ['vehicle_cleaned'] = 'ajoneuvo ~g~pesty', @@ -77,7 +79,7 @@ Locales['fi'] = { ['you_used_blowtorch'] = 'sinä käytit yhden ~b~Polttoleikkurin', ['you_used_repair_kit'] = 'sinä käytit yhden ~b~Korjauskitin', ['you_used_body_kit'] = 'sinä käytit yhden ~b~Korikitin', - ['you_removed'] = 'sinä otit x', - ['you_added'] = 'sinä lisäsit x', + ['have_withdrawn'] = 'sinä nostit ~y~x%s~s~ ~b~%s~s~', + ['have_deposited'] = 'sinä talletit ~y~x%s~s~ ~b~%s~s~', ['player_cannot_hold'] = 'sinulla ~r~ei ole~w~ tarpeeksi ~y~vapaata tilaa~w~ repussasi!', } diff --git a/locales/fr.lua b/locales/fr.lua index 06f6da76..61ef8e02 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -28,11 +28,13 @@ Locales['fr'] = { ['hijack'] = 'crocheter', ['repair'] = 'réparer', ['clean'] = 'nettoyer', - ['impound'] = 'fourrière', + ['imp_veh'] = 'fourrière', ['place_objects'] = 'placer objets', ['invoice_amount'] = 'montant de la facture', ['amount_invalid'] = 'montant invalide', ['no_players_nearby'] = 'aucun joueur à proximité', + ['no_vehicle_nearby'] = 'there is no nearby vehicle', + ['inside_vehicle'] = 'you can\'t do this from inside the vehicle!', ['vehicle_unlocked'] = 'véhicule ~g~déverouillé', ['vehicle_repaired'] = 'véhicule ~g~réparé', ['vehicle_cleaned'] = 'véhicule ~g~néttoyé', @@ -78,7 +80,7 @@ Locales['fr'] = { ['you_used_blowtorch'] = 'Vous avez utilisé un ~b~Chalumeau', ['you_used_repair_kit'] = 'Vous avez utilisé un ~b~Kit de réparation', ['you_used_body_kit'] = 'Vous avez utilisé un ~b~Kit de carosserie', - ['you_removed'] = 'vous avez retiré x', - ['you_added'] = 'Vous avez ajouté x', + ['have_withdrawn'] = 'vous avez pris ~y~x%s~s~ ~b~%s~s~', + ['have_deposited'] = 'vous avez déposé ~y~x%s~s~ ~b~%s~s~', ['player_cannot_hold'] = 'you do ~r~not~w~ have enough ~y~free space~w~ in your inventory!', } diff --git a/locales/sv.lua b/locales/sv.lua index 2ae76b55..8dc6132e 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -27,20 +27,22 @@ Locales['sv'] = { ['billing'] = 'fakturering', ['hijack'] = 'kapa', ['repair'] = 'reparera', - ['clean'] = 'Tvätta', - ['imp_veh'] = 'beslagta', + ['clean'] = 'tvätta', + ['imp_veh'] = 'beslagta fordon', ['place_objects'] = 'placera objekt', ['invoice_amount'] = 'fakturabelopp', - ['amount_invalid'] = 'Ogiltigt belopp', + ['amount_invalid'] = 'ogiltigt belopp', ['no_players_nearby'] = 'det finns inga spelare i närheten', - ['vehicle_unlocked'] = 'fordon ~g~olåst', - ['vehicle_repaired'] = 'fordon ~g~reparerade', - ['vehicle_cleaned'] = 'fordon ~g~rengöras', - ['vehicle_impounded'] = 'fordon ~r~beslaget', - ['must_seat_driver'] = 'du måste sitta i ~r~förarsätet!~s~', + ['no_vehicle_nearby'] = 'det finns inget fordon i närheten', + ['inside_vehicle'] = 'du kan inte göra detta i det trånga utrymmet!', + ['vehicle_unlocked'] = 'fordonet har ~g~olåsts upp~s~', + ['vehicle_repaired'] = 'fordonet har ~g~reparerats~s~', + ['vehicle_cleaned'] = 'fordonet har ~g~rengjorts~s~', + ['vehicle_impounded'] = 'fordonet har ~r~beslagtagits~s~', + ['must_seat_driver'] = 'du måste sitta i ~r~förarsätet~s~!', ['must_near'] = 'du måste vara ~r~nära ett fordon~s~ för att beslagta det.', ['vehicle_success_attached'] = 'fordonet är ~b~bundet~s~!', - ['please_drop_off'] = 'vänligen släpp av fordonet hos ~y~bilförsäljaren~s~', + ['please_drop_off'] = 'vänligen släpp av fordonet hos ~y~garaget~s~', ['cant_attach_own_tt'] = 'du kan ~r~inte~s~ binda din egna truck!', ['no_veh_att'] = 'det finns inget ~r~fordon~s~ i närheten', ['not_right_veh'] = 'detta är ~r~inte~s~ rätt fordon', @@ -77,7 +79,7 @@ Locales['sv'] = { ['you_used_blowtorch'] = 'du har använt en ~b~blåslampa~s~', ['you_used_repair_kit'] = 'du har använt en ~b~reparationssats~s~', ['you_used_body_kit'] = 'du har använt en ~b~karossverktyg~s~', - ['you_removed'] = 'du har ~r~tagit bort~s~ x', - ['you_added'] = 'du ~y~la till~s~ x', + ['have_withdrawn'] = 'du har tagit ut ~y~x%s~s~ ~b~%s~s~', + ['have_deposited'] = 'du har lagrat ~y~x%s~s~ ~b~%s~s~', ['player_cannot_hold'] = 'du har ~r~inte~w~ tillräckligt med ~y~utrymme~w~ för att hålla det!', } \ No newline at end of file diff --git a/server/main.lua b/server/main.lua index 954c6e07..7c90d40c 100644 --- a/server/main.lua +++ b/server/main.lua @@ -47,7 +47,7 @@ AddEventHandler('esx_mecanojob:stopHarvest', function() local _source = source PlayersHarvesting[_source] = false end) ------------- Récupération Outils Réparation -------------- + local function Harvest2(source) SetTimeout(4000, function() @@ -317,7 +317,7 @@ AddEventHandler('esx_mecanojob:putStockItems', function(itemName, count) TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity')) end - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('you_added') .. count .. ' ' .. item.label) + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_deposited', count, item.label)) end)