From 3f1973348565e896eefe3db685674c31d723b8e2 Mon Sep 17 00:00:00 2001 From: ig0ne Date: Wed, 9 Aug 2017 00:45:48 +0200 Subject: [PATCH 01/66] Initial commit --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..06ba4b47 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# fxserver-esx_mecanojob \ No newline at end of file From 26bc40f86b7f97492377a181312adde61bf3fa25 Mon Sep 17 00:00:00 2001 From: ig0ne Date: Wed, 9 Aug 2017 01:00:46 +0200 Subject: [PATCH 02/66] Add files via upload --- esx_mecanojob/__resource.lua | 11 + esx_mecanojob/client/main.lua | 863 ++++++++++++++++++++++++++++++++++ esx_mecanojob/config.lua | 42 ++ esx_mecanojob/server/main.lua | 268 +++++++++++ esx_mecanojob_full.sql | 26 + esx_mecanojob_minimal.sql | 22 + 6 files changed, 1232 insertions(+) create mode 100644 esx_mecanojob/__resource.lua create mode 100644 esx_mecanojob/client/main.lua create mode 100644 esx_mecanojob/config.lua create mode 100644 esx_mecanojob/server/main.lua create mode 100644 esx_mecanojob_full.sql create mode 100644 esx_mecanojob_minimal.sql diff --git a/esx_mecanojob/__resource.lua b/esx_mecanojob/__resource.lua new file mode 100644 index 00000000..6c475099 --- /dev/null +++ b/esx_mecanojob/__resource.lua @@ -0,0 +1,11 @@ +description 'ESX Mecano Job' + +client_scripts { + 'config.lua', + 'client/main.lua' +} + +server_scripts { + 'config.lua', + 'server/main.lua' +} \ No newline at end of file diff --git a/esx_mecanojob/client/main.lua b/esx_mecanojob/client/main.lua new file mode 100644 index 00000000..992fc71d --- /dev/null +++ b/esx_mecanojob/client/main.lua @@ -0,0 +1,863 @@ +ESX = nil +local PlayerData = {} +local GUI = {} +GUI.Time = 0 +local HasAlreadyEnteredMarker = false +local LastZone = nil +local CurrentAction = nil +local CurrentActionMsg = '' +local CurrentActionData = {} +local OnJob = false +local TargetCoords = nil + +Citizen.CreateThread(function() + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end +end) + +function OpenMecanoActionsMenu() + + local elements = { + {label = 'Sortir Véhicule', value = 'vehicle_list'}, + {label = 'Tenue de travail', value = 'cloakroom'}, + {label = 'Tenue civile', value = 'cloakroom2'} + } + if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name == 'boss' then + table.insert(elements, {label = 'Retirer argent société', value = 'withdraw_society_money'}) + table.insert(elements, {label = 'Déposer argent ', value = 'deposit_money'}) + table.insert(elements, {label = 'Blanchir argent', value = 'wash_money'}) + end + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mecano_actions', + { + title = 'Mecano', + elements = elements + }, + function(data, menu) + if data.current.value == 'vehicle_list' then + local elements = { + {label = 'Plateau', value = 'flatbed'}, + {label = 'Dépaneuse', value = 'towtruck2'} + } + + if Config.EnablePlayerManagement and PlayerData.job ~= nil and + (PlayerData.job.grade_name == 'boss' or PlayerData.job.grade_name == 'chef' or PlayerData.job.grade_name == 'experimente') then + table.insert(elements, {label = 'SlamVan', value = 'slamvan3'}) + end + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'spawn_vehicle', + { + title = 'Véhicule de service', + elements = elements + }, + function(data, menu) + for i=1, #elements, 1 do + if Config.MaxInService == -1 then + local playerPed = GetPlayerPed(-1) + local coords = Config.Zones.VehicleSpawnPoint.Pos + ESX.Game.SpawnVehicle(data.current.value, coords, 90.0, function(vehicle) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + break + else + ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount) + if canTakeService then + local playerPed = GetPlayerPed(-1) + local coords = Config.Zones.VehicleSpawnPoint.Pos + ESX.Game.SpawnVehicle(data.current.value, coords, 90.0, function(vehicle) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + else + ESX.ShowNotification('Service complet : ' .. inServiceCount .. '/' .. maxInService) + end + end, 'mecano') + break + end + end + menu.close() + end, + function(data, menu) + menu.close() + OpenMecanoActionsMenu() + end + ) + end + + if data.current.value == 'cloakroom' then + menu.close() + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + + if skin.sex == 0 then + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) + else + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) + end + + end) + end + + if data.current.value == 'cloakroom2' then + menu.close() + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + + TriggerEvent('skinchanger:loadSkin', skin) + + end) + end + + if data.current.value == 'withdraw_society_money' then + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'withdraw_society_money_amount', + { + title = 'Montant du retrait' + }, + function(data, menu) + local amount = tonumber(data.value) + if amount == nil then + ESX.ShowNotification('Montant invalide') + else + menu.close() + TriggerServerEvent('esx_society:withdrawMoney', 'mecano', amount) + end + end, + function(data, menu) + menu.close() + end + ) + end + + if data.current.value == 'deposit_money' then + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'deposit_money_amount', + { + title = 'Montant du dépôt' + }, + function(data, menu) + local amount = tonumber(data.value) + if amount == nil then + ESX.ShowNotification('Montant invalide') + else + menu.close() + TriggerServerEvent('esx_society:depositMoney', 'mecano', amount) + end + end, + function(data, menu) + menu.close() + end + ) + end + + if data.current.value == 'wash_money' then + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'wash_money_amount', + { + title = 'Montant à blanchir' + }, + function(data, menu) + local amount = tonumber(data.value) + if amount == nil then + ESX.ShowNotification('Montant invalide') + else + menu.close() + TriggerServerEvent('esx_society:washMoney', 'mecano', amount) + end + end, + function(data, menu) + menu.close() + end + ) + end + end, + function(data, menu) + menu.close() + CurrentAction = 'mecano_actions_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu.' + CurrentActionData = {} + end + ) +end + +function OpenMecanoHarvestMenu() + + if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then + local elements = { + {label = 'Bouteille de gaz', value = 'gaz_bottle'}, + {label = 'Outils réparation', value = 'fix_tool'}, + {label = 'Outils Carosserie', value = 'caro_tool'} + } + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mecano_harvest', + { + title = 'Récolte', + elements = elements + }, + function(data, menu) + if data.current.value == 'gaz_bottle' then + menu.close() + TriggerServerEvent('esx_mecanojob:startHarvest') + end + + if data.current.value == 'fix_tool' then + menu.close() + TriggerServerEvent('esx_mecanojob:startHarvest2') + end + + if data.current.value == 'caro_tool' then + menu.close() + TriggerServerEvent('esx_mecanojob:startHarvest3') + end + + end, + function(data, menu) + menu.close() + CurrentAction = 'mecano_harvest_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu de récolte.' + CurrentActionData = {} + end + ) + else + ESX.ShowNotification("Vous n'êtes ~r~pas assez expérimenté~s~ pour effectuer cette action.") + end +end + +function OpenMecanoCraftMenu() + if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then + + local elements = { + {label = 'Chalumeaux', value = 'blow_pipe'}, + {label = 'Kit réparation', value = 'fix_kit'}, + {label = 'Outils Carosserie', value = 'caro_kit'} + } + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mecano_craft', + { + title = 'Etabli', + elements = elements + }, + function(data, menu) + if data.current.value == 'blow_pipe' then + menu.close() + TriggerServerEvent('esx_mecanojob:startCraft') + end + + if data.current.value == 'fix_kit' then + menu.close() + TriggerServerEvent('esx_mecanojob:startCraft2') + end + + if data.current.value == 'caro_kit' then + menu.close() + TriggerServerEvent('esx_mecanojob:startCraft3') + end + + end, + function(data, menu) + menu.close() + CurrentAction = 'mecano_craft_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu établi.' + CurrentActionData = {} + end + ) + else + ESX.ShowNotification("Vous n'êtes ~r~pas assez expérimenté~s~ pour effectuer cette action.") + end +end + +function OpenMobileMecanoActionsMenu() + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mobile_mecano_actions', + { + title = 'Mécano', + elements = { + {label = 'Facuration', value = 'billing'}, + {label = 'Crocheter', value = 'hijack_vehicle'}, + {label = 'Réparer', value = 'fix_vehicle'}, + {label = 'Netoyer', value = 'clean_vehicle'}, + {label = 'Fourrière', value = 'del_vehicle'}, + {label = 'Plateau', value = 'dep_vehicle'}, + {label = 'Placer objets', value = 'object_spawner'} + } + }, + function(data, menu) + if data.current.value == 'billing' then + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'billing', + { + title = 'Montant de la facture' + }, + function(data, menu) + local amount = tonumber(data.value) + if amount == nil then + ESX.ShowNotification('Montant invalide') + else + menu.close() + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification('Aucun joueur à proximité') + else + TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mecano', 'Mecano', amount) + end + end + end, + function(data, menu) + menu.close() + end + ) + end + + if data.current.value == 'hijack_vehicle' then + + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + + local vehicle = nil + + 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_WELDING", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(10000) + SetVehicleDoorsLocked(vehicle, 1) + SetVehicleDoorsLockedForAllPlayers(vehicle, false) + ClearPedTasksImmediately(playerPed) + TriggerEvent('esx:showNotification', 'Véhicule ~g~déverouillé') + end) + end + + end + + end + + if data.current.value == 'fix_vehicle' then + + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + + local vehicle = nil + + 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, "PROP_HUMAN_BUM_BIN", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(20000) + SetVehicleFixed(vehicle) + SetVehicleDeformationFixed(vehicle) + SetVehicleUndriveable(vehicle, false) + ClearPedTasksImmediately(playerPed) + TriggerEvent('esx:showNotification', 'Véhicule ~g~réparé') + end) + end + end + end + + if data.current.value == 'clean_vehicle' then + + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + + local vehicle = nil + + 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) + TriggerEvent('esx:showNotification', 'Véhicule ~g~néttoyé') + end) + end + end + end + + if data.current.value == 'del_vehicle' then + + local ped = GetPlayerPed( -1 ) + + if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then + local pos = GetEntityCoords( ped ) + + if ( IsPedSittingInAnyVehicle( ped ) ) then + local vehicle = GetVehiclePedIsIn( ped, false ) + + if ( GetPedInVehicleSeat( vehicle, -1 ) == ped ) then + TriggerEvent('esx:showNotification', 'Vehicule ~r~mis en fourrière') + SetEntityAsMissionEntity( vehicle, true, true ) + deleteCar( vehicle ) + else + TriggerEvent('esx:showNotification', 'Vous devez être assis du ~r~côté conducteur!') + end + else + local playerPos = GetEntityCoords( ped, 1 ) + local inFrontOfPlayer = GetOffsetFromEntityInWorldCoords( ped, 0.0, distanceToCheck, 0.0 ) + local vehicle = GetVehicleInDirection( playerPos, inFrontOfPlayer ) + + if ( DoesEntityExist( vehicle ) ) then + TriggerEvent('esx:showNotification', 'Vehicule ~r~mis en fourrière') + SetEntityAsMissionEntity( vehicle, true, true ) + deleteCar( vehicle ) + else + TriggerEvent('esx:showNotification', 'Vous devez être ~r~près d\'un véhicule~s~ pour le mettre en fourrière') + end + end + end + end + + if data.current.value == 'dep_vehicle' then + + local playerped = GetPlayerPed(-1) + local vehicle = GetVehiclePedIsIn(playerped, true) + + local towmodel = GetHashKey('flatbed') + local isVehicleTow = IsVehicleModel(vehicle, towmodel) + + if isVehicleTow then + + local coordA = GetEntityCoords(playerped, 1) + local coordB = GetOffsetFromEntityInWorldCoords(playerped, 0.0, 5.0, 0.0) + local targetVehicle = getVehicleInDirection(coordA, coordB) + + if currentlyTowedVehicle == nil then + if targetVehicle ~= 0 then + if not IsPedInAnyVehicle(playerped, true) then + if vehicle ~= targetVehicle then + AttachEntityToEntity(targetVehicle, vehicle, 20, -0.5, -5.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) + currentlyTowedVehicle = targetVehicle + TriggerEvent('esx:showNotification', 'Vehicule ~b~attaché~s~ avec succès!') + else + TriggerEvent('esx:showNotification', '~r~Impossible~s~ d\'attacher votre propre dépanneuse') + end + end + else + TriggerEvent('esx:showNotification', 'Il n\'y a ~r~pas de véhicule~s~ à attacher') + end + else + AttachEntityToEntity(currentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) + DetachEntity(currentlyTowedVehicle, true, true) + currentlyTowedVehicle = nil + TriggerEvent('esx:showNotification', 'Vehicule ~b~détattaché~s~ avec succès!') + end + else + TriggerEvent('esx:showNotification', '~r~Impossible! ~s~Vous devez avoir un ~b~Flatbed ~s~pour ça') + end + end + + if data.current.value == 'object_spawner' then + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mobile_mecano_actions_spawn', + { + title = 'Objets', + align = 'top-left', + elements = { + {label = 'Plot', value = 'prop_roadcone02a'}, + {label = 'Boîte à outils', value = 'prop_toolchest_01'}, + }, + }, + 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) + + if model == 'prop_roadcone02a' then + z = z - 2.0 + elseif model == 'prop_toolchest_01' then + z = z - 3.0 + end + + ESX.Game.SpawnObject(model, { + x = x, + y = y, + z = z + }, 3.0, function(obj) + SetEntityHeading(obj, GetEntityHeading(playerPed)) + PlaceObjectOnGroundProperly(obj) + end) + + end, + function(data2, menu2) + menu2.close() + end + ) + + end + + end, + function(data, menu) + menu.close() + end + ) +end + +RegisterNetEvent('esx_mecanojob:onHijack') +AddEventHandler('esx_mecanojob:onHijack', function() + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + + local vehicle = nil + + if IsPedInAnyVehicle(playerPed, false) then + vehicle = GetVehiclePedIsIn(playerPed, false) + else + vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) + end + + local crochete = math.random(100) + local alarm = math.random(100) + + if DoesEntityExist(vehicle) then + if alarm <= 33 then + SetVehicleAlarm(vehicle, true) + StartVehicleAlarm(vehicle) + end + TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_WELDING", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(10000) + if crochete <= 66 then + SetVehicleDoorsLocked(vehicle, 1) + SetVehicleDoorsLockedForAllPlayers(vehicle, false) + ClearPedTasksImmediately(playerPed) + TriggerEvent('esx:showNotification', '~g~Véhicule déverouillé') + else + TriggerEvent('esx:showNotification', '~r~Crochetage raté') + ClearPedTasksImmediately(playerPed) + end + end) + end + + end +end) + +RegisterNetEvent('esx_mecanojob:onCarokit') +AddEventHandler('esx_mecanojob:onCarokit', function() + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + + local vehicle = nil + + 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_HAMMERING", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(10000) + SetVehicleFixed(vehicle) + SetVehicleDeformationFixed(vehicle) + ClearPedTasksImmediately(playerPed) + TriggerEvent('esx:showNotification', '~g~Carosserie réparée') + end) + end + end +end) + +RegisterNetEvent('esx_mecanojob:onFixkit') +AddEventHandler('esx_mecanojob:onFixkit', function() + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + + local vehicle = nil + + 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, "PROP_HUMAN_BUM_BIN", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(20000) + SetVehicleFixed(vehicle) + SetVehicleDeformationFixed(vehicle) + SetVehicleUndriveable(vehicle, false) + ClearPedTasksImmediately(playerPed) + TriggerEvent('esx:showNotification', '~g~Véhicule réparé') + end) + end + end +end) + +function setEntityHeadingFromEntity ( vehicle, playerPed ) + local heading = GetEntityHeading(vehicle) + SetEntityHeading( playerPed, heading ) +end + +function getVehicleInDirection(coordFrom, coordTo) + local rayHandle = CastRayPointToPoint(coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 10, GetPlayerPed(-1), 0) + local a, b, c, d, vehicle = GetRaycastResult(rayHandle) + return vehicle +end + +function deleteCar( entity ) + Citizen.InvokeNative( 0xEA386986E786A54F, Citizen.PointerValueIntInitialized( entity ) ) +end + +RegisterNetEvent('esx:playerLoaded') +AddEventHandler('esx:playerLoaded', function(xPlayer) + PlayerData = xPlayer +end) + +RegisterNetEvent('esx:setJob') +AddEventHandler('esx:setJob', function(job) + PlayerData.job = job +end) + +AddEventHandler('esx_mecanojob:hasEnteredMarker', function(zone) + if zone == 'MecanoActions' then + CurrentAction = 'mecano_actions_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu.' + CurrentActionData = {} + end + if zone == 'Garage' then + CurrentAction = 'mecano_harvest_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu de récolte.' + CurrentActionData = {} + end + if zone == 'Craft' then + CurrentAction = 'mecano_craft_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu établi.' + CurrentActionData = {} + end + if zone == 'VehicleDeleter' then + local playerPed = GetPlayerPed(-1) + if IsPedInAnyVehicle(playerPed, false) then + CurrentAction = 'delete_vehicle' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule.' + CurrentActionData = {} + end + end +end) + +AddEventHandler('esx_mecanojob:hasExitedMarker', function(zone) + + if zone == 'Craft' then + TriggerServerEvent('esx_mecanojob:stopCraft') + TriggerServerEvent('esx_mecanojob:stopCraft2') + TriggerServerEvent('esx_mecanojob:stopCraft3') + end + + if zone == 'Garage' then + TriggerServerEvent('esx_mecanojob:stopHarvest') + TriggerServerEvent('esx_mecanojob:stopHarvest2') + TriggerServerEvent('esx_mecanojob:stopHarvest3') + end + + CurrentAction = nil + ESX.UI.Menu.CloseAll() +end) + +AddEventHandler('esx_mecanojob:hasEnteredEntityZone', function(entity) + + local playerPed = GetPlayerPed(-1) + + if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' and not IsPedInAnyVehicle(playerPed, false) then + CurrentAction = 'remove_entity' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour enlever l\'objet' + CurrentActionData = {entity = entity} + end + +end) + +AddEventHandler('esx_mecanojob:hasExitedEntityZone', function(entity) + + if CurrentAction == 'remove_entity' then + CurrentAction = nil + end + +end) + +RegisterNetEvent('esx_phone:loaded') +AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) + local specialContact = { + name = 'Mecano', + number = 'mecano', + 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) + +-- Create Blips +Citizen.CreateThread(function() + local blip = AddBlipForCoord(Config.Zones.MecanoActions.Pos.x, Config.Zones.MecanoActions.Pos.y, Config.Zones.MecanoActions.Pos.z) + SetBlipSprite (blip, 446) + SetBlipDisplay(blip, 4) + SetBlipScale (blip, 1.0) + SetBlipColour (blip, 5) + SetBlipAsShortRange(blip, true) + BeginTextCommandSetBlipName("STRING") + AddTextComponentString("Mecano") + EndTextCommandSetBlipName(blip) +end) + +-- Display markers +Citizen.CreateThread(function() + while true do + Wait(0) + if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + + local coords = GetEntityCoords(GetPlayerPed(-1)) + + for k,v in pairs(Config.Zones) do + if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 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, false, true, 2, false, false, false, false) + end + end + end + end +end) + +-- Enter / Exit marker events +Citizen.CreateThread(function() + while true do + Wait(0) + if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + local coords = GetEntityCoords(GetPlayerPed(-1)) + local isInMarker = false + local currentZone = nil + for k,v in pairs(Config.Zones) do + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then + isInMarker = true + currentZone = k + end + end + if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then + HasAlreadyEnteredMarker = true + LastZone = currentZone + TriggerEvent('esx_mecanojob:hasEnteredMarker', currentZone) + end + if not isInMarker and HasAlreadyEnteredMarker then + HasAlreadyEnteredMarker = false + TriggerEvent('esx_mecanojob:hasExitedMarker', LastZone) + end + end + end +end) + +Citizen.CreateThread(function() + while true do + + Citizen.Wait(0) + + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + local entity, distance = ESX.Game.GetClosestObject({ + 'prop_roadcone02a', + 'prop_toolchest_01' + }) + + if distance ~= -1 and distance <= 3.0 then + + if LastEntity ~= entity then + TriggerEvent('esx_mecanojob:hasEnteredEntityZone', entity) + LastEntity = entity + end + + else + + if LastEntity ~= nil then + TriggerEvent('esx_mecanojob:hasExitedEntityZone', LastEntity) + LastEntity = nil + end + + end + + end +end) + + +-- Key Controls +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + if CurrentAction ~= nil then + SetTextComponentFormat('STRING') + AddTextComponentString(CurrentActionMsg) + DisplayHelpTextFromStringLabel(0, 0, 1, -1) + if IsControlJustReleased(0, 38) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + if CurrentAction == 'mecano_actions_menu' then + OpenMecanoActionsMenu() + end + if CurrentAction == 'mecano_harvest_menu' then + OpenMecanoHarvestMenu() + end + if CurrentAction == 'mecano_craft_menu' then + OpenMecanoCraftMenu() + end + if CurrentAction == 'delete_vehicle' then + local playerPed = GetPlayerPed(-1) + local vehicle = GetVehiclePedIsIn(playerPed, false) + local hash = GetEntityModel(vehicle) + if hash == GetHashKey('flatbed') or hash == GetHashKey('towtruck2') or hash == GetHashKey('slamvan3') then + if Config.MaxInService ~= -1 then + TriggerServerEvent('esx_service:disableService', 'mecano') + end + DeleteVehicle(vehicle) + else + ESX.ShowNotification('Vous ne pouvez ranger que des ~b~véhicules de Mécano~s~.') + end + end + if CurrentAction == 'remove_entity' then + DeleteEntity(CurrentActionData.entity) + end + CurrentAction = nil + end + end + + if IsControlJustReleased(0, 167) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + OpenMobileMecanoActionsMenu() + end + end +end) \ No newline at end of file diff --git a/esx_mecanojob/config.lua b/esx_mecanojob/config.lua new file mode 100644 index 00000000..b413d582 --- /dev/null +++ b/esx_mecanojob/config.lua @@ -0,0 +1,42 @@ +Config = {} +Config.DrawDistance = 100.0 +Config.MaxInService = -1 +Config.EnablePlayerManagement = true + +Config.Zones = { + + MecanoActions = { + Pos = {x = -205.90548706055, y = -1327.7248535156, z = 29.89040184021}, + Size = {x = 1.5, y = 1.5, z = 1.0}, + Color = {r = 204, g = 204, b = 0}, + Type = 1 + }, + + Garage = { + Pos = {x = -97.5797576904297, y = 6496.11376953125, z = 30.4909038543701}, + Size = {x = 1.5, y = 1.5, z = 1.0}, + Color = {r = 204, g = 204, b = 0}, + Type = 1 + }, + + Craft = { + Pos = {x = -196.51593017578, y = -1318.4403076172, z = 30.089345932007}, + Size = {x = 1.5, y = 1.5, z = 1.0}, + Color = {r = 204, g = 204, b = 0}, + Type = 1 + }, + + VehicleSpawnPoint = { + Pos = {x = -157.7899017334, y = -1305.8979492188, z = 30.348382949829}, + Size = {x = 1.5, y = 1.5, z = 1.0}, + Type = -1 + }, + + VehicleDeleter = { + Pos = {x = -182.78112792969, y = -1330.5368652344, z = 30.194892883301}, + Size = {x = 3.0, y = 3.0, z = 1.0}, + Color = {r = 204, g = 204, b = 0}, + Type = 1 + } + +} diff --git a/esx_mecanojob/server/main.lua b/esx_mecanojob/server/main.lua new file mode 100644 index 00000000..fb6a325a --- /dev/null +++ b/esx_mecanojob/server/main.lua @@ -0,0 +1,268 @@ +ESX = nil +PlayersHarvesting = {} +PlayersHarvesting2 = {} +PlayersHarvesting3 = {} +PlayersCrafting = {} +PlayersCrafting2 = {} +PlayersCrafting3 = {} + +TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + +if Config.MaxInService ~= -1 then + TriggerEvent('esx_service:activateService', 'mecano', Config.MaxInService) +end + +TriggerEvent('esx_phone:registerCallback', function(source, phoneNumber, message, anon) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayers = ESX.GetPlayers() + + if phoneNumber == 'mecano' then + for k, v in pairs(xPlayers) do + if v.job.name == 'mecano' then + TriggerClientEvent('esx_phone:onMessage', v.source, xPlayer.get('phoneNumber'), message, xPlayer.get('coords'), anon, 'Appel Mécano') + end + end + end +end) +-------------- Récupération bouteille de gaz ------------- +---- Sqlut je teste ------ +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, '~r~Vous n\'avez plus de place') + else + xPlayer.addInventoryItem('gazbottle', 1) + + Harvest(source) + end + end + end) +end + +RegisterServerEvent('esx_mecanojob:startHarvest') +AddEventHandler('esx_mecanojob:startHarvest', function() + local _source = source + PlayersHarvesting[_source] = true + TriggerClientEvent('esx:showNotification', _source, 'Récupération de ~b~bouteille de gaz~s~...') + Harvest(source) +end) + +RegisterServerEvent('esx_mecanojob:stopHarvest') +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() + + if PlayersHarvesting2[source] == true then + + local xPlayer = ESX.GetPlayerFromId(source) + local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count + if FixToolQuantity >= 5 then + TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez ~r~plus de place') + else + xPlayer.addInventoryItem('fixtool', 1) + + Harvest2(source) + end + end + end) +end + +RegisterServerEvent('esx_mecanojob:startHarvest2') +AddEventHandler('esx_mecanojob:startHarvest2', function() + local _source = source + PlayersHarvesting2[_source] = true + TriggerClientEvent('esx:showNotification', _source, 'Récupération d\'~b~Outils réparation~s~...') + Harvest2(_source) +end) + +RegisterServerEvent('esx_mecanojob:stopHarvest2') +AddEventHandler('esx_mecanojob:stopHarvest2', function() + local _source = source + PlayersHarvesting2[_source] = false +end) +----------------- Récupération Outils Carosserie ---------------- +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, 'Vous n\'avez ~r~plus de place') + else + xPlayer.addInventoryItem('carotool', 1) + + Harvest3(source) + end + end + end) +end + +RegisterServerEvent('esx_mecanojob:startHarvest3') +AddEventHandler('esx_mecanojob:startHarvest3', function() + local _source = source + PlayersHarvesting3[_source] = true + TriggerClientEvent('esx:showNotification', _source, 'Récupération d\'~b~Outils carosserie~s~...') + Harvest3(_source) +end) + +RegisterServerEvent('esx_mecanojob:stopHarvest3') +AddEventHandler('esx_mecanojob:stopHarvest3', function() + local _source = source + PlayersHarvesting3[_source] = false +end) +------------ Craft Chalumeau ------------------- +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, 'Vous n\'avez ~r~pas assez~s~ de bouteille de gaz') + else + xPlayer.removeInventoryItem('gazbottle', 1) + xPlayer.addInventoryItem('blowpipe', 1) + + Craft(source) + end + end + end) +end + +RegisterServerEvent('esx_mecanojob:startCraft') +AddEventHandler('esx_mecanojob:startCraft', function() + local _source = source + PlayersCrafting[_source] = true + TriggerClientEvent('esx:showNotification', _source, 'Assemblage de ~b~Chalumeaux~s~...') + Craft(_source) +end) + +RegisterServerEvent('esx_mecanojob:stopCraft') +AddEventHandler('esx_mecanojob:stopCraft', function() + local _source = source + PlayersCrafting[_source] = false +end) +------------ Craft kit Réparation -------------- +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, 'Vous n\'avez ~r~pas assez~s~ d\'outils réparation') + else + xPlayer.removeInventoryItem('fixtool', 1) + xPlayer.addInventoryItem('fixkit', 1) + + Craft2(source) + end + end + end) +end + +RegisterServerEvent('esx_mecanojob:startCraft2') +AddEventHandler('esx_mecanojob:startCraft2', function() + local _source = source + PlayersCrafting2[_source] = true + TriggerClientEvent('esx:showNotification', _source, 'Assemblage de ~b~Kit réparation~s~...') + Craft2(_source) +end) + +RegisterServerEvent('esx_mecanojob:stopCraft2') +AddEventHandler('esx_mecanojob:stopCraft2', function() + local _source = source + PlayersCrafting2[_source] = false +end) +----------------- Craft kit Carosserie ---------------- +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, 'Vous n\'avez ~r~pas assez~s~ d\'outils carosserie') + else + xPlayer.removeInventoryItem('carotool', 1) + xPlayer.addInventoryItem('carokit', 1) + + Craft3(source) + end + end + end) +end + +RegisterServerEvent('esx_mecanojob:startCraft3') +AddEventHandler('esx_mecanojob:startCraft3', function() + local _source = source + PlayersCrafting3[_source] = true + TriggerClientEvent('esx:showNotification', _source, 'Assemblage de ~b~kit carosserie~s~...') + Craft3(_source) +end) + +RegisterServerEvent('esx_mecanojob:stopCraft3') +AddEventHandler('esx_mecanojob:stopCraft3', function() + local _source = source + PlayersCrafting3[_source] = false +end) + +---------------------------- register usable item -------------------------------------------------- +ESX.RegisterUsableItem('blowpipe', function(source) + + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) + + xPlayer.removeInventoryItem('blowpipe', 1) + + TriggerClientEvent('esx_mecanojob:onHijack', _source) + TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé un ~b~Chalumeau') + +end) + +ESX.RegisterUsableItem('fixkit', function(source) + + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) + + xPlayer.removeInventoryItem('fixkit', 1) + + TriggerClientEvent('esx_mecanojob:onFixkit', _source) + TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé un ~b~Kit de réparation') + +end) + +ESX.RegisterUsableItem('carokit', function(source) + + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) + + xPlayer.removeInventoryItem('carokit', 1) + + TriggerClientEvent('esx_mecanojob:onCarokit', _source) + TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé un ~b~Kit de carosserie') + +end) \ No newline at end of file diff --git a/esx_mecanojob_full.sql b/esx_mecanojob_full.sql new file mode 100644 index 00000000..367ca698 --- /dev/null +++ b/esx_mecanojob_full.sql @@ -0,0 +1,26 @@ +USE `essentialmode`; + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_mecano','Mécano',1) +; + +INSERT INTO `jobs` (name, label) VALUES + ('mecano','Mécano') +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('mecano',0,'recrue','Recrue',12,'{}','{}'), + ('mecano',1,'novice','Novice',24,'{}','{}'), + ('mecano',2,'experimente','Experimente',36,'{}','{}'), + ('mecano',3,'chief','Chef d\'équipe',48,'{}','{}'), + ('mecano',4,'boss','Patron',0,'{}','{}') +; + +INSERT INTO `items` (name, label) VALUES + ('gazbottle', 'bouteille de gaz'), + ('fixtool', 'outils réparation'), + ('carotool', 'outils carosserie'), + ('blowpipe', 'Chalumeaux'), + ('fixkit', 'Kit réparation'), + ('carokit', 'Kit carosserie') +; \ No newline at end of file diff --git a/esx_mecanojob_minimal.sql b/esx_mecanojob_minimal.sql new file mode 100644 index 00000000..48dd963e --- /dev/null +++ b/esx_mecanojob_minimal.sql @@ -0,0 +1,22 @@ +USE `essentialmode`; + +INSERT INTO `jobs` (name, label) VALUES + ('mecano','Mécano') +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('mecano',0,'recrue','Recrue',12,'{}','{}'), + ('mecano',1,'novice','Novice',24,'{}','{}'), + ('mecano',2,'experimente','Experimente',36,'{}','{}'), + ('mecano',3,'chief','Chef d\'équipe',48,'{}','{}'), + ('mecano',4,'boss','Patron',0,'{}','{}') +; + +INSERT INTO `items` (name, label) VALUES + ('gazbottle', 'bouteille de gaz'), + ('fixtool', 'outils réparation'), + ('carotool', 'outils carosserie'), + ('blowpipe', 'Chalumeaux'), + ('fixkit', 'Kit réparation'), + ('carokit', 'Kit carosserie') +; \ No newline at end of file From dcdfc2b9c9bac5213ac74246c1cb0a660ceaf805 Mon Sep 17 00:00:00 2001 From: ig0ne Date: Wed, 9 Aug 2017 01:04:08 +0200 Subject: [PATCH 03/66] Update README.md --- README.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 06ba4b47..0b8b09eb 100644 --- a/README.md +++ b/README.md @@ -1 +1,33 @@ -# fxserver-esx_mecanojob \ No newline at end of file +# fxserver-esx_mecanojob + +FXServer ESX Mecano Job + +[REQUIREMENTS] + +* Auto mode + * No need to download another resource + +* Player management (billing and boss actions) + * esx_society => https://github.com/FXServer-ESX/fxserver-esx_society + * esx_billing => https://github.com/FXServer-ESX/fxserver-esx_billing + +[INSTALLATION] + +1) CD in your resources/[esx] folder +2) Clone the repository +``` +git clone https://github.com/FXServer-ESX/fxserver-esx_mecanojob esx_mecanojob +``` +3) * Auto mode : Import esx_mecanojob_minimal.sql in your database + * Player management : Import esx_mecanojob_full.sql in your database + +4) Add this in your server.cfg : + +``` +start esx_mecanojob +``` +5) If you want player management you have to set Config.EnablePlayerManagement to true in config.lua + +[KNOWN BUGS] + +* Props spawn don't work at all From 6c429f98d9b51dc0ef21a0de33c74f237969c63a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Wed, 9 Aug 2017 14:12:26 +0200 Subject: [PATCH 04/66] Add LICENSE.txt --- LICENSE.txt | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..30ace6a8 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file From 78ac3497c4867878c2115fe882ed2a7629826511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Wed, 9 Aug 2017 16:19:20 +0200 Subject: [PATCH 05/66] Move files outside folder --- .../__resource.lua => __resource.lua | 20 +- {esx_mecanojob/client => client}/main.lua | 1724 ++++++++--------- esx_mecanojob/config.lua => config.lua | 84 +- {esx_mecanojob/server => server}/main.lua | 534 ++--- 4 files changed, 1181 insertions(+), 1181 deletions(-) rename esx_mecanojob/__resource.lua => __resource.lua (93%) rename {esx_mecanojob/client => client}/main.lua (96%) rename esx_mecanojob/config.lua => config.lua (96%) rename {esx_mecanojob/server => server}/main.lua (96%) diff --git a/esx_mecanojob/__resource.lua b/__resource.lua similarity index 93% rename from esx_mecanojob/__resource.lua rename to __resource.lua index 6c475099..734f0377 100644 --- a/esx_mecanojob/__resource.lua +++ b/__resource.lua @@ -1,11 +1,11 @@ -description 'ESX Mecano Job' - -client_scripts { - 'config.lua', - 'client/main.lua' -} - -server_scripts { - 'config.lua', - 'server/main.lua' +description 'ESX Mecano Job' + +client_scripts { + 'config.lua', + 'client/main.lua' +} + +server_scripts { + 'config.lua', + 'server/main.lua' } \ No newline at end of file diff --git a/esx_mecanojob/client/main.lua b/client/main.lua similarity index 96% rename from esx_mecanojob/client/main.lua rename to client/main.lua index 992fc71d..a96d1225 100644 --- a/esx_mecanojob/client/main.lua +++ b/client/main.lua @@ -1,863 +1,863 @@ -ESX = nil -local PlayerData = {} -local GUI = {} -GUI.Time = 0 -local HasAlreadyEnteredMarker = false -local LastZone = nil -local CurrentAction = nil -local CurrentActionMsg = '' -local CurrentActionData = {} -local OnJob = false -local TargetCoords = nil - -Citizen.CreateThread(function() - while ESX == nil do - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) - end -end) - -function OpenMecanoActionsMenu() - - local elements = { - {label = 'Sortir Véhicule', value = 'vehicle_list'}, - {label = 'Tenue de travail', value = 'cloakroom'}, - {label = 'Tenue civile', value = 'cloakroom2'} - } - if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name == 'boss' then - table.insert(elements, {label = 'Retirer argent société', value = 'withdraw_society_money'}) - table.insert(elements, {label = 'Déposer argent ', value = 'deposit_money'}) - table.insert(elements, {label = 'Blanchir argent', value = 'wash_money'}) - end - - ESX.UI.Menu.CloseAll() - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mecano_actions', - { - title = 'Mecano', - elements = elements - }, - function(data, menu) - if data.current.value == 'vehicle_list' then - local elements = { - {label = 'Plateau', value = 'flatbed'}, - {label = 'Dépaneuse', value = 'towtruck2'} - } - - if Config.EnablePlayerManagement and PlayerData.job ~= nil and - (PlayerData.job.grade_name == 'boss' or PlayerData.job.grade_name == 'chef' or PlayerData.job.grade_name == 'experimente') then - table.insert(elements, {label = 'SlamVan', value = 'slamvan3'}) - end - - ESX.UI.Menu.CloseAll() - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'spawn_vehicle', - { - title = 'Véhicule de service', - elements = elements - }, - function(data, menu) - for i=1, #elements, 1 do - if Config.MaxInService == -1 then - local playerPed = GetPlayerPed(-1) - local coords = Config.Zones.VehicleSpawnPoint.Pos - ESX.Game.SpawnVehicle(data.current.value, coords, 90.0, function(vehicle) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - break - else - ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount) - if canTakeService then - local playerPed = GetPlayerPed(-1) - local coords = Config.Zones.VehicleSpawnPoint.Pos - ESX.Game.SpawnVehicle(data.current.value, coords, 90.0, function(vehicle) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - else - ESX.ShowNotification('Service complet : ' .. inServiceCount .. '/' .. maxInService) - end - end, 'mecano') - break - end - end - menu.close() - end, - function(data, menu) - menu.close() - OpenMecanoActionsMenu() - end - ) - end - - if data.current.value == 'cloakroom' then - menu.close() - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) - - if skin.sex == 0 then - TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) - else - TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) - end - - end) - end - - if data.current.value == 'cloakroom2' then - menu.close() - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) - - TriggerEvent('skinchanger:loadSkin', skin) - - end) - end - - if data.current.value == 'withdraw_society_money' then - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'withdraw_society_money_amount', - { - title = 'Montant du retrait' - }, - function(data, menu) - local amount = tonumber(data.value) - if amount == nil then - ESX.ShowNotification('Montant invalide') - else - menu.close() - TriggerServerEvent('esx_society:withdrawMoney', 'mecano', amount) - end - end, - function(data, menu) - menu.close() - end - ) - end - - if data.current.value == 'deposit_money' then - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'deposit_money_amount', - { - title = 'Montant du dépôt' - }, - function(data, menu) - local amount = tonumber(data.value) - if amount == nil then - ESX.ShowNotification('Montant invalide') - else - menu.close() - TriggerServerEvent('esx_society:depositMoney', 'mecano', amount) - end - end, - function(data, menu) - menu.close() - end - ) - end - - if data.current.value == 'wash_money' then - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'wash_money_amount', - { - title = 'Montant à blanchir' - }, - function(data, menu) - local amount = tonumber(data.value) - if amount == nil then - ESX.ShowNotification('Montant invalide') - else - menu.close() - TriggerServerEvent('esx_society:washMoney', 'mecano', amount) - end - end, - function(data, menu) - menu.close() - end - ) - end - end, - function(data, menu) - menu.close() - CurrentAction = 'mecano_actions_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu.' - CurrentActionData = {} - end - ) -end - -function OpenMecanoHarvestMenu() - - if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then - local elements = { - {label = 'Bouteille de gaz', value = 'gaz_bottle'}, - {label = 'Outils réparation', value = 'fix_tool'}, - {label = 'Outils Carosserie', value = 'caro_tool'} - } - - ESX.UI.Menu.CloseAll() - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mecano_harvest', - { - title = 'Récolte', - elements = elements - }, - function(data, menu) - if data.current.value == 'gaz_bottle' then - menu.close() - TriggerServerEvent('esx_mecanojob:startHarvest') - end - - if data.current.value == 'fix_tool' then - menu.close() - TriggerServerEvent('esx_mecanojob:startHarvest2') - end - - if data.current.value == 'caro_tool' then - menu.close() - TriggerServerEvent('esx_mecanojob:startHarvest3') - end - - end, - function(data, menu) - menu.close() - CurrentAction = 'mecano_harvest_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu de récolte.' - CurrentActionData = {} - end - ) - else - ESX.ShowNotification("Vous n'êtes ~r~pas assez expérimenté~s~ pour effectuer cette action.") - end -end - -function OpenMecanoCraftMenu() - if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then - - local elements = { - {label = 'Chalumeaux', value = 'blow_pipe'}, - {label = 'Kit réparation', value = 'fix_kit'}, - {label = 'Outils Carosserie', value = 'caro_kit'} - } - - ESX.UI.Menu.CloseAll() - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mecano_craft', - { - title = 'Etabli', - elements = elements - }, - function(data, menu) - if data.current.value == 'blow_pipe' then - menu.close() - TriggerServerEvent('esx_mecanojob:startCraft') - end - - if data.current.value == 'fix_kit' then - menu.close() - TriggerServerEvent('esx_mecanojob:startCraft2') - end - - if data.current.value == 'caro_kit' then - menu.close() - TriggerServerEvent('esx_mecanojob:startCraft3') - end - - end, - function(data, menu) - menu.close() - CurrentAction = 'mecano_craft_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu établi.' - CurrentActionData = {} - end - ) - else - ESX.ShowNotification("Vous n'êtes ~r~pas assez expérimenté~s~ pour effectuer cette action.") - end -end - -function OpenMobileMecanoActionsMenu() - - ESX.UI.Menu.CloseAll() - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mobile_mecano_actions', - { - title = 'Mécano', - elements = { - {label = 'Facuration', value = 'billing'}, - {label = 'Crocheter', value = 'hijack_vehicle'}, - {label = 'Réparer', value = 'fix_vehicle'}, - {label = 'Netoyer', value = 'clean_vehicle'}, - {label = 'Fourrière', value = 'del_vehicle'}, - {label = 'Plateau', value = 'dep_vehicle'}, - {label = 'Placer objets', value = 'object_spawner'} - } - }, - function(data, menu) - if data.current.value == 'billing' then - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'billing', - { - title = 'Montant de la facture' - }, - function(data, menu) - local amount = tonumber(data.value) - if amount == nil then - ESX.ShowNotification('Montant invalide') - else - menu.close() - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification('Aucun joueur à proximité') - else - TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mecano', 'Mecano', amount) - end - end - end, - function(data, menu) - menu.close() - end - ) - end - - if data.current.value == 'hijack_vehicle' then - - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) - - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - - local vehicle = nil - - 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_WELDING", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(10000) - SetVehicleDoorsLocked(vehicle, 1) - SetVehicleDoorsLockedForAllPlayers(vehicle, false) - ClearPedTasksImmediately(playerPed) - TriggerEvent('esx:showNotification', 'Véhicule ~g~déverouillé') - end) - end - - end - - end - - if data.current.value == 'fix_vehicle' then - - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) - - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - - local vehicle = nil - - 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, "PROP_HUMAN_BUM_BIN", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(20000) - SetVehicleFixed(vehicle) - SetVehicleDeformationFixed(vehicle) - SetVehicleUndriveable(vehicle, false) - ClearPedTasksImmediately(playerPed) - TriggerEvent('esx:showNotification', 'Véhicule ~g~réparé') - end) - end - end - end - - if data.current.value == 'clean_vehicle' then - - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) - - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - - local vehicle = nil - - 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) - TriggerEvent('esx:showNotification', 'Véhicule ~g~néttoyé') - end) - end - end - end - - if data.current.value == 'del_vehicle' then - - local ped = GetPlayerPed( -1 ) - - if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then - local pos = GetEntityCoords( ped ) - - if ( IsPedSittingInAnyVehicle( ped ) ) then - local vehicle = GetVehiclePedIsIn( ped, false ) - - if ( GetPedInVehicleSeat( vehicle, -1 ) == ped ) then - TriggerEvent('esx:showNotification', 'Vehicule ~r~mis en fourrière') - SetEntityAsMissionEntity( vehicle, true, true ) - deleteCar( vehicle ) - else - TriggerEvent('esx:showNotification', 'Vous devez être assis du ~r~côté conducteur!') - end - else - local playerPos = GetEntityCoords( ped, 1 ) - local inFrontOfPlayer = GetOffsetFromEntityInWorldCoords( ped, 0.0, distanceToCheck, 0.0 ) - local vehicle = GetVehicleInDirection( playerPos, inFrontOfPlayer ) - - if ( DoesEntityExist( vehicle ) ) then - TriggerEvent('esx:showNotification', 'Vehicule ~r~mis en fourrière') - SetEntityAsMissionEntity( vehicle, true, true ) - deleteCar( vehicle ) - else - TriggerEvent('esx:showNotification', 'Vous devez être ~r~près d\'un véhicule~s~ pour le mettre en fourrière') - end - end - end - end - - if data.current.value == 'dep_vehicle' then - - local playerped = GetPlayerPed(-1) - local vehicle = GetVehiclePedIsIn(playerped, true) - - local towmodel = GetHashKey('flatbed') - local isVehicleTow = IsVehicleModel(vehicle, towmodel) - - if isVehicleTow then - - local coordA = GetEntityCoords(playerped, 1) - local coordB = GetOffsetFromEntityInWorldCoords(playerped, 0.0, 5.0, 0.0) - local targetVehicle = getVehicleInDirection(coordA, coordB) - - if currentlyTowedVehicle == nil then - if targetVehicle ~= 0 then - if not IsPedInAnyVehicle(playerped, true) then - if vehicle ~= targetVehicle then - AttachEntityToEntity(targetVehicle, vehicle, 20, -0.5, -5.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) - currentlyTowedVehicle = targetVehicle - TriggerEvent('esx:showNotification', 'Vehicule ~b~attaché~s~ avec succès!') - else - TriggerEvent('esx:showNotification', '~r~Impossible~s~ d\'attacher votre propre dépanneuse') - end - end - else - TriggerEvent('esx:showNotification', 'Il n\'y a ~r~pas de véhicule~s~ à attacher') - end - else - AttachEntityToEntity(currentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) - DetachEntity(currentlyTowedVehicle, true, true) - currentlyTowedVehicle = nil - TriggerEvent('esx:showNotification', 'Vehicule ~b~détattaché~s~ avec succès!') - end - else - TriggerEvent('esx:showNotification', '~r~Impossible! ~s~Vous devez avoir un ~b~Flatbed ~s~pour ça') - end - end - - if data.current.value == 'object_spawner' then - - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mobile_mecano_actions_spawn', - { - title = 'Objets', - align = 'top-left', - elements = { - {label = 'Plot', value = 'prop_roadcone02a'}, - {label = 'Boîte à outils', value = 'prop_toolchest_01'}, - }, - }, - 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) - - if model == 'prop_roadcone02a' then - z = z - 2.0 - elseif model == 'prop_toolchest_01' then - z = z - 3.0 - end - - ESX.Game.SpawnObject(model, { - x = x, - y = y, - z = z - }, 3.0, function(obj) - SetEntityHeading(obj, GetEntityHeading(playerPed)) - PlaceObjectOnGroundProperly(obj) - end) - - end, - function(data2, menu2) - menu2.close() - end - ) - - end - - end, - function(data, menu) - menu.close() - end - ) -end - -RegisterNetEvent('esx_mecanojob:onHijack') -AddEventHandler('esx_mecanojob:onHijack', function() - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) - - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - - local vehicle = nil - - if IsPedInAnyVehicle(playerPed, false) then - vehicle = GetVehiclePedIsIn(playerPed, false) - else - vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) - end - - local crochete = math.random(100) - local alarm = math.random(100) - - if DoesEntityExist(vehicle) then - if alarm <= 33 then - SetVehicleAlarm(vehicle, true) - StartVehicleAlarm(vehicle) - end - TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_WELDING", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(10000) - if crochete <= 66 then - SetVehicleDoorsLocked(vehicle, 1) - SetVehicleDoorsLockedForAllPlayers(vehicle, false) - ClearPedTasksImmediately(playerPed) - TriggerEvent('esx:showNotification', '~g~Véhicule déverouillé') - else - TriggerEvent('esx:showNotification', '~r~Crochetage raté') - ClearPedTasksImmediately(playerPed) - end - end) - end - - end -end) - -RegisterNetEvent('esx_mecanojob:onCarokit') -AddEventHandler('esx_mecanojob:onCarokit', function() - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) - - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - - local vehicle = nil - - 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_HAMMERING", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(10000) - SetVehicleFixed(vehicle) - SetVehicleDeformationFixed(vehicle) - ClearPedTasksImmediately(playerPed) - TriggerEvent('esx:showNotification', '~g~Carosserie réparée') - end) - end - end -end) - -RegisterNetEvent('esx_mecanojob:onFixkit') -AddEventHandler('esx_mecanojob:onFixkit', function() - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) - - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - - local vehicle = nil - - 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, "PROP_HUMAN_BUM_BIN", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(20000) - SetVehicleFixed(vehicle) - SetVehicleDeformationFixed(vehicle) - SetVehicleUndriveable(vehicle, false) - ClearPedTasksImmediately(playerPed) - TriggerEvent('esx:showNotification', '~g~Véhicule réparé') - end) - end - end -end) - -function setEntityHeadingFromEntity ( vehicle, playerPed ) - local heading = GetEntityHeading(vehicle) - SetEntityHeading( playerPed, heading ) -end - -function getVehicleInDirection(coordFrom, coordTo) - local rayHandle = CastRayPointToPoint(coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 10, GetPlayerPed(-1), 0) - local a, b, c, d, vehicle = GetRaycastResult(rayHandle) - return vehicle -end - -function deleteCar( entity ) - Citizen.InvokeNative( 0xEA386986E786A54F, Citizen.PointerValueIntInitialized( entity ) ) -end - -RegisterNetEvent('esx:playerLoaded') -AddEventHandler('esx:playerLoaded', function(xPlayer) - PlayerData = xPlayer -end) - -RegisterNetEvent('esx:setJob') -AddEventHandler('esx:setJob', function(job) - PlayerData.job = job -end) - -AddEventHandler('esx_mecanojob:hasEnteredMarker', function(zone) - if zone == 'MecanoActions' then - CurrentAction = 'mecano_actions_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu.' - CurrentActionData = {} - end - if zone == 'Garage' then - CurrentAction = 'mecano_harvest_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu de récolte.' - CurrentActionData = {} - end - if zone == 'Craft' then - CurrentAction = 'mecano_craft_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu établi.' - CurrentActionData = {} - end - if zone == 'VehicleDeleter' then - local playerPed = GetPlayerPed(-1) - if IsPedInAnyVehicle(playerPed, false) then - CurrentAction = 'delete_vehicle' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule.' - CurrentActionData = {} - end - end -end) - -AddEventHandler('esx_mecanojob:hasExitedMarker', function(zone) - - if zone == 'Craft' then - TriggerServerEvent('esx_mecanojob:stopCraft') - TriggerServerEvent('esx_mecanojob:stopCraft2') - TriggerServerEvent('esx_mecanojob:stopCraft3') - end - - if zone == 'Garage' then - TriggerServerEvent('esx_mecanojob:stopHarvest') - TriggerServerEvent('esx_mecanojob:stopHarvest2') - TriggerServerEvent('esx_mecanojob:stopHarvest3') - end - - CurrentAction = nil - ESX.UI.Menu.CloseAll() -end) - -AddEventHandler('esx_mecanojob:hasEnteredEntityZone', function(entity) - - local playerPed = GetPlayerPed(-1) - - if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' and not IsPedInAnyVehicle(playerPed, false) then - CurrentAction = 'remove_entity' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour enlever l\'objet' - CurrentActionData = {entity = entity} - end - -end) - -AddEventHandler('esx_mecanojob:hasExitedEntityZone', function(entity) - - if CurrentAction == 'remove_entity' then - CurrentAction = nil - end - -end) - -RegisterNetEvent('esx_phone:loaded') -AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) - local specialContact = { - name = 'Mecano', - number = 'mecano', - 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) - --- Create Blips -Citizen.CreateThread(function() - local blip = AddBlipForCoord(Config.Zones.MecanoActions.Pos.x, Config.Zones.MecanoActions.Pos.y, Config.Zones.MecanoActions.Pos.z) - SetBlipSprite (blip, 446) - SetBlipDisplay(blip, 4) - SetBlipScale (blip, 1.0) - SetBlipColour (blip, 5) - SetBlipAsShortRange(blip, true) - BeginTextCommandSetBlipName("STRING") - AddTextComponentString("Mecano") - EndTextCommandSetBlipName(blip) -end) - --- Display markers -Citizen.CreateThread(function() - while true do - Wait(0) - if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - - local coords = GetEntityCoords(GetPlayerPed(-1)) - - for k,v in pairs(Config.Zones) do - if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 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, false, true, 2, false, false, false, false) - end - end - end - end -end) - --- Enter / Exit marker events -Citizen.CreateThread(function() - while true do - Wait(0) - if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - local coords = GetEntityCoords(GetPlayerPed(-1)) - local isInMarker = false - local currentZone = nil - for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then - isInMarker = true - currentZone = k - end - end - if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then - HasAlreadyEnteredMarker = true - LastZone = currentZone - TriggerEvent('esx_mecanojob:hasEnteredMarker', currentZone) - end - if not isInMarker and HasAlreadyEnteredMarker then - HasAlreadyEnteredMarker = false - TriggerEvent('esx_mecanojob:hasExitedMarker', LastZone) - end - end - end -end) - -Citizen.CreateThread(function() - while true do - - Citizen.Wait(0) - - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) - - local entity, distance = ESX.Game.GetClosestObject({ - 'prop_roadcone02a', - 'prop_toolchest_01' - }) - - if distance ~= -1 and distance <= 3.0 then - - if LastEntity ~= entity then - TriggerEvent('esx_mecanojob:hasEnteredEntityZone', entity) - LastEntity = entity - end - - else - - if LastEntity ~= nil then - TriggerEvent('esx_mecanojob:hasExitedEntityZone', LastEntity) - LastEntity = nil - end - - end - - end -end) - - --- Key Controls -Citizen.CreateThread(function() - while true do - Citizen.Wait(0) - if CurrentAction ~= nil then - SetTextComponentFormat('STRING') - AddTextComponentString(CurrentActionMsg) - DisplayHelpTextFromStringLabel(0, 0, 1, -1) - if IsControlJustReleased(0, 38) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - if CurrentAction == 'mecano_actions_menu' then - OpenMecanoActionsMenu() - end - if CurrentAction == 'mecano_harvest_menu' then - OpenMecanoHarvestMenu() - end - if CurrentAction == 'mecano_craft_menu' then - OpenMecanoCraftMenu() - end - if CurrentAction == 'delete_vehicle' then - local playerPed = GetPlayerPed(-1) - local vehicle = GetVehiclePedIsIn(playerPed, false) - local hash = GetEntityModel(vehicle) - if hash == GetHashKey('flatbed') or hash == GetHashKey('towtruck2') or hash == GetHashKey('slamvan3') then - if Config.MaxInService ~= -1 then - TriggerServerEvent('esx_service:disableService', 'mecano') - end - DeleteVehicle(vehicle) - else - ESX.ShowNotification('Vous ne pouvez ranger que des ~b~véhicules de Mécano~s~.') - end - end - if CurrentAction == 'remove_entity' then - DeleteEntity(CurrentActionData.entity) - end - CurrentAction = nil - end - end - - if IsControlJustReleased(0, 167) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - OpenMobileMecanoActionsMenu() - end - end +ESX = nil +local PlayerData = {} +local GUI = {} +GUI.Time = 0 +local HasAlreadyEnteredMarker = false +local LastZone = nil +local CurrentAction = nil +local CurrentActionMsg = '' +local CurrentActionData = {} +local OnJob = false +local TargetCoords = nil + +Citizen.CreateThread(function() + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end +end) + +function OpenMecanoActionsMenu() + + local elements = { + {label = 'Sortir Véhicule', value = 'vehicle_list'}, + {label = 'Tenue de travail', value = 'cloakroom'}, + {label = 'Tenue civile', value = 'cloakroom2'} + } + if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name == 'boss' then + table.insert(elements, {label = 'Retirer argent société', value = 'withdraw_society_money'}) + table.insert(elements, {label = 'Déposer argent ', value = 'deposit_money'}) + table.insert(elements, {label = 'Blanchir argent', value = 'wash_money'}) + end + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mecano_actions', + { + title = 'Mecano', + elements = elements + }, + function(data, menu) + if data.current.value == 'vehicle_list' then + local elements = { + {label = 'Plateau', value = 'flatbed'}, + {label = 'Dépaneuse', value = 'towtruck2'} + } + + if Config.EnablePlayerManagement and PlayerData.job ~= nil and + (PlayerData.job.grade_name == 'boss' or PlayerData.job.grade_name == 'chef' or PlayerData.job.grade_name == 'experimente') then + table.insert(elements, {label = 'SlamVan', value = 'slamvan3'}) + end + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'spawn_vehicle', + { + title = 'Véhicule de service', + elements = elements + }, + function(data, menu) + for i=1, #elements, 1 do + if Config.MaxInService == -1 then + local playerPed = GetPlayerPed(-1) + local coords = Config.Zones.VehicleSpawnPoint.Pos + ESX.Game.SpawnVehicle(data.current.value, coords, 90.0, function(vehicle) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + break + else + ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount) + if canTakeService then + local playerPed = GetPlayerPed(-1) + local coords = Config.Zones.VehicleSpawnPoint.Pos + ESX.Game.SpawnVehicle(data.current.value, coords, 90.0, function(vehicle) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + else + ESX.ShowNotification('Service complet : ' .. inServiceCount .. '/' .. maxInService) + end + end, 'mecano') + break + end + end + menu.close() + end, + function(data, menu) + menu.close() + OpenMecanoActionsMenu() + end + ) + end + + if data.current.value == 'cloakroom' then + menu.close() + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + + if skin.sex == 0 then + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) + else + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) + end + + end) + end + + if data.current.value == 'cloakroom2' then + menu.close() + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + + TriggerEvent('skinchanger:loadSkin', skin) + + end) + end + + if data.current.value == 'withdraw_society_money' then + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'withdraw_society_money_amount', + { + title = 'Montant du retrait' + }, + function(data, menu) + local amount = tonumber(data.value) + if amount == nil then + ESX.ShowNotification('Montant invalide') + else + menu.close() + TriggerServerEvent('esx_society:withdrawMoney', 'mecano', amount) + end + end, + function(data, menu) + menu.close() + end + ) + end + + if data.current.value == 'deposit_money' then + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'deposit_money_amount', + { + title = 'Montant du dépôt' + }, + function(data, menu) + local amount = tonumber(data.value) + if amount == nil then + ESX.ShowNotification('Montant invalide') + else + menu.close() + TriggerServerEvent('esx_society:depositMoney', 'mecano', amount) + end + end, + function(data, menu) + menu.close() + end + ) + end + + if data.current.value == 'wash_money' then + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'wash_money_amount', + { + title = 'Montant à blanchir' + }, + function(data, menu) + local amount = tonumber(data.value) + if amount == nil then + ESX.ShowNotification('Montant invalide') + else + menu.close() + TriggerServerEvent('esx_society:washMoney', 'mecano', amount) + end + end, + function(data, menu) + menu.close() + end + ) + end + end, + function(data, menu) + menu.close() + CurrentAction = 'mecano_actions_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu.' + CurrentActionData = {} + end + ) +end + +function OpenMecanoHarvestMenu() + + if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then + local elements = { + {label = 'Bouteille de gaz', value = 'gaz_bottle'}, + {label = 'Outils réparation', value = 'fix_tool'}, + {label = 'Outils Carosserie', value = 'caro_tool'} + } + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mecano_harvest', + { + title = 'Récolte', + elements = elements + }, + function(data, menu) + if data.current.value == 'gaz_bottle' then + menu.close() + TriggerServerEvent('esx_mecanojob:startHarvest') + end + + if data.current.value == 'fix_tool' then + menu.close() + TriggerServerEvent('esx_mecanojob:startHarvest2') + end + + if data.current.value == 'caro_tool' then + menu.close() + TriggerServerEvent('esx_mecanojob:startHarvest3') + end + + end, + function(data, menu) + menu.close() + CurrentAction = 'mecano_harvest_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu de récolte.' + CurrentActionData = {} + end + ) + else + ESX.ShowNotification("Vous n'êtes ~r~pas assez expérimenté~s~ pour effectuer cette action.") + end +end + +function OpenMecanoCraftMenu() + if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then + + local elements = { + {label = 'Chalumeaux', value = 'blow_pipe'}, + {label = 'Kit réparation', value = 'fix_kit'}, + {label = 'Outils Carosserie', value = 'caro_kit'} + } + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mecano_craft', + { + title = 'Etabli', + elements = elements + }, + function(data, menu) + if data.current.value == 'blow_pipe' then + menu.close() + TriggerServerEvent('esx_mecanojob:startCraft') + end + + if data.current.value == 'fix_kit' then + menu.close() + TriggerServerEvent('esx_mecanojob:startCraft2') + end + + if data.current.value == 'caro_kit' then + menu.close() + TriggerServerEvent('esx_mecanojob:startCraft3') + end + + end, + function(data, menu) + menu.close() + CurrentAction = 'mecano_craft_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu établi.' + CurrentActionData = {} + end + ) + else + ESX.ShowNotification("Vous n'êtes ~r~pas assez expérimenté~s~ pour effectuer cette action.") + end +end + +function OpenMobileMecanoActionsMenu() + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mobile_mecano_actions', + { + title = 'Mécano', + elements = { + {label = 'Facuration', value = 'billing'}, + {label = 'Crocheter', value = 'hijack_vehicle'}, + {label = 'Réparer', value = 'fix_vehicle'}, + {label = 'Netoyer', value = 'clean_vehicle'}, + {label = 'Fourrière', value = 'del_vehicle'}, + {label = 'Plateau', value = 'dep_vehicle'}, + {label = 'Placer objets', value = 'object_spawner'} + } + }, + function(data, menu) + if data.current.value == 'billing' then + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'billing', + { + title = 'Montant de la facture' + }, + function(data, menu) + local amount = tonumber(data.value) + if amount == nil then + ESX.ShowNotification('Montant invalide') + else + menu.close() + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification('Aucun joueur à proximité') + else + TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mecano', 'Mecano', amount) + end + end + end, + function(data, menu) + menu.close() + end + ) + end + + if data.current.value == 'hijack_vehicle' then + + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + + local vehicle = nil + + 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_WELDING", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(10000) + SetVehicleDoorsLocked(vehicle, 1) + SetVehicleDoorsLockedForAllPlayers(vehicle, false) + ClearPedTasksImmediately(playerPed) + TriggerEvent('esx:showNotification', 'Véhicule ~g~déverouillé') + end) + end + + end + + end + + if data.current.value == 'fix_vehicle' then + + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + + local vehicle = nil + + 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, "PROP_HUMAN_BUM_BIN", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(20000) + SetVehicleFixed(vehicle) + SetVehicleDeformationFixed(vehicle) + SetVehicleUndriveable(vehicle, false) + ClearPedTasksImmediately(playerPed) + TriggerEvent('esx:showNotification', 'Véhicule ~g~réparé') + end) + end + end + end + + if data.current.value == 'clean_vehicle' then + + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + + local vehicle = nil + + 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) + TriggerEvent('esx:showNotification', 'Véhicule ~g~néttoyé') + end) + end + end + end + + if data.current.value == 'del_vehicle' then + + local ped = GetPlayerPed( -1 ) + + if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then + local pos = GetEntityCoords( ped ) + + if ( IsPedSittingInAnyVehicle( ped ) ) then + local vehicle = GetVehiclePedIsIn( ped, false ) + + if ( GetPedInVehicleSeat( vehicle, -1 ) == ped ) then + TriggerEvent('esx:showNotification', 'Vehicule ~r~mis en fourrière') + SetEntityAsMissionEntity( vehicle, true, true ) + deleteCar( vehicle ) + else + TriggerEvent('esx:showNotification', 'Vous devez être assis du ~r~côté conducteur!') + end + else + local playerPos = GetEntityCoords( ped, 1 ) + local inFrontOfPlayer = GetOffsetFromEntityInWorldCoords( ped, 0.0, distanceToCheck, 0.0 ) + local vehicle = GetVehicleInDirection( playerPos, inFrontOfPlayer ) + + if ( DoesEntityExist( vehicle ) ) then + TriggerEvent('esx:showNotification', 'Vehicule ~r~mis en fourrière') + SetEntityAsMissionEntity( vehicle, true, true ) + deleteCar( vehicle ) + else + TriggerEvent('esx:showNotification', 'Vous devez être ~r~près d\'un véhicule~s~ pour le mettre en fourrière') + end + end + end + end + + if data.current.value == 'dep_vehicle' then + + local playerped = GetPlayerPed(-1) + local vehicle = GetVehiclePedIsIn(playerped, true) + + local towmodel = GetHashKey('flatbed') + local isVehicleTow = IsVehicleModel(vehicle, towmodel) + + if isVehicleTow then + + local coordA = GetEntityCoords(playerped, 1) + local coordB = GetOffsetFromEntityInWorldCoords(playerped, 0.0, 5.0, 0.0) + local targetVehicle = getVehicleInDirection(coordA, coordB) + + if currentlyTowedVehicle == nil then + if targetVehicle ~= 0 then + if not IsPedInAnyVehicle(playerped, true) then + if vehicle ~= targetVehicle then + AttachEntityToEntity(targetVehicle, vehicle, 20, -0.5, -5.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) + currentlyTowedVehicle = targetVehicle + TriggerEvent('esx:showNotification', 'Vehicule ~b~attaché~s~ avec succès!') + else + TriggerEvent('esx:showNotification', '~r~Impossible~s~ d\'attacher votre propre dépanneuse') + end + end + else + TriggerEvent('esx:showNotification', 'Il n\'y a ~r~pas de véhicule~s~ à attacher') + end + else + AttachEntityToEntity(currentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) + DetachEntity(currentlyTowedVehicle, true, true) + currentlyTowedVehicle = nil + TriggerEvent('esx:showNotification', 'Vehicule ~b~détattaché~s~ avec succès!') + end + else + TriggerEvent('esx:showNotification', '~r~Impossible! ~s~Vous devez avoir un ~b~Flatbed ~s~pour ça') + end + end + + if data.current.value == 'object_spawner' then + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mobile_mecano_actions_spawn', + { + title = 'Objets', + align = 'top-left', + elements = { + {label = 'Plot', value = 'prop_roadcone02a'}, + {label = 'Boîte à outils', value = 'prop_toolchest_01'}, + }, + }, + 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) + + if model == 'prop_roadcone02a' then + z = z - 2.0 + elseif model == 'prop_toolchest_01' then + z = z - 3.0 + end + + ESX.Game.SpawnObject(model, { + x = x, + y = y, + z = z + }, 3.0, function(obj) + SetEntityHeading(obj, GetEntityHeading(playerPed)) + PlaceObjectOnGroundProperly(obj) + end) + + end, + function(data2, menu2) + menu2.close() + end + ) + + end + + end, + function(data, menu) + menu.close() + end + ) +end + +RegisterNetEvent('esx_mecanojob:onHijack') +AddEventHandler('esx_mecanojob:onHijack', function() + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + + local vehicle = nil + + if IsPedInAnyVehicle(playerPed, false) then + vehicle = GetVehiclePedIsIn(playerPed, false) + else + vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) + end + + local crochete = math.random(100) + local alarm = math.random(100) + + if DoesEntityExist(vehicle) then + if alarm <= 33 then + SetVehicleAlarm(vehicle, true) + StartVehicleAlarm(vehicle) + end + TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_WELDING", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(10000) + if crochete <= 66 then + SetVehicleDoorsLocked(vehicle, 1) + SetVehicleDoorsLockedForAllPlayers(vehicle, false) + ClearPedTasksImmediately(playerPed) + TriggerEvent('esx:showNotification', '~g~Véhicule déverouillé') + else + TriggerEvent('esx:showNotification', '~r~Crochetage raté') + ClearPedTasksImmediately(playerPed) + end + end) + end + + end +end) + +RegisterNetEvent('esx_mecanojob:onCarokit') +AddEventHandler('esx_mecanojob:onCarokit', function() + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + + local vehicle = nil + + 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_HAMMERING", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(10000) + SetVehicleFixed(vehicle) + SetVehicleDeformationFixed(vehicle) + ClearPedTasksImmediately(playerPed) + TriggerEvent('esx:showNotification', '~g~Carosserie réparée') + end) + end + end +end) + +RegisterNetEvent('esx_mecanojob:onFixkit') +AddEventHandler('esx_mecanojob:onFixkit', function() + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + + local vehicle = nil + + 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, "PROP_HUMAN_BUM_BIN", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(20000) + SetVehicleFixed(vehicle) + SetVehicleDeformationFixed(vehicle) + SetVehicleUndriveable(vehicle, false) + ClearPedTasksImmediately(playerPed) + TriggerEvent('esx:showNotification', '~g~Véhicule réparé') + end) + end + end +end) + +function setEntityHeadingFromEntity ( vehicle, playerPed ) + local heading = GetEntityHeading(vehicle) + SetEntityHeading( playerPed, heading ) +end + +function getVehicleInDirection(coordFrom, coordTo) + local rayHandle = CastRayPointToPoint(coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 10, GetPlayerPed(-1), 0) + local a, b, c, d, vehicle = GetRaycastResult(rayHandle) + return vehicle +end + +function deleteCar( entity ) + Citizen.InvokeNative( 0xEA386986E786A54F, Citizen.PointerValueIntInitialized( entity ) ) +end + +RegisterNetEvent('esx:playerLoaded') +AddEventHandler('esx:playerLoaded', function(xPlayer) + PlayerData = xPlayer +end) + +RegisterNetEvent('esx:setJob') +AddEventHandler('esx:setJob', function(job) + PlayerData.job = job +end) + +AddEventHandler('esx_mecanojob:hasEnteredMarker', function(zone) + if zone == 'MecanoActions' then + CurrentAction = 'mecano_actions_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu.' + CurrentActionData = {} + end + if zone == 'Garage' then + CurrentAction = 'mecano_harvest_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu de récolte.' + CurrentActionData = {} + end + if zone == 'Craft' then + CurrentAction = 'mecano_craft_menu' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu établi.' + CurrentActionData = {} + end + if zone == 'VehicleDeleter' then + local playerPed = GetPlayerPed(-1) + if IsPedInAnyVehicle(playerPed, false) then + CurrentAction = 'delete_vehicle' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule.' + CurrentActionData = {} + end + end +end) + +AddEventHandler('esx_mecanojob:hasExitedMarker', function(zone) + + if zone == 'Craft' then + TriggerServerEvent('esx_mecanojob:stopCraft') + TriggerServerEvent('esx_mecanojob:stopCraft2') + TriggerServerEvent('esx_mecanojob:stopCraft3') + end + + if zone == 'Garage' then + TriggerServerEvent('esx_mecanojob:stopHarvest') + TriggerServerEvent('esx_mecanojob:stopHarvest2') + TriggerServerEvent('esx_mecanojob:stopHarvest3') + end + + CurrentAction = nil + ESX.UI.Menu.CloseAll() +end) + +AddEventHandler('esx_mecanojob:hasEnteredEntityZone', function(entity) + + local playerPed = GetPlayerPed(-1) + + if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' and not IsPedInAnyVehicle(playerPed, false) then + CurrentAction = 'remove_entity' + CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour enlever l\'objet' + CurrentActionData = {entity = entity} + end + +end) + +AddEventHandler('esx_mecanojob:hasExitedEntityZone', function(entity) + + if CurrentAction == 'remove_entity' then + CurrentAction = nil + end + +end) + +RegisterNetEvent('esx_phone:loaded') +AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) + local specialContact = { + name = 'Mecano', + number = 'mecano', + 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) + +-- Create Blips +Citizen.CreateThread(function() + local blip = AddBlipForCoord(Config.Zones.MecanoActions.Pos.x, Config.Zones.MecanoActions.Pos.y, Config.Zones.MecanoActions.Pos.z) + SetBlipSprite (blip, 446) + SetBlipDisplay(blip, 4) + SetBlipScale (blip, 1.0) + SetBlipColour (blip, 5) + SetBlipAsShortRange(blip, true) + BeginTextCommandSetBlipName("STRING") + AddTextComponentString("Mecano") + EndTextCommandSetBlipName(blip) +end) + +-- Display markers +Citizen.CreateThread(function() + while true do + Wait(0) + if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + + local coords = GetEntityCoords(GetPlayerPed(-1)) + + for k,v in pairs(Config.Zones) do + if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 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, false, true, 2, false, false, false, false) + end + end + end + end +end) + +-- Enter / Exit marker events +Citizen.CreateThread(function() + while true do + Wait(0) + if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + local coords = GetEntityCoords(GetPlayerPed(-1)) + local isInMarker = false + local currentZone = nil + for k,v in pairs(Config.Zones) do + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then + isInMarker = true + currentZone = k + end + end + if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then + HasAlreadyEnteredMarker = true + LastZone = currentZone + TriggerEvent('esx_mecanojob:hasEnteredMarker', currentZone) + end + if not isInMarker and HasAlreadyEnteredMarker then + HasAlreadyEnteredMarker = false + TriggerEvent('esx_mecanojob:hasExitedMarker', LastZone) + end + end + end +end) + +Citizen.CreateThread(function() + while true do + + Citizen.Wait(0) + + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + + local entity, distance = ESX.Game.GetClosestObject({ + 'prop_roadcone02a', + 'prop_toolchest_01' + }) + + if distance ~= -1 and distance <= 3.0 then + + if LastEntity ~= entity then + TriggerEvent('esx_mecanojob:hasEnteredEntityZone', entity) + LastEntity = entity + end + + else + + if LastEntity ~= nil then + TriggerEvent('esx_mecanojob:hasExitedEntityZone', LastEntity) + LastEntity = nil + end + + end + + end +end) + + +-- Key Controls +Citizen.CreateThread(function() + while true do + Citizen.Wait(0) + if CurrentAction ~= nil then + SetTextComponentFormat('STRING') + AddTextComponentString(CurrentActionMsg) + DisplayHelpTextFromStringLabel(0, 0, 1, -1) + if IsControlJustReleased(0, 38) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + if CurrentAction == 'mecano_actions_menu' then + OpenMecanoActionsMenu() + end + if CurrentAction == 'mecano_harvest_menu' then + OpenMecanoHarvestMenu() + end + if CurrentAction == 'mecano_craft_menu' then + OpenMecanoCraftMenu() + end + if CurrentAction == 'delete_vehicle' then + local playerPed = GetPlayerPed(-1) + local vehicle = GetVehiclePedIsIn(playerPed, false) + local hash = GetEntityModel(vehicle) + if hash == GetHashKey('flatbed') or hash == GetHashKey('towtruck2') or hash == GetHashKey('slamvan3') then + if Config.MaxInService ~= -1 then + TriggerServerEvent('esx_service:disableService', 'mecano') + end + DeleteVehicle(vehicle) + else + ESX.ShowNotification('Vous ne pouvez ranger que des ~b~véhicules de Mécano~s~.') + end + end + if CurrentAction == 'remove_entity' then + DeleteEntity(CurrentActionData.entity) + end + CurrentAction = nil + end + end + + if IsControlJustReleased(0, 167) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + OpenMobileMecanoActionsMenu() + end + end end) \ No newline at end of file diff --git a/esx_mecanojob/config.lua b/config.lua similarity index 96% rename from esx_mecanojob/config.lua rename to config.lua index b413d582..ffb65d2b 100644 --- a/esx_mecanojob/config.lua +++ b/config.lua @@ -1,42 +1,42 @@ -Config = {} -Config.DrawDistance = 100.0 -Config.MaxInService = -1 -Config.EnablePlayerManagement = true - -Config.Zones = { - - MecanoActions = { - Pos = {x = -205.90548706055, y = -1327.7248535156, z = 29.89040184021}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Color = {r = 204, g = 204, b = 0}, - Type = 1 - }, - - Garage = { - Pos = {x = -97.5797576904297, y = 6496.11376953125, z = 30.4909038543701}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Color = {r = 204, g = 204, b = 0}, - Type = 1 - }, - - Craft = { - Pos = {x = -196.51593017578, y = -1318.4403076172, z = 30.089345932007}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Color = {r = 204, g = 204, b = 0}, - Type = 1 - }, - - VehicleSpawnPoint = { - Pos = {x = -157.7899017334, y = -1305.8979492188, z = 30.348382949829}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Type = -1 - }, - - VehicleDeleter = { - Pos = {x = -182.78112792969, y = -1330.5368652344, z = 30.194892883301}, - Size = {x = 3.0, y = 3.0, z = 1.0}, - Color = {r = 204, g = 204, b = 0}, - Type = 1 - } - -} +Config = {} +Config.DrawDistance = 100.0 +Config.MaxInService = -1 +Config.EnablePlayerManagement = true + +Config.Zones = { + + MecanoActions = { + Pos = {x = -205.90548706055, y = -1327.7248535156, z = 29.89040184021}, + Size = {x = 1.5, y = 1.5, z = 1.0}, + Color = {r = 204, g = 204, b = 0}, + Type = 1 + }, + + Garage = { + Pos = {x = -97.5797576904297, y = 6496.11376953125, z = 30.4909038543701}, + Size = {x = 1.5, y = 1.5, z = 1.0}, + Color = {r = 204, g = 204, b = 0}, + Type = 1 + }, + + Craft = { + Pos = {x = -196.51593017578, y = -1318.4403076172, z = 30.089345932007}, + Size = {x = 1.5, y = 1.5, z = 1.0}, + Color = {r = 204, g = 204, b = 0}, + Type = 1 + }, + + VehicleSpawnPoint = { + Pos = {x = -157.7899017334, y = -1305.8979492188, z = 30.348382949829}, + Size = {x = 1.5, y = 1.5, z = 1.0}, + Type = -1 + }, + + VehicleDeleter = { + Pos = {x = -182.78112792969, y = -1330.5368652344, z = 30.194892883301}, + Size = {x = 3.0, y = 3.0, z = 1.0}, + Color = {r = 204, g = 204, b = 0}, + Type = 1 + } + +} diff --git a/esx_mecanojob/server/main.lua b/server/main.lua similarity index 96% rename from esx_mecanojob/server/main.lua rename to server/main.lua index fb6a325a..522ae568 100644 --- a/esx_mecanojob/server/main.lua +++ b/server/main.lua @@ -1,268 +1,268 @@ -ESX = nil -PlayersHarvesting = {} -PlayersHarvesting2 = {} -PlayersHarvesting3 = {} -PlayersCrafting = {} -PlayersCrafting2 = {} -PlayersCrafting3 = {} - -TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - -if Config.MaxInService ~= -1 then - TriggerEvent('esx_service:activateService', 'mecano', Config.MaxInService) -end - -TriggerEvent('esx_phone:registerCallback', function(source, phoneNumber, message, anon) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local xPlayers = ESX.GetPlayers() - - if phoneNumber == 'mecano' then - for k, v in pairs(xPlayers) do - if v.job.name == 'mecano' then - TriggerClientEvent('esx_phone:onMessage', v.source, xPlayer.get('phoneNumber'), message, xPlayer.get('coords'), anon, 'Appel Mécano') - end - end - end -end) --------------- Récupération bouteille de gaz ------------- ----- Sqlut je teste ------ -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, '~r~Vous n\'avez plus de place') - else - xPlayer.addInventoryItem('gazbottle', 1) - - Harvest(source) - end - end - end) -end - -RegisterServerEvent('esx_mecanojob:startHarvest') -AddEventHandler('esx_mecanojob:startHarvest', function() - local _source = source - PlayersHarvesting[_source] = true - TriggerClientEvent('esx:showNotification', _source, 'Récupération de ~b~bouteille de gaz~s~...') - Harvest(source) -end) - -RegisterServerEvent('esx_mecanojob:stopHarvest') -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() - - if PlayersHarvesting2[source] == true then - - local xPlayer = ESX.GetPlayerFromId(source) - local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count - if FixToolQuantity >= 5 then - TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez ~r~plus de place') - else - xPlayer.addInventoryItem('fixtool', 1) - - Harvest2(source) - end - end - end) -end - -RegisterServerEvent('esx_mecanojob:startHarvest2') -AddEventHandler('esx_mecanojob:startHarvest2', function() - local _source = source - PlayersHarvesting2[_source] = true - TriggerClientEvent('esx:showNotification', _source, 'Récupération d\'~b~Outils réparation~s~...') - Harvest2(_source) -end) - -RegisterServerEvent('esx_mecanojob:stopHarvest2') -AddEventHandler('esx_mecanojob:stopHarvest2', function() - local _source = source - PlayersHarvesting2[_source] = false -end) ------------------ Récupération Outils Carosserie ---------------- -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, 'Vous n\'avez ~r~plus de place') - else - xPlayer.addInventoryItem('carotool', 1) - - Harvest3(source) - end - end - end) -end - -RegisterServerEvent('esx_mecanojob:startHarvest3') -AddEventHandler('esx_mecanojob:startHarvest3', function() - local _source = source - PlayersHarvesting3[_source] = true - TriggerClientEvent('esx:showNotification', _source, 'Récupération d\'~b~Outils carosserie~s~...') - Harvest3(_source) -end) - -RegisterServerEvent('esx_mecanojob:stopHarvest3') -AddEventHandler('esx_mecanojob:stopHarvest3', function() - local _source = source - PlayersHarvesting3[_source] = false -end) ------------- Craft Chalumeau ------------------- -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, 'Vous n\'avez ~r~pas assez~s~ de bouteille de gaz') - else - xPlayer.removeInventoryItem('gazbottle', 1) - xPlayer.addInventoryItem('blowpipe', 1) - - Craft(source) - end - end - end) -end - -RegisterServerEvent('esx_mecanojob:startCraft') -AddEventHandler('esx_mecanojob:startCraft', function() - local _source = source - PlayersCrafting[_source] = true - TriggerClientEvent('esx:showNotification', _source, 'Assemblage de ~b~Chalumeaux~s~...') - Craft(_source) -end) - -RegisterServerEvent('esx_mecanojob:stopCraft') -AddEventHandler('esx_mecanojob:stopCraft', function() - local _source = source - PlayersCrafting[_source] = false -end) ------------- Craft kit Réparation -------------- -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, 'Vous n\'avez ~r~pas assez~s~ d\'outils réparation') - else - xPlayer.removeInventoryItem('fixtool', 1) - xPlayer.addInventoryItem('fixkit', 1) - - Craft2(source) - end - end - end) -end - -RegisterServerEvent('esx_mecanojob:startCraft2') -AddEventHandler('esx_mecanojob:startCraft2', function() - local _source = source - PlayersCrafting2[_source] = true - TriggerClientEvent('esx:showNotification', _source, 'Assemblage de ~b~Kit réparation~s~...') - Craft2(_source) -end) - -RegisterServerEvent('esx_mecanojob:stopCraft2') -AddEventHandler('esx_mecanojob:stopCraft2', function() - local _source = source - PlayersCrafting2[_source] = false -end) ------------------ Craft kit Carosserie ---------------- -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, 'Vous n\'avez ~r~pas assez~s~ d\'outils carosserie') - else - xPlayer.removeInventoryItem('carotool', 1) - xPlayer.addInventoryItem('carokit', 1) - - Craft3(source) - end - end - end) -end - -RegisterServerEvent('esx_mecanojob:startCraft3') -AddEventHandler('esx_mecanojob:startCraft3', function() - local _source = source - PlayersCrafting3[_source] = true - TriggerClientEvent('esx:showNotification', _source, 'Assemblage de ~b~kit carosserie~s~...') - Craft3(_source) -end) - -RegisterServerEvent('esx_mecanojob:stopCraft3') -AddEventHandler('esx_mecanojob:stopCraft3', function() - local _source = source - PlayersCrafting3[_source] = false -end) - ----------------------------- register usable item -------------------------------------------------- -ESX.RegisterUsableItem('blowpipe', function(source) - - local _source = source - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.removeInventoryItem('blowpipe', 1) - - TriggerClientEvent('esx_mecanojob:onHijack', _source) - TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé un ~b~Chalumeau') - -end) - -ESX.RegisterUsableItem('fixkit', function(source) - - local _source = source - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.removeInventoryItem('fixkit', 1) - - TriggerClientEvent('esx_mecanojob:onFixkit', _source) - TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé un ~b~Kit de réparation') - -end) - -ESX.RegisterUsableItem('carokit', function(source) - - local _source = source - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.removeInventoryItem('carokit', 1) - - TriggerClientEvent('esx_mecanojob:onCarokit', _source) - TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé un ~b~Kit de carosserie') - +ESX = nil +PlayersHarvesting = {} +PlayersHarvesting2 = {} +PlayersHarvesting3 = {} +PlayersCrafting = {} +PlayersCrafting2 = {} +PlayersCrafting3 = {} + +TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + +if Config.MaxInService ~= -1 then + TriggerEvent('esx_service:activateService', 'mecano', Config.MaxInService) +end + +TriggerEvent('esx_phone:registerCallback', function(source, phoneNumber, message, anon) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayers = ESX.GetPlayers() + + if phoneNumber == 'mecano' then + for k, v in pairs(xPlayers) do + if v.job.name == 'mecano' then + TriggerClientEvent('esx_phone:onMessage', v.source, xPlayer.get('phoneNumber'), message, xPlayer.get('coords'), anon, 'Appel Mécano') + end + end + end +end) +-------------- Récupération bouteille de gaz ------------- +---- Sqlut je teste ------ +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, '~r~Vous n\'avez plus de place') + else + xPlayer.addInventoryItem('gazbottle', 1) + + Harvest(source) + end + end + end) +end + +RegisterServerEvent('esx_mecanojob:startHarvest') +AddEventHandler('esx_mecanojob:startHarvest', function() + local _source = source + PlayersHarvesting[_source] = true + TriggerClientEvent('esx:showNotification', _source, 'Récupération de ~b~bouteille de gaz~s~...') + Harvest(source) +end) + +RegisterServerEvent('esx_mecanojob:stopHarvest') +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() + + if PlayersHarvesting2[source] == true then + + local xPlayer = ESX.GetPlayerFromId(source) + local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count + if FixToolQuantity >= 5 then + TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez ~r~plus de place') + else + xPlayer.addInventoryItem('fixtool', 1) + + Harvest2(source) + end + end + end) +end + +RegisterServerEvent('esx_mecanojob:startHarvest2') +AddEventHandler('esx_mecanojob:startHarvest2', function() + local _source = source + PlayersHarvesting2[_source] = true + TriggerClientEvent('esx:showNotification', _source, 'Récupération d\'~b~Outils réparation~s~...') + Harvest2(_source) +end) + +RegisterServerEvent('esx_mecanojob:stopHarvest2') +AddEventHandler('esx_mecanojob:stopHarvest2', function() + local _source = source + PlayersHarvesting2[_source] = false +end) +----------------- Récupération Outils Carosserie ---------------- +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, 'Vous n\'avez ~r~plus de place') + else + xPlayer.addInventoryItem('carotool', 1) + + Harvest3(source) + end + end + end) +end + +RegisterServerEvent('esx_mecanojob:startHarvest3') +AddEventHandler('esx_mecanojob:startHarvest3', function() + local _source = source + PlayersHarvesting3[_source] = true + TriggerClientEvent('esx:showNotification', _source, 'Récupération d\'~b~Outils carosserie~s~...') + Harvest3(_source) +end) + +RegisterServerEvent('esx_mecanojob:stopHarvest3') +AddEventHandler('esx_mecanojob:stopHarvest3', function() + local _source = source + PlayersHarvesting3[_source] = false +end) +------------ Craft Chalumeau ------------------- +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, 'Vous n\'avez ~r~pas assez~s~ de bouteille de gaz') + else + xPlayer.removeInventoryItem('gazbottle', 1) + xPlayer.addInventoryItem('blowpipe', 1) + + Craft(source) + end + end + end) +end + +RegisterServerEvent('esx_mecanojob:startCraft') +AddEventHandler('esx_mecanojob:startCraft', function() + local _source = source + PlayersCrafting[_source] = true + TriggerClientEvent('esx:showNotification', _source, 'Assemblage de ~b~Chalumeaux~s~...') + Craft(_source) +end) + +RegisterServerEvent('esx_mecanojob:stopCraft') +AddEventHandler('esx_mecanojob:stopCraft', function() + local _source = source + PlayersCrafting[_source] = false +end) +------------ Craft kit Réparation -------------- +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, 'Vous n\'avez ~r~pas assez~s~ d\'outils réparation') + else + xPlayer.removeInventoryItem('fixtool', 1) + xPlayer.addInventoryItem('fixkit', 1) + + Craft2(source) + end + end + end) +end + +RegisterServerEvent('esx_mecanojob:startCraft2') +AddEventHandler('esx_mecanojob:startCraft2', function() + local _source = source + PlayersCrafting2[_source] = true + TriggerClientEvent('esx:showNotification', _source, 'Assemblage de ~b~Kit réparation~s~...') + Craft2(_source) +end) + +RegisterServerEvent('esx_mecanojob:stopCraft2') +AddEventHandler('esx_mecanojob:stopCraft2', function() + local _source = source + PlayersCrafting2[_source] = false +end) +----------------- Craft kit Carosserie ---------------- +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, 'Vous n\'avez ~r~pas assez~s~ d\'outils carosserie') + else + xPlayer.removeInventoryItem('carotool', 1) + xPlayer.addInventoryItem('carokit', 1) + + Craft3(source) + end + end + end) +end + +RegisterServerEvent('esx_mecanojob:startCraft3') +AddEventHandler('esx_mecanojob:startCraft3', function() + local _source = source + PlayersCrafting3[_source] = true + TriggerClientEvent('esx:showNotification', _source, 'Assemblage de ~b~kit carosserie~s~...') + Craft3(_source) +end) + +RegisterServerEvent('esx_mecanojob:stopCraft3') +AddEventHandler('esx_mecanojob:stopCraft3', function() + local _source = source + PlayersCrafting3[_source] = false +end) + +---------------------------- register usable item -------------------------------------------------- +ESX.RegisterUsableItem('blowpipe', function(source) + + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) + + xPlayer.removeInventoryItem('blowpipe', 1) + + TriggerClientEvent('esx_mecanojob:onHijack', _source) + TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé un ~b~Chalumeau') + +end) + +ESX.RegisterUsableItem('fixkit', function(source) + + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) + + xPlayer.removeInventoryItem('fixkit', 1) + + TriggerClientEvent('esx_mecanojob:onFixkit', _source) + TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé un ~b~Kit de réparation') + +end) + +ESX.RegisterUsableItem('carokit', function(source) + + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) + + xPlayer.removeInventoryItem('carokit', 1) + + TriggerClientEvent('esx_mecanojob:onCarokit', _source) + TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé un ~b~Kit de carosserie') + end) \ No newline at end of file From 0f31acb47887be54c026c47cccbae601e1e169f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sat, 19 Aug 2017 18:03:45 +0200 Subject: [PATCH 06/66] Fix SpawnOBject arguments --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index a96d1225..000797c4 100644 --- a/client/main.lua +++ b/client/main.lua @@ -511,7 +511,7 @@ function OpenMobileMecanoActionsMenu() x = x, y = y, z = z - }, 3.0, function(obj) + }, function(obj) SetEntityHeading(obj, GetEntityHeading(playerPed)) PlaceObjectOnGroundProperly(obj) end) From 8e91b303c1d326d30b7027e4ba7517c80c51d5f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Mon, 21 Aug 2017 21:01:39 +0200 Subject: [PATCH 07/66] Update GetPlayers --- server/main.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/main.lua b/server/main.lua index 522ae568..3edee613 100644 --- a/server/main.lua +++ b/server/main.lua @@ -18,9 +18,12 @@ TriggerEvent('esx_phone:registerCallback', function(source, phoneNumber, message local xPlayers = ESX.GetPlayers() if phoneNumber == 'mecano' then - for k, v in pairs(xPlayers) do - if v.job.name == 'mecano' then - TriggerClientEvent('esx_phone:onMessage', v.source, xPlayer.get('phoneNumber'), message, xPlayer.get('coords'), anon, 'Appel Mécano') + for i=1, #xPlayers, 1 do + + local xPlayer2 = ESX.GetPlayerFromId(xPlayers[i]) + + if xPlayer2.job.name == 'mecano' then + TriggerClientEvent('esx_phone:onMessage', xPlayer2.source, xPlayer.get('phoneNumber'), message, xPlayer.get('coords'), anon, 'Appel Mécano') end end end From caf09a649af7687ec4d6cb028e08325af62eeaea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 24 Aug 2017 12:40:07 +0200 Subject: [PATCH 08/66] Add missing manifest version - Fix spawn objects --- __resource.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/__resource.lua b/__resource.lua index 734f0377..403d0d09 100644 --- a/__resource.lua +++ b/__resource.lua @@ -1,3 +1,5 @@ +resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' + description 'ESX Mecano Job' client_scripts { From 70a48ffe0b72bbb7828380d27fc9c3872f7dd7cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 24 Aug 2017 12:50:14 +0200 Subject: [PATCH 09/66] Fix prop_toolchest_01 z pos --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index 000797c4..7a7c1809 100644 --- a/client/main.lua +++ b/client/main.lua @@ -504,7 +504,7 @@ function OpenMobileMecanoActionsMenu() if model == 'prop_roadcone02a' then z = z - 2.0 elseif model == 'prop_toolchest_01' then - z = z - 3.0 + z = z - 2.0 end ESX.Game.SpawnObject(model, { From 425acbf1b9a8e591b548ad954c0c940526a00aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sat, 26 Aug 2017 09:24:32 +0200 Subject: [PATCH 10/66] Fix typo --- client/main.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/main.lua b/client/main.lua index 7a7c1809..527178c1 100644 --- a/client/main.lua +++ b/client/main.lua @@ -286,12 +286,12 @@ function OpenMobileMecanoActionsMenu() { title = 'Mécano', elements = { - {label = 'Facuration', value = 'billing'}, - {label = 'Crocheter', value = 'hijack_vehicle'}, - {label = 'Réparer', value = 'fix_vehicle'}, - {label = 'Netoyer', value = 'clean_vehicle'}, - {label = 'Fourrière', value = 'del_vehicle'}, - {label = 'Plateau', value = 'dep_vehicle'}, + {label = 'Facuration', value = 'billing'}, + {label = 'Crocheter', value = 'hijack_vehicle'}, + {label = 'Réparer', value = 'fix_vehicle'}, + {label = 'Nettoyer', value = 'clean_vehicle'}, + {label = 'Fourrière', value = 'del_vehicle'}, + {label = 'Plateau', value = 'dep_vehicle'}, {label = 'Placer objets', value = 'object_spawner'} } }, @@ -374,6 +374,7 @@ function OpenMobileMecanoActionsMenu() SetVehicleFixed(vehicle) SetVehicleDeformationFixed(vehicle) SetVehicleUndriveable(vehicle, false) + SetVehicleEngineOn(vehicle, true, true) ClearPedTasksImmediately(playerPed) TriggerEvent('esx:showNotification', 'Véhicule ~g~réparé') end) From dcfe4f62366ddad7c3a74a841db358d244783630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sat, 26 Aug 2017 18:36:49 +0200 Subject: [PATCH 11/66] Add NPC jobs --- client/main.lua | 253 +++++++++++++++++++++++++++++++++++++++++------- config.lua | 82 +++++++++++++++- server/main.lua | 21 ++++ 3 files changed, 318 insertions(+), 38 deletions(-) diff --git a/client/main.lua b/client/main.lua index 527178c1..2fa62033 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,14 +1,34 @@ -ESX = nil -local PlayerData = {} -local GUI = {} -GUI.Time = 0 -local HasAlreadyEnteredMarker = false -local LastZone = nil -local CurrentAction = nil -local CurrentActionMsg = '' -local CurrentActionData = {} -local OnJob = false -local TargetCoords = nil +local Keys = { + ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, + ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, + ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18, + ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182, + ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81, + ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, + ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178, + ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173, + ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 +} + +ESX = nil +local PlayerData = {} +local GUI = {} +GUI.Time = 0 +local HasAlreadyEnteredMarker = false +local LastZone = nil +local CurrentAction = nil +local CurrentActionMsg = '' +local CurrentActionData = {} +local OnJob = false +local TargetCoords = nil +local CurrentlyTowedVehicle = nil +local Blips = {} +local NPCOnJob = false +local NPCTargetTowable = nil +local NPCTargetTowableZone = nil +local NPCHasSpawnedTowable = false +local NPCLastCancel = GetGameTimer() - 5 * 60000 +local NPCHasBeenNextToTowable = false Citizen.CreateThread(function() while ESX == nil do @@ -17,6 +37,60 @@ Citizen.CreateThread(function() end end) +function SelectRandomTowable() + + local index = GetRandomIntInRange(1, #Config.Towables) + + for k,v in pairs(Config.Zones) do + if v.Pos.x == Config.Towables[index].x and v.Pos.y == Config.Towables[index].y and v.Pos.z == Config.Towables[index].z then + return k + end + end + +end + +function StartNPCJob() + + NPCOnJob = true + + NPCTargetTowableZone = SelectRandomTowable() + local zone = Config.Zones[NPCTargetTowableZone] + + Blips['NPCTargetTowableZone'] = AddBlipForCoord(zone.Pos.x, zone.Pos.y, zone.Pos.z) + SetBlipRoute(Blips['NPCTargetTowableZone'], true) + + ESX.ShowNotification('~y~Conduisez~s~ jusqu\'à l\'endroit indiqué') +end + +function StopNPCJob(cancel) + + if Blips['NPCTargetTowableZone'] ~= nil then + RemoveBlip(Blips['NPCTargetTowableZone']) + Blips['NPCTargetTowableZone'] = nil + end + + if Blips['NPCDelivery'] ~= nil then + RemoveBlip(Blips['NPCDelivery']) + Blips['NPCDelivery'] = nil + end + + + Config.Zones.VehicleDelivery.Type = -1 + + NPCOnJob = false + NPCTargetTowable = nil + NPCTargetTowableZone = nil + NPCHasSpawnedTowable = false + NPCHasBeenNextToTowable = false + + if cancel then + ESX.ShowNotification('Mission ~r~annulée~s~') + else + TriggerServerEvent('esx_mecanojob:onNPCJobCompleted') + end + +end + function OpenMecanoActionsMenu() local elements = { @@ -344,7 +418,7 @@ function OpenMobileMecanoActionsMenu() SetVehicleDoorsLocked(vehicle, 1) SetVehicleDoorsLockedForAllPlayers(vehicle, false) ClearPedTasksImmediately(playerPed) - TriggerEvent('esx:showNotification', 'Véhicule ~g~déverouillé') + ESX.ShowNotification('Véhicule ~g~déverouillé') end) end @@ -376,7 +450,7 @@ function OpenMobileMecanoActionsMenu() SetVehicleUndriveable(vehicle, false) SetVehicleEngineOn(vehicle, true, true) ClearPedTasksImmediately(playerPed) - TriggerEvent('esx:showNotification', 'Véhicule ~g~réparé') + ESX.ShowNotification('Véhicule ~g~réparé') end) end end @@ -403,7 +477,7 @@ function OpenMobileMecanoActionsMenu() Citizen.Wait(10000) SetVehicleDirtLevel(vehicle, 0) ClearPedTasksImmediately(playerPed) - TriggerEvent('esx:showNotification', 'Véhicule ~g~néttoyé') + ESX.ShowNotification('Véhicule ~g~néttoyé') end) end end @@ -420,11 +494,11 @@ function OpenMobileMecanoActionsMenu() local vehicle = GetVehiclePedIsIn( ped, false ) if ( GetPedInVehicleSeat( vehicle, -1 ) == ped ) then - TriggerEvent('esx:showNotification', 'Vehicule ~r~mis en fourrière') + ESX.ShowNotification('Vehicule ~r~mis en fourrière') SetEntityAsMissionEntity( vehicle, true, true ) deleteCar( vehicle ) else - TriggerEvent('esx:showNotification', 'Vous devez être assis du ~r~côté conducteur!') + ESX.ShowNotification('Vous devez être assis du ~r~côté conducteur!') end else local playerPos = GetEntityCoords( ped, 1 ) @@ -432,11 +506,11 @@ function OpenMobileMecanoActionsMenu() local vehicle = GetVehicleInDirection( playerPos, inFrontOfPlayer ) if ( DoesEntityExist( vehicle ) ) then - TriggerEvent('esx:showNotification', 'Vehicule ~r~mis en fourrière') + ESX.ShowNotification('Vehicule ~r~mis en fourrière') SetEntityAsMissionEntity( vehicle, true, true ) deleteCar( vehicle ) else - TriggerEvent('esx:showNotification', 'Vous devez être ~r~près d\'un véhicule~s~ pour le mettre en fourrière') + ESX.ShowNotification('Vous devez être ~r~près d\'un véhicule~s~ pour le mettre en fourrière') end end end @@ -456,28 +530,65 @@ function OpenMobileMecanoActionsMenu() local coordB = GetOffsetFromEntityInWorldCoords(playerped, 0.0, 5.0, 0.0) local targetVehicle = getVehicleInDirection(coordA, coordB) - if currentlyTowedVehicle == nil then + if CurrentlyTowedVehicle == nil then if targetVehicle ~= 0 then if not IsPedInAnyVehicle(playerped, true) then if vehicle ~= targetVehicle then AttachEntityToEntity(targetVehicle, vehicle, 20, -0.5, -5.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) - currentlyTowedVehicle = targetVehicle - TriggerEvent('esx:showNotification', 'Vehicule ~b~attaché~s~ avec succès!') + CurrentlyTowedVehicle = targetVehicle + ESX.ShowNotification('Vehicule ~b~attaché~s~ avec succès!') + + if NPCOnJob then + + if NPCTargetTowable == targetVehicle then + ESX.ShowNotification('Veuillez déposer le véhicule à la concession') + + Config.Zones.VehicleDelivery.Type = 1 + + if Blips['NPCTargetTowableZone'] ~= nil then + RemoveBlip(Blips['NPCTargetTowableZone']) + Blips['NPCTargetTowableZone'] = nil + end + + Blips['NPCDelivery'] = AddBlipForCoord(Config.Zones.VehicleDelivery.Pos.x, Config.Zones.VehicleDelivery.Pos.y, Config.Zones.VehicleDelivery.Pos.z) + + SetBlipRoute(Blips['NPCDelivery'], true) + + end + + end + else - TriggerEvent('esx:showNotification', '~r~Impossible~s~ d\'attacher votre propre dépanneuse') + ESX.ShowNotification('~r~Impossible~s~ d\'attacher votre propre dépanneuse') end end else - TriggerEvent('esx:showNotification', 'Il n\'y a ~r~pas de véhicule~s~ à attacher') + ESX.ShowNotification('Il n\'y a ~r~pas de véhicule~s~ à attacher') end else - AttachEntityToEntity(currentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) - DetachEntity(currentlyTowedVehicle, true, true) - currentlyTowedVehicle = nil - TriggerEvent('esx:showNotification', 'Vehicule ~b~détattaché~s~ avec succès!') + + AttachEntityToEntity(CurrentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) + DetachEntity(CurrentlyTowedVehicle, true, true) + + if NPCOnJob then + + if CurrentlyTowedVehicle == NPCTargetTowable then + ESX.Game.DeleteVehicle(NPCTargetTowable) + TriggerServerEvent('esx_mecanojob:onNPCJobMissionCompleted') + StopNPCJob() + + else + ESX.ShowNotification('Ce n\'est pas le bon véhicule') + end + + end + + CurrentlyTowedVehicle = nil + + ESX.ShowNotification('Vehicule ~b~détattaché~s~ avec succès!') end else - TriggerEvent('esx:showNotification', '~r~Impossible! ~s~Vous devez avoir un ~b~Flatbed ~s~pour ça') + ESX.ShowNotification('~r~Impossible! ~s~Vous devez avoir un ~b~Flatbed ~s~pour ça') end end @@ -562,9 +673,9 @@ AddEventHandler('esx_mecanojob:onHijack', function() SetVehicleDoorsLocked(vehicle, 1) SetVehicleDoorsLockedForAllPlayers(vehicle, false) ClearPedTasksImmediately(playerPed) - TriggerEvent('esx:showNotification', '~g~Véhicule déverouillé') + ESX.ShowNotification('~g~Véhicule déverouillé') else - TriggerEvent('esx:showNotification', '~r~Crochetage raté') + ESX.ShowNotification('~r~Crochetage raté') ClearPedTasksImmediately(playerPed) end end) @@ -595,7 +706,7 @@ AddEventHandler('esx_mecanojob:onCarokit', function() SetVehicleFixed(vehicle) SetVehicleDeformationFixed(vehicle) ClearPedTasksImmediately(playerPed) - TriggerEvent('esx:showNotification', '~g~Carosserie réparée') + ESX.ShowNotification('~g~Carosserie réparée') end) end end @@ -624,7 +735,7 @@ AddEventHandler('esx_mecanojob:onFixkit', function() SetVehicleDeformationFixed(vehicle) SetVehicleUndriveable(vehicle, false) ClearPedTasksImmediately(playerPed) - TriggerEvent('esx:showNotification', '~g~Véhicule réparé') + ESX.ShowNotification('~g~Véhicule réparé') end) end end @@ -656,21 +767,29 @@ AddEventHandler('esx:setJob', function(job) end) AddEventHandler('esx_mecanojob:hasEnteredMarker', function(zone) + + if zone == NPCJobTargetTowable then + + end + if zone == 'MecanoActions' then CurrentAction = 'mecano_actions_menu' CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu.' CurrentActionData = {} end + if zone == 'Garage' then CurrentAction = 'mecano_harvest_menu' CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu de récolte.' CurrentActionData = {} end + if zone == 'Craft' then CurrentAction = 'mecano_craft_menu' CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu établi.' CurrentActionData = {} end + if zone == 'VehicleDeleter' then local playerPed = GetPlayerPed(-1) if IsPedInAnyVehicle(playerPed, false) then @@ -679,6 +798,7 @@ AddEventHandler('esx_mecanojob:hasEnteredMarker', function(zone) CurrentActionData = {} end end + end) AddEventHandler('esx_mecanojob:hasExitedMarker', function(zone) @@ -729,6 +849,46 @@ AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon) end) +-- Pop NPC mission vehicle when inside area +Citizen.CreateThread(function() + while true do + + Wait(0) + + if NPCTargetTowableZone ~= nil and not NPCHasSpawnedTowable then + + local coords = GetEntityCoords(GetPlayerPed(-1)) + local zone = Config.Zones[NPCTargetTowableZone] + + if GetDistanceBetweenCoords(coords, zone.Pos.x, zone.Pos.y, zone.Pos.z, true) < Config.NPCSpawnDistance then + + local model = Config.Vehicles[GetRandomIntInRange(1, #Config.Vehicles)] + + ESX.Game.SpawnVehicle(model, zone.Pos, 0, function(vehicle) + NPCTargetTowable = vehicle + end) + + NPCHasSpawnedTowable = true + + end + + end + + if NPCTargetTowableZone ~= nil and NPCHasSpawnedTowable and not NPCHasBeenNextToTowable then + + local coords = GetEntityCoords(GetPlayerPed(-1)) + local zone = Config.Zones[NPCTargetTowableZone] + + if(GetDistanceBetweenCoords(coords, zone.Pos.x, zone.Pos.y, zone.Pos.z, true) < Config.NPCNextToDistance) then + ESX.ShowNotification('Veuillez ~y~remorquer~s~ le véhicule') + NPCHasBeenNextToTowable = true + end + + end + + end +end) + -- Create Blips Citizen.CreateThread(function() local blip = AddBlipForCoord(Config.Zones.MecanoActions.Pos.x, Config.Zones.MecanoActions.Pos.y, Config.Zones.MecanoActions.Pos.z) @@ -823,6 +983,7 @@ end) Citizen.CreateThread(function() while true do Citizen.Wait(0) + if CurrentAction ~= nil then SetTextComponentFormat('STRING') AddTextComponentString(CurrentActionMsg) @@ -857,8 +1018,34 @@ Citizen.CreateThread(function() end end - if IsControlJustReleased(0, 167) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + if IsControlJustReleased(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then OpenMobileMecanoActionsMenu() end + + if IsControlJustReleased(0, Keys['DELETE']) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + + if NPCOnJob then + + if GetGameTimer() - NPCLastCancel > 5 * 60000 then + StopNPCJob(true) + -- NPCLastCancel = GetGameTimer() + else + ESX.ShowNotification('Vous devez ~r~attendre~s~ 5 minutes') + end + + else + + local playerPed = GetPlayerPed(-1) + + if IsPedInAnyVehicle(playerPed, false) and IsVehicleModel(GetVehiclePedIsIn(playerPed, false), GetHashKey("flatbed")) then + StartNPCJob() + else + ESX.ShowNotification('Vous devez être en flatbed pour commencer la mission') + end + + end + + end + end end) \ No newline at end of file diff --git a/config.lua b/config.lua index ffb65d2b..96d25931 100644 --- a/config.lua +++ b/config.lua @@ -2,11 +2,14 @@ Config = {} Config.DrawDistance = 100.0 Config.MaxInService = -1 Config.EnablePlayerManagement = true +Config.NPCSpawnDistance = 500.0 +Config.NPCNextToDistance = 25.0 +Config.NPCJobEarnings = {min = 15, max = 40} Config.Zones = { MecanoActions = { - Pos = {x = -205.90548706055, y = -1327.7248535156, z = 29.89040184021}, + Pos = {x = -347.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 @@ -20,23 +23,92 @@ Config.Zones = { }, Craft = { - Pos = {x = -196.51593017578, y = -1318.4403076172, z = 30.089345932007}, + Pos = {x = -323.140, y = -129.882, z = 37.999}, Size = {x = 1.5, y = 1.5, z = 1.0}, Color = {r = 204, g = 204, b = 0}, Type = 1 }, VehicleSpawnPoint = { - Pos = {x = -157.7899017334, y = -1305.8979492188, z = 30.348382949829}, + Pos = {x = -366.354, y = -110.766, z = 37.696}, Size = {x = 1.5, y = 1.5, z = 1.0}, Type = -1 }, VehicleDeleter = { - Pos = {x = -182.78112792969, y = -1330.5368652344, z = 30.194892883301}, + Pos = {x = -386.899, y = -105.675, z = 37.683}, Size = {x = 3.0, y = 3.0, z = 1.0}, Color = {r = 204, g = 204, b = 0}, Type = 1 - } + }, + + VehicleDelivery = { + Pos = {x = -382.925, y = -133.748, z = 37.685}, + Size = {x = 20.0, y = 20.0, z = 3.0}, + Color = {r = 204, g = 204, b = 0}, + Type = -1 + }, } + +Config.Towables = { + { ['x'] = -2480.8720703125, ['y'] = -211.96409606934, ['z'] = 17.397672653198 }, + { ['x'] = -2723.392578125, ['y'] = 13.207388877869, ['z'] = 15.12806892395 }, + { ['x'] = -3169.6235351563, ['y'] = 976.18127441406, ['z'] = 15.038360595703 }, + { ['x'] = -3139.7568359375, ['y'] = 1078.7182617188, ['z'] = 20.189767837524 }, + { ['x'] = -1656.9357910156, ['y'] = -246.16479492188, ['z'] = 54.510955810547 }, + { ['x'] = -1586.6560058594, ['y'] = -647.56115722656, ['z'] = 29.441320419312 }, + { ['x'] = -1036.1470947266, ['y'] = -491.05856323242, ['z'] = 36.214912414551 }, + { ['x'] = -1029.1884765625, ['y'] = -475.53167724609, ['z'] = 36.416831970215 }, + { ['x'] = 75.212287902832, ['y'] = 164.8522644043, ['z'] = 104.69123077393 }, + { ['x'] = -534.60491943359, ['y'] = -756.71801757813, ['z'] = 31.599143981934 }, + { ['x'] = 487.24212646484, ['y'] = -30.827201843262, ['z'] = 88.856712341309 }, + { ['x'] = -772.20111083984, ['y'] = -1281.8114013672, ['z'] = 4.5642876625061 }, + { ['x'] = -663.84173583984, ['y'] = -1206.9936523438, ['z'] = 10.171216011047 }, + { ['x'] = 719.12451171875, ['y'] = -767.77545166016, ['z'] = 24.892364501953 }, + { ['x'] = -970.95465087891, ['y'] = -2410.4453125, ['z'] = 13.344270706177 }, + { ['x'] = -1067.5234375, ['y'] = -2571.4064941406, ['z'] = 13.211874008179 }, + { ['x'] = -619.23968505859, ['y'] = -2207.2927246094, ['z'] = 5.5659561157227 }, + { ['x'] = 1192.0831298828, ['y'] = -1336.9086914063, ['z'] = 35.106426239014 }, + { ['x'] = -432.81033325195, ['y'] = -2166.0505371094, ['z'] = 9.8885231018066 }, + { ['x'] = -451.82403564453, ['y'] = -2269.34765625, ['z'] = 7.1719741821289 }, + { ['x'] = 939.26702880859, ['y'] = -2197.5390625, ['z'] = 30.546691894531 }, + { ['x'] = -556.11486816406, ['y'] = -1794.7312011719, ['z'] = 22.043060302734 }, + { ['x'] = 591.73504638672, ['y'] = -2628.2197265625, ['z'] = 5.5735430717468 }, + { ['x'] = 1654.515625, ['y'] = -2535.8325195313, ['z'] = 74.491394042969 }, + { ['x'] = 1642.6146240234, ['y'] = -2413.3159179688, ['z'] = 93.139915466309 }, + { ['x'] = 1371.3223876953, ['y'] = -2549.525390625, ['z'] = 47.575256347656 }, + { ['x'] = 383.83779907227, ['y'] = -1652.8695068359, ['z'] = 37.278503417969 }, + { ['x'] = 27.219129562378, ['y'] = -1030.8818359375, ['z'] = 29.414621353149 }, + { ['x'] = 229.26435852051, ['y'] = -365.91101074219, ['z'] = 43.750762939453 }, + { ['x'] = -85.809432983398, ['y'] = -51.665500640869, ['z'] = 61.10591506958 }, + { ['x'] = -4.5967531204224, ['y'] = -670.27124023438, ['z'] = 31.85863494873 }, + { ['x'] = -111.89884185791, ['y'] = 91.96940612793, ['z'] = 71.080169677734 }, + { ['x'] = -314.26129150391, ['y'] = -698.23309326172, ['z'] = 32.545776367188 }, + { ['x'] = -366.90979003906, ['y'] = 115.53963470459, ['z'] = 65.575706481934 }, + { ['x'] = -592.06726074219, ['y'] = 138.20733642578, ['z'] = 60.074813842773 }, + { ['x'] = -1613.8572998047, ['y'] = 18.759860992432, ['z'] = 61.799819946289 }, + { ['x'] = -1709.7995605469, ['y'] = 55.105819702148, ['z'] = 65.706237792969 }, + { ['x'] = -521.88830566406, ['y'] = -266.7805480957, ['z'] = 34.940990447998 }, + { ['x'] = -451.08666992188, ['y'] = -333.52026367188, ['z'] = 34.021533966064 }, + { ['x'] = 322.36480712891, ['y'] = -1900.4990234375, ['z'] = 25.773607254028 }, +} + +for i=1, #Config.Towables, 1 do + + Config.Zones['Towable' .. i] = { + Pos = Config.Towables[i], + Size = {x = 1.5, y = 1.5, z = 1.0}, + Color = {r = 204, g = 204, b = 0}, + Type = -1 + } + +end + +Config.Vehicles = { + 'adder', + 'asea', + 'asterope', + 'banshee', + 'buffalo' +} diff --git a/server/main.lua b/server/main.lua index 3edee613..0e2ffb1d 100644 --- a/server/main.lua +++ b/server/main.lua @@ -233,6 +233,27 @@ AddEventHandler('esx_mecanojob:stopCraft3', function() PlayersCrafting3[_source] = false end) +---------------------------- NPC Job Earnings ------------------------------------------------------ + +RegisterServerEvent('esx_mecanojob:onNPCJobMissionCompleted') +AddEventHandler('esx_mecanojob:onNPCJobMissionCompleted', function() + + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + 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_mecano', function(account) + account.addMoney(total) + end) + + TriggerClientEvent("esx:showNotification", _source, "Votre société a ~g~gagné~s~ ~g~$".. total) + +end) + ---------------------------- register usable item -------------------------------------------------- ESX.RegisterUsableItem('blowpipe', function(source) From 79c8dce15d05368bcc458f78fe7fdbcca48a3c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sat, 26 Aug 2017 18:44:30 +0200 Subject: [PATCH 12/66] Remove debug comment --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index 2fa62033..13f156a3 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1028,7 +1028,7 @@ Citizen.CreateThread(function() if GetGameTimer() - NPCLastCancel > 5 * 60000 then StopNPCJob(true) - -- NPCLastCancel = GetGameTimer() + NPCLastCancel = GetGameTimer() else ESX.ShowNotification('Vous devez ~r~attendre~s~ 5 minutes') end From 563fd1f7c1740b7099a87260140069acc6b5a0f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sat, 2 Sep 2017 00:39:58 +0200 Subject: [PATCH 13/66] Use new phone --- server/main.lua | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/server/main.lua b/server/main.lua index 0e2ffb1d..cb98646d 100644 --- a/server/main.lua +++ b/server/main.lua @@ -12,22 +12,8 @@ if Config.MaxInService ~= -1 then TriggerEvent('esx_service:activateService', 'mecano', Config.MaxInService) end -TriggerEvent('esx_phone:registerCallback', function(source, phoneNumber, message, anon) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local xPlayers = ESX.GetPlayers() - - if phoneNumber == 'mecano' then - for i=1, #xPlayers, 1 do - - local xPlayer2 = ESX.GetPlayerFromId(xPlayers[i]) +TriggerEvent('esx_phone:registerNumber', 'mecano', 'Client mecano', true, true) - if xPlayer2.job.name == 'mecano' then - TriggerClientEvent('esx_phone:onMessage', xPlayer2.source, xPlayer.get('phoneNumber'), message, xPlayer.get('coords'), anon, 'Appel Mécano') - end - end - end -end) -------------- Récupération bouteille de gaz ------------- ---- Sqlut je teste ------ local function Harvest(source) From c916cd135ea022445155a8b9b5cab4fdec264405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sun, 3 Sep 2017 12:01:30 +0200 Subject: [PATCH 14/66] Use new boss menu + Add chest --- esx_mecanojob_full.sql | 54 +++++++++++++++++++++------------------ esx_mecanojob_minimal.sql | 46 ++++++++++++++++++--------------- 2 files changed, 54 insertions(+), 46 deletions(-) diff --git a/esx_mecanojob_full.sql b/esx_mecanojob_full.sql index 367ca698..70391571 100644 --- a/esx_mecanojob_full.sql +++ b/esx_mecanojob_full.sql @@ -1,26 +1,30 @@ -USE `essentialmode`; - -INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_mecano','Mécano',1) -; - -INSERT INTO `jobs` (name, label) VALUES - ('mecano','Mécano') -; - -INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('mecano',0,'recrue','Recrue',12,'{}','{}'), - ('mecano',1,'novice','Novice',24,'{}','{}'), - ('mecano',2,'experimente','Experimente',36,'{}','{}'), - ('mecano',3,'chief','Chef d\'équipe',48,'{}','{}'), - ('mecano',4,'boss','Patron',0,'{}','{}') -; - -INSERT INTO `items` (name, label) VALUES - ('gazbottle', 'bouteille de gaz'), - ('fixtool', 'outils réparation'), - ('carotool', 'outils carosserie'), - ('blowpipe', 'Chalumeaux'), - ('fixkit', 'Kit réparation'), - ('carokit', 'Kit carosserie') +USE `essentialmode`; + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_mecano','Mécano',1) +; + +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_mecano','Mécano',1) +; + +INSERT INTO `jobs` (name, label) VALUES + ('mecano','Mécano') +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('mecano',0,'recrue','Recrue',12,'{}','{}'), + ('mecano',1,'novice','Novice',24,'{}','{}'), + ('mecano',2,'experimente','Experimente',36,'{}','{}'), + ('mecano',3,'chief','Chef d\'équipe',48,'{}','{}'), + ('mecano',4,'boss','Patron',0,'{}','{}') +; + +INSERT INTO `items` (name, label) VALUES + ('gazbottle', 'bouteille de gaz'), + ('fixtool', 'outils réparation'), + ('carotool', 'outils carosserie'), + ('blowpipe', 'Chalumeaux'), + ('fixkit', 'Kit réparation'), + ('carokit', 'Kit carosserie') ; \ No newline at end of file diff --git a/esx_mecanojob_minimal.sql b/esx_mecanojob_minimal.sql index 48dd963e..cf4b3023 100644 --- a/esx_mecanojob_minimal.sql +++ b/esx_mecanojob_minimal.sql @@ -1,22 +1,26 @@ -USE `essentialmode`; - -INSERT INTO `jobs` (name, label) VALUES - ('mecano','Mécano') -; - -INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('mecano',0,'recrue','Recrue',12,'{}','{}'), - ('mecano',1,'novice','Novice',24,'{}','{}'), - ('mecano',2,'experimente','Experimente',36,'{}','{}'), - ('mecano',3,'chief','Chef d\'équipe',48,'{}','{}'), - ('mecano',4,'boss','Patron',0,'{}','{}') -; - -INSERT INTO `items` (name, label) VALUES - ('gazbottle', 'bouteille de gaz'), - ('fixtool', 'outils réparation'), - ('carotool', 'outils carosserie'), - ('blowpipe', 'Chalumeaux'), - ('fixkit', 'Kit réparation'), - ('carokit', 'Kit carosserie') +USE `essentialmode`; + +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_mecano','Mécano',1) +; + +INSERT INTO `jobs` (name, label) VALUES + ('mecano','Mécano') +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('mecano',0,'recrue','Recrue',12,'{}','{}'), + ('mecano',1,'novice','Novice',24,'{}','{}'), + ('mecano',2,'experimente','Experimente',36,'{}','{}'), + ('mecano',3,'chief','Chef d\'équipe',48,'{}','{}'), + ('mecano',4,'boss','Patron',0,'{}','{}') +; + +INSERT INTO `items` (name, label) VALUES + ('gazbottle', 'bouteille de gaz'), + ('fixtool', 'outils réparation'), + ('carotool', 'outils carosserie'), + ('blowpipe', 'Chalumeaux'), + ('fixkit', 'Kit réparation'), + ('carokit', 'Kit carosserie') ; \ No newline at end of file From a45253f8d01126b5cfc6fade3b304a4a9721283c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sun, 3 Sep 2017 12:05:01 +0200 Subject: [PATCH 15/66] Use new boss menu + Add chest --- client/main.lua | 199 ++++++++++++++++++++++++++++++++---------------- server/main.lua | 79 +++++++++++++++++++ 2 files changed, 214 insertions(+), 64 deletions(-) diff --git a/client/main.lua b/client/main.lua index 13f156a3..d27852fa 100644 --- a/client/main.lua +++ b/client/main.lua @@ -96,12 +96,12 @@ function OpenMecanoActionsMenu() local elements = { {label = 'Sortir Véhicule', value = 'vehicle_list'}, {label = 'Tenue de travail', value = 'cloakroom'}, - {label = 'Tenue civile', value = 'cloakroom2'} + {label = 'Tenue civile', value = 'cloakroom2'}, + {label = 'Déposer Stock', value = 'put_stock'}, + {label = 'Prendre Stock', value = 'get_stock'} } if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name == 'boss' then - table.insert(elements, {label = 'Retirer argent société', value = 'withdraw_society_money'}) - table.insert(elements, {label = 'Déposer argent ', value = 'deposit_money'}) - table.insert(elements, {label = 'Blanchir argent', value = 'wash_money'}) + table.insert(elements, {label = 'Action Patron', value = 'boss_actions'}) end ESX.UI.Menu.CloseAll() @@ -187,68 +187,20 @@ function OpenMecanoActionsMenu() end) end - if data.current.value == 'withdraw_society_money' then - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'withdraw_society_money_amount', - { - title = 'Montant du retrait' - }, - function(data, menu) - local amount = tonumber(data.value) - if amount == nil then - ESX.ShowNotification('Montant invalide') - else - menu.close() - TriggerServerEvent('esx_society:withdrawMoney', 'mecano', amount) - end - end, - function(data, menu) - menu.close() - end - ) + if data.current.value == 'put_stock' then + OpenPutStocksMenu() + end + + if data.current.value == 'get_stock' then + OpenGetStocksMenu() + end + + if data.current.value == 'boss_actions' then + TriggerEvent('esx_society:openBossMenu', 'mecano', function(data, menu) + menu.close() + end) end - if data.current.value == 'deposit_money' then - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'deposit_money_amount', - { - title = 'Montant du dépôt' - }, - function(data, menu) - local amount = tonumber(data.value) - if amount == nil then - ESX.ShowNotification('Montant invalide') - else - menu.close() - TriggerServerEvent('esx_society:depositMoney', 'mecano', amount) - end - end, - function(data, menu) - menu.close() - end - ) - end - - if data.current.value == 'wash_money' then - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'wash_money_amount', - { - title = 'Montant à blanchir' - }, - function(data, menu) - local amount = tonumber(data.value) - if amount == nil then - ESX.ShowNotification('Montant invalide') - else - menu.close() - TriggerServerEvent('esx_society:washMoney', 'mecano', amount) - end - end, - function(data, menu) - menu.close() - end - ) - end end, function(data, menu) menu.close() @@ -643,6 +595,125 @@ function OpenMobileMecanoActionsMenu() ) end +function OpenGetStocksMenu() + + ESX.TriggerServerCallback('esx_mecanojob:getStockItems', function(items) + + print(json.encode(items)) + + local elements = {} + + for i=1, #items, 1 do + table.insert(elements, {label = 'x' .. items[i].count .. ' ' .. items[i].label, value = items[i].name}) + end + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'stocks_menu', + { + title = 'Mecano Stock', + elements = elements + }, + function(data, menu) + + local itemName = data.current.value + + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'stocks_menu_get_item_count', + { + title = 'Quantité' + }, + function(data2, menu2) + + local count = tonumber(data2.value) + + if count == nil then + ESX.ShowNotification('Quantité invalide') + else + menu2.close() + menu.close() + OpenGetStocksMenu() + + TriggerServerEvent('esx_mecanojob:getStockItem', itemName, count) + end + + end, + function(data2, menu2) + menu2.close() + end + ) + + end, + function(data, menu) + menu.close() + end + ) + + end) + +end + +function OpenPutStocksMenu() + +ESX.TriggerServerCallback('esx_mecanojob:getPlayerInventory', function(inventory) + + local elements = {} + + for i=1, #inventory.items, 1 do + + local item = inventory.items[i] + + if item.count > 0 then + table.insert(elements, {label = item.label .. ' x' .. item.count, type = 'item_standard', value = item.name}) + end + + end + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'stocks_menu', + { + title = 'Inventaire', + elements = elements + }, + function(data, menu) + + local itemName = data.current.value + + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'stocks_menu_put_item_count', + { + title = 'Quantité' + }, + function(data2, menu2) + + local count = tonumber(data2.value) + + if count == nil then + ESX.ShowNotification('Quantité invalide') + else + menu2.close() + menu.close() + OpenPutStocksMenu() + + TriggerServerEvent('esx_mecanojob:putStockItems', itemName, count) + end + + end, + function(data2, menu2) + menu2.close() + end + ) + + end, + function(data, menu) + menu.close() + end + ) + + end) + +end + + RegisterNetEvent('esx_mecanojob:onHijack') AddEventHandler('esx_mecanojob:onHijack', function() local playerPed = GetPlayerPed(-1) diff --git a/server/main.lua b/server/main.lua index cb98646d..bf14b2a9 100644 --- a/server/main.lua +++ b/server/main.lua @@ -275,4 +275,83 @@ ESX.RegisterUsableItem('carokit', function(source) TriggerClientEvent('esx_mecanojob:onCarokit', _source) TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé un ~b~Kit de carosserie') +end) + +---------------------------------- +---- Ajout Gestion Stock Boss ---- +---------------------------------- + +RegisterServerEvent('esx_mecanojob:getStockItem') +AddEventHandler('esx_mecanojob:getStockItem', function(itemName, count) + + local xPlayer = ESX.GetPlayerFromId(source) + + TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) + + local item = inventory.getItem(itemName) + + if item.count >= count then + inventory.removeItem(itemName, count) + xPlayer.addInventoryItem(itemName, count) + else + TriggerClientEvent('esx:showNotification', xPlayer.source, 'Quantité invalide') + end + + TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez retiré x' .. count .. ' ' .. item.label) + + end) + +end) + +ESX.RegisterServerCallback('esx_mecanojob:getStockItems', function(source, cb) + + TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) + cb(inventory.items) + end) + +end) + +------------- +-- AJOUT 2 -- +------------- + +RegisterServerEvent('esx_mecanojob:putStockItems') +AddEventHandler('esx_mecanojob:putStockItems', function(itemName, count) + + local xPlayer = ESX.GetPlayerFromId(source) + + TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) + + local item = inventory.getItem(itemName) + + if item.count >= 0 then + xPlayer.removeInventoryItem(itemName, count) + inventory.addItem(itemName, count) + else + TriggerClientEvent('esx:showNotification', xPlayer.source, 'Quantité invalide') + end + + TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez ajouté x' .. count .. ' ' .. item.label) + + end) + +end) + +--ESX.RegisterServerCallback('esx_mecanojob:putStockItems', function(source, cb) + +-- TriggerEvent('esx_addoninventory:getSharedInventory', 'society_policestock', function(inventory) +-- cb(inventory.items) +-- end) + +--end) + +ESX.RegisterServerCallback('esx_mecanojob:getPlayerInventory', function(source, cb) + + local xPlayer = ESX.GetPlayerFromId(source) + local items = xPlayer.inventory + + cb({ + items = items + }) + end) \ No newline at end of file From 2a39419c3041c3a0931a22e153d16831edc2ab22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sat, 9 Sep 2017 16:55:51 +0200 Subject: [PATCH 16/66] Add society garage support --- client/main.lua | 215 +++++++++++++++++++++++++++++++----------------- config.lua | 15 ++-- 2 files changed, 147 insertions(+), 83 deletions(-) diff --git a/client/main.lua b/client/main.lua index d27852fa..ad1fb44d 100644 --- a/client/main.lua +++ b/client/main.lua @@ -114,55 +114,97 @@ function OpenMecanoActionsMenu() }, function(data, menu) if data.current.value == 'vehicle_list' then - local elements = { - {label = 'Plateau', value = 'flatbed'}, - {label = 'Dépaneuse', value = 'towtruck2'} - } - if Config.EnablePlayerManagement and PlayerData.job ~= nil and - (PlayerData.job.grade_name == 'boss' or PlayerData.job.grade_name == 'chef' or PlayerData.job.grade_name == 'experimente') then - table.insert(elements, {label = 'SlamVan', value = 'slamvan3'}) - end + if Config.EnableSocietyOwnedVehicles then - ESX.UI.Menu.CloseAll() + local elements = {} - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'spawn_vehicle', - { - title = 'Véhicule de service', - elements = elements - }, - function(data, menu) - for i=1, #elements, 1 do - if Config.MaxInService == -1 then - local playerPed = GetPlayerPed(-1) - local coords = Config.Zones.VehicleSpawnPoint.Pos - ESX.Game.SpawnVehicle(data.current.value, coords, 90.0, function(vehicle) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - break - else - ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount) - if canTakeService then - local playerPed = GetPlayerPed(-1) - local coords = Config.Zones.VehicleSpawnPoint.Pos - ESX.Game.SpawnVehicle(data.current.value, coords, 90.0, function(vehicle) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - else - ESX.ShowNotification('Service complet : ' .. inServiceCount .. '/' .. maxInService) - end - end, 'mecano') - break + ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) + + for i=1, #vehicles, 1 do + table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) end - end - menu.close() - end, - function(data, menu) - menu.close() - OpenMecanoActionsMenu() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'vehicle_spawner', + { + title = 'Véhicule de service', + align = 'top-left', + elements = elements, + }, + function(data, menu) + + menu.close() + + local vehicleProps = data.current.value + + ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) + ESX.Game.SetVehicleProperties(vehicle, vehicleProps) + local playerPed = GetPlayerPed(-1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + + TriggerServerEvent('esx_society:removeVehicleFromGarage', 'mecano', vehicleProps) + + end, + function(data, menu) + menu.close() + end + ) + + end, 'mecano') + + else + + local elements = { + {label = 'Plateau', value = 'flatbed'}, + {label = 'Dépaneuse', value = 'towtruck2'} + } + + if Config.EnablePlayerManagement and PlayerData.job ~= nil and + (PlayerData.job.grade_name == 'boss' or PlayerData.job.grade_name == 'chef' or PlayerData.job.grade_name == 'experimente') then + table.insert(elements, {label = 'SlamVan', value = 'slamvan3'}) + end + + ESX.UI.Menu.CloseAll() + + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'spawn_vehicle', + { + title = 'Véhicule de service', + elements = elements + }, + function(data, menu) + for i=1, #elements, 1 do + if Config.MaxInService == -1 then + ESX.Game.SpawnVehicle(data.current.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle) + local playerPed = GetPlayerPed(-1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + break + else + ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount) + if canTakeService then + ESX.Game.SpawnVehicle(data.current.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle) + local playerPed = GetPlayerPed(-1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + else + ESX.ShowNotification('Service complet : ' .. inServiceCount .. '/' .. maxInService) + end + end, 'mecano') + break + end + end + menu.close() + end, + function(data, menu) + menu.close() + OpenMecanoActionsMenu() + end + ) + end - ) end if data.current.value == 'cloakroom' then @@ -862,11 +904,16 @@ AddEventHandler('esx_mecanojob:hasEnteredMarker', function(zone) end if zone == 'VehicleDeleter' then + local playerPed = GetPlayerPed(-1) + if IsPedInAnyVehicle(playerPed, false) then + + local vehicle = GetVehiclePedIsIn(playerPed, false) + CurrentAction = 'delete_vehicle' CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule.' - CurrentActionData = {} + CurrentActionData = {vehicle = vehicle} end end @@ -965,7 +1012,7 @@ Citizen.CreateThread(function() local blip = AddBlipForCoord(Config.Zones.MecanoActions.Pos.x, Config.Zones.MecanoActions.Pos.y, Config.Zones.MecanoActions.Pos.z) SetBlipSprite (blip, 446) SetBlipDisplay(blip, 4) - SetBlipScale (blip, 1.0) + SetBlipScale (blip, 1.8) SetBlipColour (blip, 5) SetBlipAsShortRange(blip, true) BeginTextCommandSetBlipName("STRING") @@ -1056,37 +1103,53 @@ Citizen.CreateThread(function() Citizen.Wait(0) if CurrentAction ~= nil then - SetTextComponentFormat('STRING') - AddTextComponentString(CurrentActionMsg) - DisplayHelpTextFromStringLabel(0, 0, 1, -1) - if IsControlJustReleased(0, 38) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - if CurrentAction == 'mecano_actions_menu' then - OpenMecanoActionsMenu() - end - if CurrentAction == 'mecano_harvest_menu' then - OpenMecanoHarvestMenu() - end - if CurrentAction == 'mecano_craft_menu' then - OpenMecanoCraftMenu() - end - if CurrentAction == 'delete_vehicle' then - local playerPed = GetPlayerPed(-1) - local vehicle = GetVehiclePedIsIn(playerPed, false) - local hash = GetEntityModel(vehicle) - if hash == GetHashKey('flatbed') or hash == GetHashKey('towtruck2') or hash == GetHashKey('slamvan3') then - if Config.MaxInService ~= -1 then - TriggerServerEvent('esx_service:disableService', 'mecano') - end - DeleteVehicle(vehicle) - else - ESX.ShowNotification('Vous ne pouvez ranger que des ~b~véhicules de Mécano~s~.') - end - end - if CurrentAction == 'remove_entity' then - DeleteEntity(CurrentActionData.entity) - end - CurrentAction = nil + + SetTextComponentFormat('STRING') + AddTextComponentString(CurrentActionMsg) + DisplayHelpTextFromStringLabel(0, 0, 1, -1) + + if IsControlJustReleased(0, 38) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + + if CurrentAction == 'mecano_actions_menu' then + OpenMecanoActionsMenu() end + + if CurrentAction == 'mecano_harvest_menu' then + OpenMecanoHarvestMenu() + end + + if CurrentAction == 'mecano_craft_menu' then + OpenMecanoCraftMenu() + end + + if CurrentAction == 'delete_vehicle' then + + if Config.EnableSocietyOwnedVehicles then + + local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) + TriggerServerEvent('esx_society:putVehicleInGarage', 'mecano', vehicleProps) + + else + + if + GetEntityModel(vehicle) == GetHashKey('flatbed') or + GetEntityModel(vehicle) == GetHashKey('towtrcuk2') or + GetEntityModel(vehicle) == GetHashKey('slamvan3') + then + TriggerServerEvent('esx_service:disableService', 'mecano') + end + + end + + ESX.Game.DeleteVehicle(CurrentActionData.vehicle) + end + + if CurrentAction == 'remove_entity' then + DeleteEntity(CurrentActionData.entity) + end + + CurrentAction = nil + end end if IsControlJustReleased(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then diff --git a/config.lua b/config.lua index 96d25931..37dcd195 100644 --- a/config.lua +++ b/config.lua @@ -1,10 +1,11 @@ -Config = {} -Config.DrawDistance = 100.0 -Config.MaxInService = -1 -Config.EnablePlayerManagement = true -Config.NPCSpawnDistance = 500.0 -Config.NPCNextToDistance = 25.0 -Config.NPCJobEarnings = {min = 15, max = 40} +Config = {} +Config.DrawDistance = 100.0 +Config.MaxInService = -1 +Config.EnablePlayerManagement = false +Config.EnableSocietyOwnedVehicles = false +Config.NPCSpawnDistance = 500.0 +Config.NPCNextToDistance = 25.0 +Config.NPCJobEarnings = {min = 15, max = 40} Config.Zones = { From 9342a9d2e7465646a9816ea79d81b5ff9e42313b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Sat, 9 Sep 2017 17:12:21 +0200 Subject: [PATCH 17/66] Clean up repo --- README.md | 3 +-- esx_mecanojob_full.sql => esx_mecanojob.sql | 0 esx_mecanojob_minimal.sql | 26 --------------------- 3 files changed, 1 insertion(+), 28 deletions(-) rename esx_mecanojob_full.sql => esx_mecanojob.sql (100%) delete mode 100644 esx_mecanojob_minimal.sql diff --git a/README.md b/README.md index 0b8b09eb..9d802b28 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,7 @@ FXServer ESX Mecano Job ``` git clone https://github.com/FXServer-ESX/fxserver-esx_mecanojob esx_mecanojob ``` -3) * Auto mode : Import esx_mecanojob_minimal.sql in your database - * Player management : Import esx_mecanojob_full.sql in your database +3) Import esx_mecanojob.sql in your database 4) Add this in your server.cfg : diff --git a/esx_mecanojob_full.sql b/esx_mecanojob.sql similarity index 100% rename from esx_mecanojob_full.sql rename to esx_mecanojob.sql diff --git a/esx_mecanojob_minimal.sql b/esx_mecanojob_minimal.sql deleted file mode 100644 index cf4b3023..00000000 --- a/esx_mecanojob_minimal.sql +++ /dev/null @@ -1,26 +0,0 @@ -USE `essentialmode`; - -INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_mecano','Mécano',1) -; - -INSERT INTO `jobs` (name, label) VALUES - ('mecano','Mécano') -; - -INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('mecano',0,'recrue','Recrue',12,'{}','{}'), - ('mecano',1,'novice','Novice',24,'{}','{}'), - ('mecano',2,'experimente','Experimente',36,'{}','{}'), - ('mecano',3,'chief','Chef d\'équipe',48,'{}','{}'), - ('mecano',4,'boss','Patron',0,'{}','{}') -; - -INSERT INTO `items` (name, label) VALUES - ('gazbottle', 'bouteille de gaz'), - ('fixtool', 'outils réparation'), - ('carotool', 'outils carosserie'), - ('blowpipe', 'Chalumeaux'), - ('fixkit', 'Kit réparation'), - ('carokit', 'Kit carosserie') -; \ No newline at end of file From 7de229283df8497337f1dacb4abff7a560e04b03 Mon Sep 17 00:00:00 2001 From: nearbyplayer Date: Tue, 12 Sep 2017 15:49:22 -0400 Subject: [PATCH 18/66] Multi-language support --- __resource.lua | 8 +- client/main.lua | 290 +++++++++++++++--------------- config.lua | 1 + locales/en.lua | 83 +++++++++ locales/fr.lua | 83 +++++++++ localization/esx_mecanojob_en.sql | 30 ++++ server/main.lua | 62 +++---- 7 files changed, 380 insertions(+), 177 deletions(-) create mode 100644 locales/en.lua create mode 100644 locales/fr.lua create mode 100644 localization/esx_mecanojob_en.sql diff --git a/__resource.lua b/__resource.lua index 403d0d09..ed54f8fb 100644 --- a/__resource.lua +++ b/__resource.lua @@ -3,11 +3,17 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Mecano Job' client_scripts { + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/fr.lua', 'config.lua', 'client/main.lua' } server_scripts { + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/fr.lua', 'config.lua', 'server/main.lua' -} \ No newline at end of file +} diff --git a/client/main.lua b/client/main.lua index ad1fb44d..5b9cd4ad 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,10 +1,10 @@ local Keys = { - ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, - ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, + ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, + ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18, ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182, ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81, - ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, + ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178, ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173, ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 @@ -59,7 +59,7 @@ function StartNPCJob() Blips['NPCTargetTowableZone'] = AddBlipForCoord(zone.Pos.x, zone.Pos.y, zone.Pos.z) SetBlipRoute(Blips['NPCTargetTowableZone'], true) - ESX.ShowNotification('~y~Conduisez~s~ jusqu\'à l\'endroit indiqué') + ESX.ShowNotification(_U('drive_to_indicated')) end function StopNPCJob(cancel) @@ -84,7 +84,7 @@ function StopNPCJob(cancel) NPCHasBeenNextToTowable = false if cancel then - ESX.ShowNotification('Mission ~r~annulée~s~') + ESX.ShowNotification(_U('mission_canceled')) else TriggerServerEvent('esx_mecanojob:onNPCJobCompleted') end @@ -94,14 +94,14 @@ end function OpenMecanoActionsMenu() local elements = { - {label = 'Sortir Véhicule', value = 'vehicle_list'}, - {label = 'Tenue de travail', value = 'cloakroom'}, - {label = 'Tenue civile', value = 'cloakroom2'}, - {label = 'Déposer Stock', value = 'put_stock'}, - {label = 'Prendre Stock', value = 'get_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 - table.insert(elements, {label = 'Action Patron', value = 'boss_actions'}) + table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) end ESX.UI.Menu.CloseAll() @@ -109,7 +109,7 @@ function OpenMecanoActionsMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'mecano_actions', { - title = 'Mecano', + title = _U('mechanic'), elements = elements }, function(data, menu) @@ -128,7 +128,7 @@ function OpenMecanoActionsMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'vehicle_spawner', { - title = 'Véhicule de service', + title = _U('service_vehicle'), align = 'top-left', elements = elements, }, @@ -157,11 +157,11 @@ function OpenMecanoActionsMenu() else local elements = { - {label = 'Plateau', value = 'flatbed'}, - {label = 'Dépaneuse', value = 'towtruck2'} + {label = _U('flat_bed'), value = 'flatbed'}, + {label = _U('tow_truck'), value = 'towtruck2'} } - if Config.EnablePlayerManagement and PlayerData.job ~= nil and + if Config.EnablePlayerManagement and PlayerData.job ~= nil and (PlayerData.job.grade_name == 'boss' or PlayerData.job.grade_name == 'chef' or PlayerData.job.grade_name == 'experimente') then table.insert(elements, {label = 'SlamVan', value = 'slamvan3'}) end @@ -171,11 +171,11 @@ function OpenMecanoActionsMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'spawn_vehicle', { - title = 'Véhicule de service', + title = _U('service_vehicle'), elements = elements }, function(data, menu) - for i=1, #elements, 1 do + for i=1, #elements, 1 do if Config.MaxInService == -1 then ESX.Game.SpawnVehicle(data.current.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle) local playerPed = GetPlayerPed(-1) @@ -190,12 +190,12 @@ function OpenMecanoActionsMenu() TaskWarpPedIntoVehicle(playerPed, vehicle, -1) end) else - ESX.ShowNotification('Service complet : ' .. inServiceCount .. '/' .. maxInService) + ESX.ShowNotification(_U('service_full') .. inServiceCount .. '/' .. maxInService) end end, 'mecano') break end - end + end menu.close() end, function(data, menu) @@ -216,7 +216,7 @@ function OpenMecanoActionsMenu() else TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) end - + end) end @@ -225,17 +225,17 @@ function OpenMecanoActionsMenu() ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) TriggerEvent('skinchanger:loadSkin', skin) - + end) end if data.current.value == 'put_stock' then OpenPutStocksMenu() - end + end if data.current.value == 'get_stock' then OpenGetStocksMenu() - end + end if data.current.value == 'boss_actions' then TriggerEvent('esx_society:openBossMenu', 'mecano', function(data, menu) @@ -247,7 +247,7 @@ function OpenMecanoActionsMenu() function(data, menu) menu.close() CurrentAction = 'mecano_actions_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu.' + CurrentActionMsg = _U('open_actions') CurrentActionData = {} end ) @@ -257,9 +257,9 @@ function OpenMecanoHarvestMenu() if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then local elements = { - {label = 'Bouteille de gaz', value = 'gaz_bottle'}, - {label = 'Outils réparation', value = 'fix_tool'}, - {label = 'Outils Carosserie', value = 'caro_tool'} + {label = _U('gas_can'), value = 'gaz_bottle'}, + {label = _U('repair_tools'), value = 'fix_tool'}, + {label = _U('body_work_tools'), value = 'caro_tool'} } ESX.UI.Menu.CloseAll() @@ -267,7 +267,7 @@ function OpenMecanoHarvestMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'mecano_harvest', { - title = 'Récolte', + title = _U('harvest'), elements = elements }, function(data, menu) @@ -290,12 +290,12 @@ function OpenMecanoHarvestMenu() function(data, menu) menu.close() CurrentAction = 'mecano_harvest_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu de récolte.' + CurrentActionMsg = _U('harvest_menu') CurrentActionData = {} end ) else - ESX.ShowNotification("Vous n'êtes ~r~pas assez expérimenté~s~ pour effectuer cette action.") + ESX.ShowNotification(_U('not_experienced_enough')) end end @@ -303,9 +303,9 @@ function OpenMecanoCraftMenu() if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then local elements = { - {label = 'Chalumeaux', value = 'blow_pipe'}, - {label = 'Kit réparation', value = 'fix_kit'}, - {label = 'Outils Carosserie', value = 'caro_kit'} + {label = _U('blowtorch'), value = 'blow_pipe'}, + {label = _U('repair_kit'), value = 'fix_kit'}, + {label = _U('body_kit'), value = 'caro_kit'} } ESX.UI.Menu.CloseAll() @@ -313,7 +313,7 @@ function OpenMecanoCraftMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'mecano_craft', { - title = 'Etabli', + title = _U('craft'), elements = elements }, function(data, menu) @@ -336,12 +336,12 @@ function OpenMecanoCraftMenu() function(data, menu) menu.close() CurrentAction = 'mecano_craft_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu établi.' + CurrentActionMsg = _U('craft_menu') CurrentActionData = {} end ) else - ESX.ShowNotification("Vous n'êtes ~r~pas assez expérimenté~s~ pour effectuer cette action.") + ESX.ShowNotification(_U('not_experienced_enough')) end end @@ -352,15 +352,15 @@ function OpenMobileMecanoActionsMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'mobile_mecano_actions', { - title = 'Mécano', + title = _U('mechanic'), elements = { - {label = 'Facuration', value = 'billing'}, - {label = 'Crocheter', value = 'hijack_vehicle'}, - {label = 'Réparer', value = 'fix_vehicle'}, - {label = 'Nettoyer', value = 'clean_vehicle'}, - {label = 'Fourrière', value = 'del_vehicle'}, - {label = 'Plateau', value = 'dep_vehicle'}, - {label = 'Placer objets', value = 'object_spawner'} + {label = _U('billing'), value = 'billing'}, + {label = _U('hijack'), value = 'hijack_vehicle'}, + {label = _U('repair'), value = 'fix_vehicle'}, + {label = _U('clean'), value = 'clean_vehicle'}, + {label = _U('imp_veh'), value = 'del_vehicle'}, + {label = _U('flat_bed'), value = 'dep_vehicle'}, + {label = _U('place_objects'), value = 'object_spawner'} } }, function(data, menu) @@ -368,19 +368,19 @@ function OpenMobileMecanoActionsMenu() ESX.UI.Menu.Open( 'dialog', GetCurrentResourceName(), 'billing', { - title = 'Montant de la facture' + title = _U('invoice_amount') }, function(data, menu) local amount = tonumber(data.value) if amount == nil then - ESX.ShowNotification('Montant invalide') - else - menu.close() + ESX.ShowNotification(_U('amount_invalid')) + else + menu.close() local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification('Aucun joueur à proximité') + ESX.ShowNotification(_U('no_players_nearby')) else - TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mecano', 'Mecano', amount) + TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mecano', _U('mechanic'), amount) end end end, @@ -412,7 +412,7 @@ function OpenMobileMecanoActionsMenu() SetVehicleDoorsLocked(vehicle, 1) SetVehicleDoorsLockedForAllPlayers(vehicle, false) ClearPedTasksImmediately(playerPed) - ESX.ShowNotification('Véhicule ~g~déverouillé') + ESX.ShowNotification(_U('vehicle_unlocked')) end) end @@ -421,12 +421,12 @@ function OpenMobileMecanoActionsMenu() end if data.current.value == 'fix_vehicle' then - + local playerPed = GetPlayerPed(-1) local coords = GetEntityCoords(playerPed) - + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - + local vehicle = nil if IsPedInAnyVehicle(playerPed, false) then @@ -434,7 +434,7 @@ function OpenMobileMecanoActionsMenu() else vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) end - + if DoesEntityExist(vehicle) then TaskStartScenarioInPlace(playerPed, "PROP_HUMAN_BUM_BIN", 0, true) Citizen.CreateThread(function() @@ -444,19 +444,19 @@ function OpenMobileMecanoActionsMenu() SetVehicleUndriveable(vehicle, false) SetVehicleEngineOn(vehicle, true, true) ClearPedTasksImmediately(playerPed) - ESX.ShowNotification('Véhicule ~g~réparé') + ESX.ShowNotification(_U('vehicle_repaired')) end) end end end if data.current.value == 'clean_vehicle' then - + local playerPed = GetPlayerPed(-1) local coords = GetEntityCoords(playerPed) - + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - + local vehicle = nil if IsPedInAnyVehicle(playerPed, false) then @@ -464,57 +464,57 @@ function OpenMobileMecanoActionsMenu() 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('Véhicule ~g~néttoyé') + ESX.ShowNotification(_U('vehicle_cleaned')) end) end end end - + if data.current.value == 'del_vehicle' then - + local ped = GetPlayerPed( -1 ) - if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then + if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then local pos = GetEntityCoords( ped ) - if ( IsPedSittingInAnyVehicle( ped ) ) then + if ( IsPedSittingInAnyVehicle( ped ) ) then local vehicle = GetVehiclePedIsIn( ped, false ) - if ( GetPedInVehicleSeat( vehicle, -1 ) == ped ) then - ESX.ShowNotification('Vehicule ~r~mis en fourrière') + if ( GetPedInVehicleSeat( vehicle, -1 ) == ped ) then + ESX.ShowNotification(_U('vehicle_impounded')) SetEntityAsMissionEntity( vehicle, true, true ) deleteCar( vehicle ) - else - ESX.ShowNotification('Vous devez être assis du ~r~côté conducteur!') - end + else + ESX.ShowNotification(_U('must_seat_driver')) + end else local playerPos = GetEntityCoords( ped, 1 ) local inFrontOfPlayer = GetOffsetFromEntityInWorldCoords( ped, 0.0, distanceToCheck, 0.0 ) local vehicle = GetVehicleInDirection( playerPos, inFrontOfPlayer ) if ( DoesEntityExist( vehicle ) ) then - ESX.ShowNotification('Vehicule ~r~mis en fourrière') + ESX.ShowNotification(_U('vehicle_impounded')) SetEntityAsMissionEntity( vehicle, true, true ) deleteCar( vehicle ) - else - ESX.ShowNotification('Vous devez être ~r~près d\'un véhicule~s~ pour le mettre en fourrière') - end - end + else + ESX.ShowNotification(_U('must_near')) + end + end end end - + if data.current.value == 'dep_vehicle' then - + local playerped = GetPlayerPed(-1) local vehicle = GetVehiclePedIsIn(playerped, true) - + local towmodel = GetHashKey('flatbed') local isVehicleTow = IsVehicleModel(vehicle, towmodel) @@ -523,19 +523,19 @@ function OpenMobileMecanoActionsMenu() local coordA = GetEntityCoords(playerped, 1) local coordB = GetOffsetFromEntityInWorldCoords(playerped, 0.0, 5.0, 0.0) local targetVehicle = getVehicleInDirection(coordA, coordB) - + if CurrentlyTowedVehicle == nil then if targetVehicle ~= 0 then if not IsPedInAnyVehicle(playerped, true) then if vehicle ~= targetVehicle then AttachEntityToEntity(targetVehicle, vehicle, 20, -0.5, -5.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) CurrentlyTowedVehicle = targetVehicle - ESX.ShowNotification('Vehicule ~b~attaché~s~ avec succès!') - + ESX.ShowNotification(_U('vehicle_success_attached')) + if NPCOnJob then if NPCTargetTowable == targetVehicle then - ESX.ShowNotification('Veuillez déposer le véhicule à la concession') + ESX.ShowNotification(_U('please_drop_off')) Config.Zones.VehicleDelivery.Type = 1 @@ -545,7 +545,7 @@ function OpenMobileMecanoActionsMenu() end Blips['NPCDelivery'] = AddBlipForCoord(Config.Zones.VehicleDelivery.Pos.x, Config.Zones.VehicleDelivery.Pos.y, Config.Zones.VehicleDelivery.Pos.z) - + SetBlipRoute(Blips['NPCDelivery'], true) end @@ -553,17 +553,17 @@ function OpenMobileMecanoActionsMenu() end else - ESX.ShowNotification('~r~Impossible~s~ d\'attacher votre propre dépanneuse') + ESX.ShowNotification(_U('cant_attach_own_tt')) end end else - ESX.ShowNotification('Il n\'y a ~r~pas de véhicule~s~ à attacher') + ESX.ShowNotification(_U('no_veh_att')) end else AttachEntityToEntity(CurrentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) DetachEntity(CurrentlyTowedVehicle, true, true) - + if NPCOnJob then if CurrentlyTowedVehicle == NPCTargetTowable then @@ -572,17 +572,17 @@ function OpenMobileMecanoActionsMenu() StopNPCJob() else - ESX.ShowNotification('Ce n\'est pas le bon véhicule') + ESX.ShowNotification(_U('not_right_veh')) end end CurrentlyTowedVehicle = nil - ESX.ShowNotification('Vehicule ~b~détattaché~s~ avec succès!') + ESX.ShowNotification(_U('veh_det_succ')) end else - ESX.ShowNotification('~r~Impossible! ~s~Vous devez avoir un ~b~Flatbed ~s~pour ça') + ESX.ShowNotification(_U('imp_flatbed')) end end @@ -591,11 +591,11 @@ function OpenMobileMecanoActionsMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'mobile_mecano_actions_spawn', { - title = 'Objets', + title = _U('objects'), align = 'top-left', elements = { - {label = 'Plot', value = 'prop_roadcone02a'}, - {label = 'Boîte à outils', value = 'prop_toolchest_01'}, + {label = _U('roadcone'), value = 'prop_roadcone02a'}, + {label = _U('toolbox'), value = 'prop_toolchest_01'}, }, }, function(data2, menu2) @@ -652,7 +652,7 @@ function OpenGetStocksMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'stocks_menu', { - title = 'Mecano Stock', + title = _U('mechanic_stock'), elements = elements }, function(data, menu) @@ -662,14 +662,14 @@ function OpenGetStocksMenu() ESX.UI.Menu.Open( 'dialog', GetCurrentResourceName(), 'stocks_menu_get_item_count', { - title = 'Quantité' + title = _U('quantity') }, function(data2, menu2) local count = tonumber(data2.value) if count == nil then - ESX.ShowNotification('Quantité invalide') + ESX.ShowNotification(_U('invalid_quantity')) else menu2.close() menu.close() @@ -713,7 +713,7 @@ ESX.TriggerServerCallback('esx_mecanojob:getPlayerInventory', function(inventory ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'stocks_menu', { - title = 'Inventaire', + title = _U('inventory'), elements = elements }, function(data, menu) @@ -723,14 +723,14 @@ ESX.TriggerServerCallback('esx_mecanojob:getPlayerInventory', function(inventory ESX.UI.Menu.Open( 'dialog', GetCurrentResourceName(), 'stocks_menu_put_item_count', { - title = 'Quantité' + title = _U('quantity') }, function(data2, menu2) local count = tonumber(data2.value) if count == nil then - ESX.ShowNotification('Quantité invalide') + ESX.ShowNotification(_U('invalid_quantity')) else menu2.close() menu.close() @@ -786,9 +786,9 @@ AddEventHandler('esx_mecanojob:onHijack', function() SetVehicleDoorsLocked(vehicle, 1) SetVehicleDoorsLockedForAllPlayers(vehicle, false) ClearPedTasksImmediately(playerPed) - ESX.ShowNotification('~g~Véhicule déverouillé') + ESX.ShowNotification(_U('veh_unlocked')) else - ESX.ShowNotification('~r~Crochetage raté') + ESX.ShowNotification(_U('hijack_failed')) ClearPedTasksImmediately(playerPed) end end) @@ -801,9 +801,9 @@ RegisterNetEvent('esx_mecanojob:onCarokit') AddEventHandler('esx_mecanojob:onCarokit', function() local playerPed = GetPlayerPed(-1) local coords = GetEntityCoords(playerPed) - + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - + local vehicle = nil if IsPedInAnyVehicle(playerPed, false) then @@ -811,7 +811,7 @@ AddEventHandler('esx_mecanojob:onCarokit', function() else vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) end - + if DoesEntityExist(vehicle) then TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_HAMMERING", 0, true) Citizen.CreateThread(function() @@ -819,7 +819,7 @@ AddEventHandler('esx_mecanojob:onCarokit', function() SetVehicleFixed(vehicle) SetVehicleDeformationFixed(vehicle) ClearPedTasksImmediately(playerPed) - ESX.ShowNotification('~g~Carosserie réparée') + ESX.ShowNotification(_U('body_repaired')) end) end end @@ -829,9 +829,9 @@ RegisterNetEvent('esx_mecanojob:onFixkit') AddEventHandler('esx_mecanojob:onFixkit', function() local playerPed = GetPlayerPed(-1) local coords = GetEntityCoords(playerPed) - + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - + local vehicle = nil if IsPedInAnyVehicle(playerPed, false) then @@ -839,7 +839,7 @@ AddEventHandler('esx_mecanojob:onFixkit', function() else vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) end - + if DoesEntityExist(vehicle) then TaskStartScenarioInPlace(playerPed, "PROP_HUMAN_BUM_BIN", 0, true) Citizen.CreateThread(function() @@ -848,7 +848,7 @@ AddEventHandler('esx_mecanojob:onFixkit', function() SetVehicleDeformationFixed(vehicle) SetVehicleUndriveable(vehicle, false) ClearPedTasksImmediately(playerPed) - ESX.ShowNotification('~g~Véhicule réparé') + ESX.ShowNotification(_U('veh_repaired')) end) end end @@ -880,39 +880,39 @@ AddEventHandler('esx:setJob', function(job) end) AddEventHandler('esx_mecanojob:hasEnteredMarker', function(zone) - + if zone == NPCJobTargetTowable then end if zone == 'MecanoActions' then CurrentAction = 'mecano_actions_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu.' + CurrentActionMsg = _U('open_actions') CurrentActionData = {} end - + if zone == 'Garage' then CurrentAction = 'mecano_harvest_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu de récolte.' + CurrentActionMsg = _U('harvest_menu') CurrentActionData = {} end - + if zone == 'Craft' then CurrentAction = 'mecano_craft_menu' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu établi.' + CurrentActionMsg = _U('craft_menu') CurrentActionData = {} end - + if zone == 'VehicleDeleter' then - + local playerPed = GetPlayerPed(-1) - + if IsPedInAnyVehicle(playerPed, false) then local vehicle = GetVehiclePedIsIn(playerPed, false) CurrentAction = 'delete_vehicle' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule.' + CurrentActionMsg = _U('veh_stored') CurrentActionData = {vehicle = vehicle} end end @@ -943,7 +943,7 @@ AddEventHandler('esx_mecanojob:hasEnteredEntityZone', function(entity) if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' and not IsPedInAnyVehicle(playerPed, false) then CurrentAction = 'remove_entity' - CurrentActionMsg = 'Appuyez sur ~INPUT_CONTEXT~ pour enlever l\'objet' + CurrentActionMsg = _U('press_remove_obj') CurrentActionData = {entity = entity} end @@ -960,7 +960,7 @@ end) RegisterNetEvent('esx_phone:loaded') AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) local specialContact = { - name = 'Mecano', + name = _U('mechanic'), number = 'mecano', 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' } @@ -970,9 +970,9 @@ end) -- Pop NPC mission vehicle when inside area Citizen.CreateThread(function() while true do - + Wait(0) - + if NPCTargetTowableZone ~= nil and not NPCHasSpawnedTowable then local coords = GetEntityCoords(GetPlayerPed(-1)) @@ -998,7 +998,7 @@ Citizen.CreateThread(function() local zone = Config.Zones[NPCTargetTowableZone] if(GetDistanceBetweenCoords(coords, zone.Pos.x, zone.Pos.y, zone.Pos.z, true) < Config.NPCNextToDistance) then - ESX.ShowNotification('Veuillez ~y~remorquer~s~ le véhicule') + ESX.ShowNotification(_U('please_tow')) NPCHasBeenNextToTowable = true end @@ -1008,7 +1008,7 @@ Citizen.CreateThread(function() end) -- Create Blips -Citizen.CreateThread(function() +Citizen.CreateThread(function() local blip = AddBlipForCoord(Config.Zones.MecanoActions.Pos.x, Config.Zones.MecanoActions.Pos.y, Config.Zones.MecanoActions.Pos.z) SetBlipSprite (blip, 446) SetBlipDisplay(blip, 4) @@ -1016,18 +1016,18 @@ Citizen.CreateThread(function() SetBlipColour (blip, 5) SetBlipAsShortRange(blip, true) BeginTextCommandSetBlipName("STRING") - AddTextComponentString("Mecano") + AddTextComponentString(_U('mechanic')) EndTextCommandSetBlipName(blip) end) -- Display markers Citizen.CreateThread(function() - while true do - Wait(0) + while true do + Wait(0) if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then local coords = GetEntityCoords(GetPlayerPed(-1)) - + for k,v in pairs(Config.Zones) do if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 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, false, true, 2, false, false, false, false) @@ -1103,34 +1103,34 @@ Citizen.CreateThread(function() Citizen.Wait(0) if CurrentAction ~= nil then - + SetTextComponentFormat('STRING') AddTextComponentString(CurrentActionMsg) DisplayHelpTextFromStringLabel(0, 0, 1, -1) - - if IsControlJustReleased(0, 38) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - + + if IsControlJustReleased(0, 38) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + if CurrentAction == 'mecano_actions_menu' then OpenMecanoActionsMenu() end - + if CurrentAction == 'mecano_harvest_menu' then OpenMecanoHarvestMenu() end - + if CurrentAction == 'mecano_craft_menu' then OpenMecanoCraftMenu() end - + if CurrentAction == 'delete_vehicle' then - + if Config.EnableSocietyOwnedVehicles then - + local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) TriggerServerEvent('esx_society:putVehicleInGarage', 'mecano', vehicleProps) - + else - + if GetEntityModel(vehicle) == GetHashKey('flatbed') or GetEntityModel(vehicle) == GetHashKey('towtrcuk2') or @@ -1143,12 +1143,12 @@ Citizen.CreateThread(function() ESX.Game.DeleteVehicle(CurrentActionData.vehicle) end - + if CurrentAction == 'remove_entity' then DeleteEntity(CurrentActionData.entity) end - CurrentAction = nil + CurrentAction = nil end end @@ -1164,7 +1164,7 @@ Citizen.CreateThread(function() StopNPCJob(true) NPCLastCancel = GetGameTimer() else - ESX.ShowNotification('Vous devez ~r~attendre~s~ 5 minutes') + ESX.ShowNotification(_U('wait_five')) end else @@ -1174,7 +1174,7 @@ Citizen.CreateThread(function() if IsPedInAnyVehicle(playerPed, false) and IsVehicleModel(GetVehiclePedIsIn(playerPed, false), GetHashKey("flatbed")) then StartNPCJob() else - ESX.ShowNotification('Vous devez être en flatbed pour commencer la mission') + ESX.ShowNotification(_U('must_in_flatbed')) end end @@ -1182,4 +1182,4 @@ Citizen.CreateThread(function() end end -end) \ No newline at end of file +end) diff --git a/config.lua b/config.lua index 37dcd195..208219ec 100644 --- a/config.lua +++ b/config.lua @@ -6,6 +6,7 @@ Config.EnableSocietyOwnedVehicles = false Config.NPCSpawnDistance = 500.0 Config.NPCNextToDistance = 25.0 Config.NPCJobEarnings = {min = 15, max = 40} +Config.Locale = 'fr' Config.Zones = { diff --git a/locales/en.lua b/locales/en.lua new file mode 100644 index 00000000..689d72eb --- /dev/null +++ b/locales/en.lua @@ -0,0 +1,83 @@ +Locales['en'] = { + + ['mechanic'] = 'mechanic', + ['drive_to_indicated'] = '~y~Drive~s~ to the indicated location.', + ['mission_canceled'] = 'Mission ~r~canceled~s~', + ['vehicle_list'] = 'vehicle List', + ['work_wear'] = 'workwear', + ['civ_wear'] = 'civilian clothes', + ['deposit_stock'] = 'deposit Stock', + ['withdraw_stock'] = 'withdraw Stock', + ['boss_actions'] = 'boss Actions', + ['service_vehicle'] = 'service Vehicle', + ['flat_bed'] = 'flatbed', + ['tow_truck'] = 'tow Truck', + ['service_full'] = 'service full: ', + ['open_actions'] = 'Press ~INPUT_CONTEXT~ to access the menu.', + ['harvest'] = 'harvest', + ['harvest_menu'] = 'press ~INPUT_CONTEXT~ to access the harvest menu.', + ['not_experienced_enough'] = 'you are not ~r~experienced enough~s~ to perform this action.' + ['gas_can'] = 'gas Can', + ['repair_tools'] = 'repair Tools', + ['body_work_tools'] = 'bodywork Tools', + ['blowtorch'] = 'blowtorch', + ['repair_kit'] = 'repair Kit', + ['body_kit'] = 'body Kit', + ['craft'] = 'craft', + ['craft_menu'] = 'press ~INPUT_CONTEXT~ to access the crafting menu.' + ['billing'] = 'billing', + ['hijack'] = 'hijack', + ['repair'] = 'repair', + ['clean'] = 'clean', + ['imp_veh'] = 'impound', + ['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!', + ['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', + ['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', + ['objects'] = 'objects', + ['roadcone'] = 'roadcone', + ['toolbox'] = 'toolbox', + ['mechanic_stock'] = 'mechanic Stock', + ['quantity'] = 'quantity', + ['invalid_quantity'] = 'invalid quantity', + ['inventory'] = 'inventory', + ['veh_unlocked'] = '~g~Vehicle Unlocked', + ['hijack_failed'] = '~r~Hijack Failed', + ['body_repaired'] = '~g~Body repaired', + ['veh_repaired'] = '~g~Vehicle Repaired', + ['veh_stored'] = 'press ~INPUT_CONTEXT~ to store the vehicle.', + ['press_remove_obj'] = 'press ~INPUT_CONTEXT~ to remove the object', + ['please_tow'] = 'please ~y~tow~s~ the vehicle', + ['wait_five'] = 'you must ~r~wait~s~ 5 mintes', + ['must_in_flatbed'] = 'you must be in a flatbed to being the mission', + ['mechanic_customer'] = 'mechanic Customer', + ['you_do_not_room'] = '~r~You do not have more room', + ['recovery_gas_can'] = '~b~Gas Can~s~ Retrieval...', + ['recovery_repair_tools'] = '~b~Repair Tools~s~ Retrieval...', + ['recovery_body_tools'] = '~b~Body Tools~s~ Retrieval...', + ['not_enough_gas_can'] = 'You do not ~r~have enough~s~ gas cans.', + ['assembling_blowtorch'] = 'Assembling ~b~Blowtorch~s~...', + ['not_enough_repair_tools'] = 'You do not ~r~have enough~s~ repair tools.', + ['assembling_repair_kit'] = 'Assembling ~b~Repair Kit~s~...', + ['not_enough_body_tools'] = 'You do not ~r~have enough~s~ body tools.', + ['assembling_body_kit'] = 'Assembling ~b~Body Kit~s~...', + ['your_comp_earned'] = 'your company has ~g~earned~s~ ~g~$', + ['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', +} diff --git a/locales/fr.lua b/locales/fr.lua new file mode 100644 index 00000000..a5651c83 --- /dev/null +++ b/locales/fr.lua @@ -0,0 +1,83 @@ +Locales['fr'] = { + + ['mechanic'] = 'mecano', + ['drive_to_indicated'] = '~y~Conduisez~s~ jusqu\'à l\'endroit indiqué', + ['mission_canceled'] = 'Mission ~r~annulée~s~', + ['vehicle_list'] = 'sortir Véhicule', + ['work_wear'] = 'tenue de travail', + ['civ_wear'] = 'Tenue civile', + ['deposit_stock'] = 'Déposer Stock', + ['withdraw_stock'] = 'Prendre Stock', + ['boss_actions'] = 'action Patron', + ['service_vehicle'] = 'Véhicule de service', + ['flat_bed'] = 'plateau', + ['tow_truck'] = 'dépaneuse', + ['service_full'] = 'service complet : ', + ['open_actions'] = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu.', + ['harvest'] = 'récolte', + ['harvest_menu'] = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu de récolte.', + ['not_experienced_enough'] = 'Vous n\'êtes ~r~pas assez expérimenté~s~ pour effectuer cette action.', + ['gas_can'] = 'Bouteille de gaz', + ['repair_tools'] = 'Outils réparation', + ['body_work_tools'] = 'Outils Carosserie', + ['blowtorch'] = 'chalumeaux', + ['repair_kit'] = 'kit Réparation', + ['body_kit'] = 'kit Carosserie', + ['craft'] = 'etabli', + ['craft_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder au menu établi.', + ['billing'] = 'facturation', + ['hijack'] = 'crocheter', + ['repair'] = 'réparer', + ['clean'] = 'nettoyer', + ['impound'] = 'fourrière', + ['place_objects'] = 'placer objets', + ['invoice_amount'] = 'montant de la facture', + ['amount_invalid'] = 'montant invalide', + ['no_players_nearby'] = 'aucun joueur à proximité', + ['vehicle_unlocked'] = 'véhicule ~g~déverouillé', + ['vehicle_repaired'] = 'véhicule ~g~réparé', + ['vehicle_cleaned'] = 'véhicule ~g~néttoyé', + ['vehicle_impounded'] = 'vehicule ~r~mis en fourrière', + ['must_seat_driver'] = 'vous devez être assis du ~r~côté conducteur!', + ['must_near'] = 'vous devez être ~r~près d\'un véhicule~s~ pour le mettre en fourrière', + ['vehicle_success_attached'] = 'vehicule ~b~attaché~s~ avec succès!', + ['please_drop_off'] = 'veuillez déposer le véhicule à la concession', + ['cant_attach_own_tt'] = '~r~Impossible~s~ d\'attacher votre propre dépanneuse', + ['no_veh_att'] = 'il n\'y a ~r~pas de véhicule~s~ à attacher', + ['not_right_veh'] = 'ce n\'est pas le bon véhicule', + ['veh_det_succ'] = 'vehicule ~b~détattaché~s~ avec succès!', + ['imp_flatbed'] = '~r~Impossible! ~s~Vous devez avoir un ~b~Flatbed ~s~pour ça', + ['objects'] = 'objets', + ['roadcone'] = 'plot', + ['toolbox'] = 'boîte à outils', + ['mechanic_stock'] = 'mecano Stock', + ['quantity'] = 'quantité', + ['invalid_quantity'] = 'quantité invalide', + ['inventory'] = 'inventaire', + ['veh_unlocked'] = '~g~Véhicule déverouillé', + ['hijack_failed'] = '~r~Crochetage raté', + ['body_repaired'] = '~g~Carosserie réparée', + ['veh_repaired'] = '~g~Véhicule réparé', + ['veh_stored'] = 'appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule.', + ['press_remove_obj'] = 'appuyez sur ~INPUT_CONTEXT~ pour enlever l\'object', + ['please_tow'] = 'veuillez ~y~remorquer~s~ le véhicule', + ['wait_five'] = 'Vous devez ~r~attendre~s~ 5 minutes', + ['must_in_flatbed'] = 'Vous devez être en flatbed pour commencer la mission', + ['mechanic_customer'] = 'client mecano', + ['you_do_not_room'] = '~r~Vous n\'avez plus de place', + ['recovery_gas_can'] = 'Récupération de ~b~bouteille de gaz~s~...', + ['recovery_repair_tools'] = 'Récupération d\'~b~Outils réparation~s~...', + ['recovery_body_tools'] = 'Récupération d\'~b~Outils carosserie~s~...', + ['not_enough_gas_can'] = 'Vous n\'avez ~r~pas assez~s~ de bouteille de gaz', + ['assembling_blowtorch'] = 'Assemblage de ~b~Chalumeaux~s~...', + ['not_enough_repair_tools'] = 'Vous n\'avez ~r~pas assez~s~ d\'outils réparation', + ['assembling_blowtorch'] = 'Assemblage de ~b~Kit réparation~s~...', + ['not_enough_body_tools'] = 'Vous n\'avez ~r~pas assez~s~ d\'outils carosserie', + ['assembling_body_kit'] = 'Assemblage de ~b~kit carosserie~s~...', + ['your_comp_earned'] = 'Votre société a ~g~gagné~s~ ~g~$', + ['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', +} diff --git a/localization/esx_mecanojob_en.sql b/localization/esx_mecanojob_en.sql new file mode 100644 index 00000000..66571646 --- /dev/null +++ b/localization/esx_mecanojob_en.sql @@ -0,0 +1,30 @@ +USE `essentialmode`; + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_mecano','Mechanic',1) +; + +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_mecano','Mechanic',1) +; + +INSERT INTO `jobs` (name, label) VALUES + ('mecano','Mechanic') +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('mecano',0,'recrue','Recruit',12,'{}','{}'), + ('mecano',1,'novice','Novice',24,'{}','{}'), + ('mecano',2,'experimente','Experienced',36,'{}','{}'), + ('mecano',3,'chief','Leader',48,'{}','{}'), + ('mecano',4,'boss','Boss',0,'{}','{}') +; + +INSERT INTO `items` (name, label) VALUES + ('gazbottle', 'Gas Bottle'), + ('fixtool', 'Repair Tools'), + ('carotool', 'Tools'), + ('blowpipe', 'Blowtorch'), + ('fixkit', 'Repair Kit'), + ('carokit', 'Body Kit') +; diff --git a/server/main.lua b/server/main.lua index bf14b2a9..ba9b0747 100644 --- a/server/main.lua +++ b/server/main.lua @@ -12,7 +12,7 @@ if Config.MaxInService ~= -1 then TriggerEvent('esx_service:activateService', 'mecano', Config.MaxInService) end -TriggerEvent('esx_phone:registerNumber', 'mecano', 'Client mecano', true, true) +TriggerEvent('esx_phone:registerNumber', 'mecano', _U('mechanic_customer'), true, true) -------------- Récupération bouteille de gaz ------------- ---- Sqlut je teste ------ @@ -26,10 +26,10 @@ local function Harvest(source) local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count if GazBottleQuantity >= 5 then - TriggerClientEvent('esx:showNotification', source, '~r~Vous n\'avez plus de place') - else + TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) + else xPlayer.addInventoryItem('gazbottle', 1) - + Harvest(source) end end @@ -40,7 +40,7 @@ RegisterServerEvent('esx_mecanojob:startHarvest') AddEventHandler('esx_mecanojob:startHarvest', function() local _source = source PlayersHarvesting[_source] = true - TriggerClientEvent('esx:showNotification', _source, 'Récupération de ~b~bouteille de gaz~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('recovery_gas_can')) Harvest(source) end) @@ -59,10 +59,10 @@ local function Harvest2(source) local xPlayer = ESX.GetPlayerFromId(source) local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count if FixToolQuantity >= 5 then - TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez ~r~plus de place') + TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) else xPlayer.addInventoryItem('fixtool', 1) - + Harvest2(source) end end @@ -73,7 +73,7 @@ RegisterServerEvent('esx_mecanojob:startHarvest2') AddEventHandler('esx_mecanojob:startHarvest2', function() local _source = source PlayersHarvesting2[_source] = true - TriggerClientEvent('esx:showNotification', _source, 'Récupération d\'~b~Outils réparation~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('recovery_repair_tools')) Harvest2(_source) end) @@ -92,10 +92,10 @@ local function Harvest3(source) local xPlayer = ESX.GetPlayerFromId(source) local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count if CaroToolQuantity >= 5 then - TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez ~r~plus de place') + TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) else xPlayer.addInventoryItem('carotool', 1) - + Harvest3(source) end end @@ -106,7 +106,7 @@ RegisterServerEvent('esx_mecanojob:startHarvest3') AddEventHandler('esx_mecanojob:startHarvest3', function() local _source = source PlayersHarvesting3[_source] = true - TriggerClientEvent('esx:showNotification', _source, 'Récupération d\'~b~Outils carosserie~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('recovery_body_tools')) Harvest3(_source) end) @@ -126,11 +126,11 @@ local function Craft(source) local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count if GazBottleQuantity <= 0 then - TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez ~r~pas assez~s~ de bouteille de gaz') - else + TriggerClientEvent('esx:showNotification', source, _U('not_enough_gas_can')) + else xPlayer.removeInventoryItem('gazbottle', 1) xPlayer.addInventoryItem('blowpipe', 1) - + Craft(source) end end @@ -141,7 +141,7 @@ RegisterServerEvent('esx_mecanojob:startCraft') AddEventHandler('esx_mecanojob:startCraft', function() local _source = source PlayersCrafting[_source] = true - TriggerClientEvent('esx:showNotification', _source, 'Assemblage de ~b~Chalumeaux~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('assembling_blowtorch')) Craft(_source) end) @@ -160,11 +160,11 @@ local function Craft2(source) local xPlayer = ESX.GetPlayerFromId(source) local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count if FixToolQuantity <= 0 then - TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez ~r~pas assez~s~ d\'outils réparation') + TriggerClientEvent('esx:showNotification', source, _U('not_enough_repair_tools')) else xPlayer.removeInventoryItem('fixtool', 1) xPlayer.addInventoryItem('fixkit', 1) - + Craft2(source) end end @@ -175,7 +175,7 @@ RegisterServerEvent('esx_mecanojob:startCraft2') AddEventHandler('esx_mecanojob:startCraft2', function() local _source = source PlayersCrafting2[_source] = true - TriggerClientEvent('esx:showNotification', _source, 'Assemblage de ~b~Kit réparation~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('assembling_blowtorch')) Craft2(_source) end) @@ -194,11 +194,11 @@ local function Craft3(source) local xPlayer = ESX.GetPlayerFromId(source) local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count if CaroToolQuantity <= 0 then - TriggerClientEvent('esx:showNotification', source, 'Vous n\'avez ~r~pas assez~s~ d\'outils carosserie') + TriggerClientEvent('esx:showNotification', source, _U('not_enough_body_tools')) else xPlayer.removeInventoryItem('carotool', 1) xPlayer.addInventoryItem('carokit', 1) - + Craft3(source) end end @@ -209,7 +209,7 @@ RegisterServerEvent('esx_mecanojob:startCraft3') AddEventHandler('esx_mecanojob:startCraft3', function() local _source = source PlayersCrafting3[_source] = true - TriggerClientEvent('esx:showNotification', _source, 'Assemblage de ~b~kit carosserie~s~...') + TriggerClientEvent('esx:showNotification', _source, _U('assembling_body_kit')) Craft3(_source) end) @@ -235,8 +235,8 @@ AddEventHandler('esx_mecanojob:onNPCJobMissionCompleted', function() TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mecano', function(account) account.addMoney(total) end) - - TriggerClientEvent("esx:showNotification", _source, "Votre société a ~g~gagné~s~ ~g~$".. total) + + TriggerClientEvent("esx:showNotification", _source, _U('your_comp_earned').. total) end) @@ -249,7 +249,7 @@ ESX.RegisterUsableItem('blowpipe', function(source) xPlayer.removeInventoryItem('blowpipe', 1) TriggerClientEvent('esx_mecanojob:onHijack', _source) - TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé un ~b~Chalumeau') + TriggerClientEvent('esx:showNotification', _source, _U('you_used_blowtorch')) end) @@ -261,7 +261,7 @@ ESX.RegisterUsableItem('fixkit', function(source) xPlayer.removeInventoryItem('fixkit', 1) TriggerClientEvent('esx_mecanojob:onFixkit', _source) - TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé un ~b~Kit de réparation') + TriggerClientEvent('esx:showNotification', _source, _U('you_used_repair_kit')) end) @@ -273,7 +273,7 @@ ESX.RegisterUsableItem('carokit', function(source) xPlayer.removeInventoryItem('carokit', 1) TriggerClientEvent('esx_mecanojob:onCarokit', _source) - TriggerClientEvent('esx:showNotification', _source, 'Vous avez utilisé un ~b~Kit de carosserie') + TriggerClientEvent('esx:showNotification', _source, _U('you_used_body_kit')) end) @@ -294,10 +294,10 @@ AddEventHandler('esx_mecanojob:getStockItem', function(itemName, count) inventory.removeItem(itemName, count) xPlayer.addInventoryItem(itemName, count) else - TriggerClientEvent('esx:showNotification', xPlayer.source, 'Quantité invalide') + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity')) end - TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez retiré x' .. count .. ' ' .. item.label) + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('you_removed') .. count .. ' ' .. item.label) end) @@ -328,10 +328,10 @@ AddEventHandler('esx_mecanojob:putStockItems', function(itemName, count) xPlayer.removeInventoryItem(itemName, count) inventory.addItem(itemName, count) else - TriggerClientEvent('esx:showNotification', xPlayer.source, 'Quantité invalide') + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity')) end - TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez ajouté x' .. count .. ' ' .. item.label) + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('you_added') .. count .. ' ' .. item.label) end) @@ -354,4 +354,4 @@ ESX.RegisterServerCallback('esx_mecanojob:getPlayerInventory', function(source, items = items }) -end) \ No newline at end of file +end) From a84901970279ce31d32804098c00c3368ccf1baa Mon Sep 17 00:00:00 2001 From: Don <30905704+ddh3@users.noreply.github.com> Date: Tue, 12 Sep 2017 13:00:24 -0700 Subject: [PATCH 19/66] fixed missing commas fixed missing commas --- locales/en.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locales/en.lua b/locales/en.lua index 689d72eb..82846444 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -16,7 +16,7 @@ Locales['en'] = { ['open_actions'] = 'Press ~INPUT_CONTEXT~ to access the menu.', ['harvest'] = 'harvest', ['harvest_menu'] = 'press ~INPUT_CONTEXT~ to access the harvest menu.', - ['not_experienced_enough'] = 'you are not ~r~experienced enough~s~ to perform this action.' + ['not_experienced_enough'] = 'you are not ~r~experienced enough~s~ to perform this action.', ['gas_can'] = 'gas Can', ['repair_tools'] = 'repair Tools', ['body_work_tools'] = 'bodywork Tools', @@ -24,7 +24,7 @@ Locales['en'] = { ['repair_kit'] = 'repair Kit', ['body_kit'] = 'body Kit', ['craft'] = 'craft', - ['craft_menu'] = 'press ~INPUT_CONTEXT~ to access the crafting menu.' + ['craft_menu'] = 'press ~INPUT_CONTEXT~ to access the crafting menu.', ['billing'] = 'billing', ['hijack'] = 'hijack', ['repair'] = 'repair', From e5d22d61a8baa3e1e9010350d5fcd4aa362e0f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Wed, 13 Sep 2017 14:43:33 +0200 Subject: [PATCH 20/66] Use new esx_society --- server/main.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/server/main.lua b/server/main.lua index ba9b0747..f7681785 100644 --- a/server/main.lua +++ b/server/main.lua @@ -13,6 +13,7 @@ if Config.MaxInService ~= -1 then end TriggerEvent('esx_phone:registerNumber', 'mecano', _U('mechanic_customer'), true, true) +TriggerEvent('esx_society:registerSociety', 'mecano', 'Mecano', 'society_mecano', 'society_mecano', 'society_mecano', {type = 'private'}) -------------- Récupération bouteille de gaz ------------- ---- Sqlut je teste ------ From f9cd4f7ebcb680021bde868aa66ae14609d65b52 Mon Sep 17 00:00:00 2001 From: Romain Lanz Date: Thu, 14 Sep 2017 18:04:21 +0200 Subject: [PATCH 21/66] chore(coding-style): correct indentation --- .editorconfig | 9 + __resource.lua | 20 +- client/main.lua | 1495 +++++++++++++++-------------- config.lua | 180 ++-- esx_mecanojob.sql | 14 +- locales/en.lua | 161 ++-- locales/fr.lua | 161 ++-- localization/esx_mecanojob_en.sql | 12 +- server/main.lua | 302 +++--- 9 files changed, 1179 insertions(+), 1175 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..41c2aaf2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_size = 2 +indent_style = space +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true \ No newline at end of file diff --git a/__resource.lua b/__resource.lua index ed54f8fb..fd64bbc2 100644 --- a/__resource.lua +++ b/__resource.lua @@ -3,17 +3,17 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Mecano Job' client_scripts { - '@es_extended/locale.lua', - 'locales/en.lua', - 'locales/fr.lua', - 'config.lua', - 'client/main.lua' + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'config.lua', + 'client/main.lua' } server_scripts { - '@es_extended/locale.lua', - 'locales/en.lua', - 'locales/fr.lua', - 'config.lua', - 'server/main.lua' + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'config.lua', + 'server/main.lua' } diff --git a/client/main.lua b/client/main.lua index 5b9cd4ad..9fb72829 100644 --- a/client/main.lua +++ b/client/main.lua @@ -10,10 +10,8 @@ local Keys = { ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 } -ESX = nil local PlayerData = {} local GUI = {} -GUI.Time = 0 local HasAlreadyEnteredMarker = false local LastZone = nil local CurrentAction = nil @@ -30,11 +28,14 @@ local NPCHasSpawnedTowable = false local NPCLastCancel = GetGameTimer() - 5 * 60000 local NPCHasBeenNextToTowable = false +ESX = nil +GUI.Time = 0 + Citizen.CreateThread(function() - while ESX == nil do - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) - end + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end end) function SelectRandomTowable() @@ -81,7 +82,7 @@ function StopNPCJob(cancel) NPCTargetTowable = nil NPCTargetTowableZone = nil NPCHasSpawnedTowable = false - NPCHasBeenNextToTowable = false + NPCHasBeenNextToTowable = false if cancel then ESX.ShowNotification(_U('mission_canceled')) @@ -93,604 +94,604 @@ 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('withdraw_stock'), value = 'get_stock'} - } - if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name == 'boss' then - table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) - end + 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('withdraw_stock'), value = 'get_stock'} + } + if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name == 'boss' then + table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) + end - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mecano_actions', - { - title = _U('mechanic'), - elements = elements - }, - function(data, menu) - if data.current.value == 'vehicle_list' then + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mecano_actions', + { + title = _U('mechanic'), + elements = elements + }, + function(data, menu) + if data.current.value == 'vehicle_list' then - if Config.EnableSocietyOwnedVehicles then + if Config.EnableSocietyOwnedVehicles then - local elements = {} + local elements = {} - ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) + ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) - for i=1, #vehicles, 1 do - table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) - end + for i=1, #vehicles, 1 do + table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) + end - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'vehicle_spawner', - { - title = _U('service_vehicle'), - align = 'top-left', - elements = elements, - }, - function(data, menu) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'vehicle_spawner', + { + title = _U('service_vehicle'), + align = 'top-left', + elements = elements, + }, + function(data, menu) - menu.close() + menu.close() - local vehicleProps = data.current.value + local vehicleProps = data.current.value - ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) - ESX.Game.SetVehicleProperties(vehicle, vehicleProps) - local playerPed = GetPlayerPed(-1) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) + ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) + ESX.Game.SetVehicleProperties(vehicle, vehicleProps) + local playerPed = GetPlayerPed(-1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) - TriggerServerEvent('esx_society:removeVehicleFromGarage', 'mecano', vehicleProps) + TriggerServerEvent('esx_society:removeVehicleFromGarage', 'mecano', vehicleProps) - end, - function(data, menu) - menu.close() - end - ) + end, + function(data, menu) + menu.close() + end + ) - end, 'mecano') + end, 'mecano') - else + else - local elements = { - {label = _U('flat_bed'), value = 'flatbed'}, - {label = _U('tow_truck'), value = 'towtruck2'} - } + local elements = { + {label = _U('flat_bed'), value = 'flatbed'}, + {label = _U('tow_truck'), value = 'towtruck2'} + } - if Config.EnablePlayerManagement and PlayerData.job ~= nil and - (PlayerData.job.grade_name == 'boss' or PlayerData.job.grade_name == 'chef' or PlayerData.job.grade_name == 'experimente') then - table.insert(elements, {label = 'SlamVan', value = 'slamvan3'}) - end + if Config.EnablePlayerManagement and PlayerData.job ~= nil and + (PlayerData.job.grade_name == 'boss' or PlayerData.job.grade_name == 'chef' or PlayerData.job.grade_name == 'experimente') then + table.insert(elements, {label = 'SlamVan', value = 'slamvan3'}) + end - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'spawn_vehicle', - { - title = _U('service_vehicle'), - elements = elements - }, - function(data, menu) - for i=1, #elements, 1 do - if Config.MaxInService == -1 then - ESX.Game.SpawnVehicle(data.current.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle) - local playerPed = GetPlayerPed(-1) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - break - else - ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount) - if canTakeService then - ESX.Game.SpawnVehicle(data.current.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle) - local playerPed = GetPlayerPed(-1) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - else - ESX.ShowNotification(_U('service_full') .. inServiceCount .. '/' .. maxInService) - end - end, 'mecano') - break - end - end - menu.close() - end, - function(data, menu) - menu.close() - OpenMecanoActionsMenu() - end - ) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'spawn_vehicle', + { + title = _U('service_vehicle'), + elements = elements + }, + function(data, menu) + for i=1, #elements, 1 do + if Config.MaxInService == -1 then + ESX.Game.SpawnVehicle(data.current.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle) + local playerPed = GetPlayerPed(-1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + break + else + ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount) + if canTakeService then + ESX.Game.SpawnVehicle(data.current.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle) + local playerPed = GetPlayerPed(-1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + else + ESX.ShowNotification(_U('service_full') .. inServiceCount .. '/' .. maxInService) + end + end, 'mecano') + break + end + end + menu.close() + end, + function(data, menu) + menu.close() + OpenMecanoActionsMenu() + end + ) - end - end + end + end - if data.current.value == 'cloakroom' then - menu.close() - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + if data.current.value == 'cloakroom' then + menu.close() + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) - if skin.sex == 0 then - TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) - else - TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) - end + if skin.sex == 0 then + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) + else + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) + end - end) - end + end) + end - if data.current.value == 'cloakroom2' then - menu.close() - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + if data.current.value == 'cloakroom2' then + menu.close() + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) - TriggerEvent('skinchanger:loadSkin', skin) + TriggerEvent('skinchanger:loadSkin', skin) - end) - end + end) + end - if data.current.value == 'put_stock' then - OpenPutStocksMenu() - end + if data.current.value == 'put_stock' then + OpenPutStocksMenu() + end - if data.current.value == 'get_stock' then - OpenGetStocksMenu() - end + if data.current.value == 'get_stock' then + OpenGetStocksMenu() + end - if data.current.value == 'boss_actions' then - TriggerEvent('esx_society:openBossMenu', 'mecano', function(data, menu) - menu.close() - end) - end + if data.current.value == 'boss_actions' then + TriggerEvent('esx_society:openBossMenu', 'mecano', function(data, menu) + menu.close() + end) + end - end, - function(data, menu) - menu.close() - CurrentAction = 'mecano_actions_menu' - CurrentActionMsg = _U('open_actions') - CurrentActionData = {} - end - ) + end, + function(data, menu) + menu.close() + CurrentAction = 'mecano_actions_menu' + CurrentActionMsg = _U('open_actions') + CurrentActionData = {} + end + ) end function OpenMecanoHarvestMenu() - if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then - local elements = { - {label = _U('gas_can'), value = 'gaz_bottle'}, - {label = _U('repair_tools'), value = 'fix_tool'}, - {label = _U('body_work_tools'), value = 'caro_tool'} - } + if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then + local elements = { + {label = _U('gas_can'), value = 'gaz_bottle'}, + {label = _U('repair_tools'), value = 'fix_tool'}, + {label = _U('body_work_tools'), value = 'caro_tool'} + } - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mecano_harvest', - { - title = _U('harvest'), - elements = elements - }, - function(data, menu) - if data.current.value == 'gaz_bottle' then - menu.close() - TriggerServerEvent('esx_mecanojob:startHarvest') - end + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mecano_harvest', + { + title = _U('harvest'), + elements = elements + }, + function(data, menu) + if data.current.value == 'gaz_bottle' then + menu.close() + TriggerServerEvent('esx_mecanojob:startHarvest') + end - if data.current.value == 'fix_tool' then - menu.close() - TriggerServerEvent('esx_mecanojob:startHarvest2') - end + if data.current.value == 'fix_tool' then + menu.close() + TriggerServerEvent('esx_mecanojob:startHarvest2') + end - if data.current.value == 'caro_tool' then - menu.close() - TriggerServerEvent('esx_mecanojob:startHarvest3') - end + if data.current.value == 'caro_tool' then + menu.close() + TriggerServerEvent('esx_mecanojob:startHarvest3') + end - end, - function(data, menu) - menu.close() - CurrentAction = 'mecano_harvest_menu' - CurrentActionMsg = _U('harvest_menu') - CurrentActionData = {} - end - ) - else - ESX.ShowNotification(_U('not_experienced_enough')) - end + end, + function(data, menu) + menu.close() + CurrentAction = 'mecano_harvest_menu' + CurrentActionMsg = _U('harvest_menu') + CurrentActionData = {} + end + ) + else + ESX.ShowNotification(_U('not_experienced_enough')) + end end function OpenMecanoCraftMenu() - if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then + if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then - local elements = { - {label = _U('blowtorch'), value = 'blow_pipe'}, - {label = _U('repair_kit'), value = 'fix_kit'}, - {label = _U('body_kit'), value = 'caro_kit'} - } + local elements = { + {label = _U('blowtorch'), value = 'blow_pipe'}, + {label = _U('repair_kit'), value = 'fix_kit'}, + {label = _U('body_kit'), value = 'caro_kit'} + } - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mecano_craft', - { - title = _U('craft'), - elements = elements - }, - function(data, menu) - if data.current.value == 'blow_pipe' then - menu.close() - TriggerServerEvent('esx_mecanojob:startCraft') - end + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mecano_craft', + { + title = _U('craft'), + elements = elements + }, + function(data, menu) + if data.current.value == 'blow_pipe' then + menu.close() + TriggerServerEvent('esx_mecanojob:startCraft') + end - if data.current.value == 'fix_kit' then - menu.close() - TriggerServerEvent('esx_mecanojob:startCraft2') - end + if data.current.value == 'fix_kit' then + menu.close() + TriggerServerEvent('esx_mecanojob:startCraft2') + end - if data.current.value == 'caro_kit' then - menu.close() - TriggerServerEvent('esx_mecanojob:startCraft3') - end + if data.current.value == 'caro_kit' then + menu.close() + TriggerServerEvent('esx_mecanojob:startCraft3') + end - end, - function(data, menu) - menu.close() - CurrentAction = 'mecano_craft_menu' - CurrentActionMsg = _U('craft_menu') - CurrentActionData = {} - end - ) - else - ESX.ShowNotification(_U('not_experienced_enough')) - end + end, + function(data, menu) + menu.close() + CurrentAction = 'mecano_craft_menu' + CurrentActionMsg = _U('craft_menu') + CurrentActionData = {} + end + ) + else + ESX.ShowNotification(_U('not_experienced_enough')) + end end function OpenMobileMecanoActionsMenu() - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mobile_mecano_actions', - { - title = _U('mechanic'), - elements = { - {label = _U('billing'), value = 'billing'}, - {label = _U('hijack'), value = 'hijack_vehicle'}, - {label = _U('repair'), value = 'fix_vehicle'}, - {label = _U('clean'), value = 'clean_vehicle'}, - {label = _U('imp_veh'), value = 'del_vehicle'}, - {label = _U('flat_bed'), value = 'dep_vehicle'}, - {label = _U('place_objects'), value = 'object_spawner'} - } - }, - function(data, menu) - if data.current.value == 'billing' then - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'billing', - { - title = _U('invoice_amount') - }, - function(data, menu) - local amount = tonumber(data.value) - if amount == nil 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 - TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mecano', _U('mechanic'), amount) - end - end - end, - function(data, menu) - menu.close() - end - ) - end + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mobile_mecano_actions', + { + title = _U('mechanic'), + elements = { + {label = _U('billing'), value = 'billing'}, + {label = _U('hijack'), value = 'hijack_vehicle'}, + {label = _U('repair'), value = 'fix_vehicle'}, + {label = _U('clean'), value = 'clean_vehicle'}, + {label = _U('imp_veh'), value = 'del_vehicle'}, + {label = _U('flat_bed'), value = 'dep_vehicle'}, + {label = _U('place_objects'), value = 'object_spawner'} + } + }, + function(data, menu) + if data.current.value == 'billing' then + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'billing', + { + title = _U('invoice_amount') + }, + function(data, menu) + local amount = tonumber(data.value) + if amount == nil 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 + TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mecano', _U('mechanic'), amount) + end + end + end, + function(data, menu) + menu.close() + end + ) + end - if data.current.value == 'hijack_vehicle' then + if data.current.value == 'hijack_vehicle' then - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - local vehicle = nil + local vehicle = nil - if IsPedInAnyVehicle(playerPed, false) then - vehicle = GetVehiclePedIsIn(playerPed, false) - else - vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) - 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_WELDING", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(10000) - SetVehicleDoorsLocked(vehicle, 1) - SetVehicleDoorsLockedForAllPlayers(vehicle, false) - ClearPedTasksImmediately(playerPed) - ESX.ShowNotification(_U('vehicle_unlocked')) - end) - end + 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 - end + end - end + end - if data.current.value == 'fix_vehicle' then + if data.current.value == 'fix_vehicle' then - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - local vehicle = nil + local vehicle = nil - if IsPedInAnyVehicle(playerPed, false) then - vehicle = GetVehiclePedIsIn(playerPed, false) - else - vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) - 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, "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 + 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 - if data.current.value == 'clean_vehicle' then + if data.current.value == 'clean_vehicle' then - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - local vehicle = nil + local vehicle = nil - if IsPedInAnyVehicle(playerPed, false) then - vehicle = GetVehiclePedIsIn(playerPed, false) - else - vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) - 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 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 + if data.current.value == 'del_vehicle' then - local ped = GetPlayerPed( -1 ) + local ped = GetPlayerPed( -1 ) - if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then - local pos = GetEntityCoords( ped ) + if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then + local pos = GetEntityCoords( ped ) - if ( IsPedSittingInAnyVehicle( ped ) ) then - local vehicle = GetVehiclePedIsIn( ped, false ) + if ( IsPedSittingInAnyVehicle( ped ) ) then + local vehicle = GetVehiclePedIsIn( ped, false ) - if ( GetPedInVehicleSeat( vehicle, -1 ) == ped ) then - ESX.ShowNotification(_U('vehicle_impounded')) - SetEntityAsMissionEntity( vehicle, true, true ) - deleteCar( vehicle ) - else - ESX.ShowNotification(_U('must_seat_driver')) - end - else - local playerPos = GetEntityCoords( ped, 1 ) - local inFrontOfPlayer = GetOffsetFromEntityInWorldCoords( ped, 0.0, distanceToCheck, 0.0 ) - local vehicle = GetVehicleInDirection( playerPos, inFrontOfPlayer ) + if ( GetPedInVehicleSeat( vehicle, -1 ) == ped ) then + ESX.ShowNotification(_U('vehicle_impounded')) + SetEntityAsMissionEntity( vehicle, true, true ) + deleteCar( vehicle ) + else + ESX.ShowNotification(_U('must_seat_driver')) + end + else + local playerPos = GetEntityCoords( ped, 1 ) + local inFrontOfPlayer = GetOffsetFromEntityInWorldCoords( ped, 0.0, distanceToCheck, 0.0 ) + local vehicle = GetVehicleInDirection( playerPos, inFrontOfPlayer ) - if ( DoesEntityExist( vehicle ) ) then - ESX.ShowNotification(_U('vehicle_impounded')) - SetEntityAsMissionEntity( vehicle, true, true ) - deleteCar( vehicle ) - else - ESX.ShowNotification(_U('must_near')) - end - end - end - end + if ( DoesEntityExist( vehicle ) ) then + ESX.ShowNotification(_U('vehicle_impounded')) + SetEntityAsMissionEntity( vehicle, true, true ) + deleteCar( vehicle ) + else + ESX.ShowNotification(_U('must_near')) + end + end + end + end - if data.current.value == 'dep_vehicle' then + if data.current.value == 'dep_vehicle' then - local playerped = GetPlayerPed(-1) - local vehicle = GetVehiclePedIsIn(playerped, true) + local playerped = GetPlayerPed(-1) + local vehicle = GetVehiclePedIsIn(playerped, true) - local towmodel = GetHashKey('flatbed') - local isVehicleTow = IsVehicleModel(vehicle, towmodel) + local towmodel = GetHashKey('flatbed') + local isVehicleTow = IsVehicleModel(vehicle, towmodel) - if isVehicleTow then + if isVehicleTow then - local coordA = GetEntityCoords(playerped, 1) - local coordB = GetOffsetFromEntityInWorldCoords(playerped, 0.0, 5.0, 0.0) - local targetVehicle = getVehicleInDirection(coordA, coordB) + local coordA = GetEntityCoords(playerped, 1) + local coordB = GetOffsetFromEntityInWorldCoords(playerped, 0.0, 5.0, 0.0) + local targetVehicle = getVehicleInDirection(coordA, coordB) - if CurrentlyTowedVehicle == nil then - if targetVehicle ~= 0 then - if not IsPedInAnyVehicle(playerped, true) then - if vehicle ~= targetVehicle then - AttachEntityToEntity(targetVehicle, vehicle, 20, -0.5, -5.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) - CurrentlyTowedVehicle = targetVehicle - ESX.ShowNotification(_U('vehicle_success_attached')) + if CurrentlyTowedVehicle == nil then + if targetVehicle ~= 0 then + if not IsPedInAnyVehicle(playerped, true) then + if vehicle ~= targetVehicle then + AttachEntityToEntity(targetVehicle, vehicle, 20, -0.5, -5.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) + CurrentlyTowedVehicle = targetVehicle + ESX.ShowNotification(_U('vehicle_success_attached')) - if NPCOnJob then + if NPCOnJob then - if NPCTargetTowable == targetVehicle then - ESX.ShowNotification(_U('please_drop_off')) + if NPCTargetTowable == targetVehicle then + ESX.ShowNotification(_U('please_drop_off')) - Config.Zones.VehicleDelivery.Type = 1 + Config.Zones.VehicleDelivery.Type = 1 - if Blips['NPCTargetTowableZone'] ~= nil then - RemoveBlip(Blips['NPCTargetTowableZone']) - Blips['NPCTargetTowableZone'] = nil - end + if Blips['NPCTargetTowableZone'] ~= nil then + RemoveBlip(Blips['NPCTargetTowableZone']) + Blips['NPCTargetTowableZone'] = nil + end - Blips['NPCDelivery'] = AddBlipForCoord(Config.Zones.VehicleDelivery.Pos.x, Config.Zones.VehicleDelivery.Pos.y, Config.Zones.VehicleDelivery.Pos.z) + Blips['NPCDelivery'] = AddBlipForCoord(Config.Zones.VehicleDelivery.Pos.x, Config.Zones.VehicleDelivery.Pos.y, Config.Zones.VehicleDelivery.Pos.z) - SetBlipRoute(Blips['NPCDelivery'], true) + SetBlipRoute(Blips['NPCDelivery'], true) - end + end - end + end - else - ESX.ShowNotification(_U('cant_attach_own_tt')) - end - end - else - ESX.ShowNotification(_U('no_veh_att')) - end - else + else + ESX.ShowNotification(_U('cant_attach_own_tt')) + end + end + else + ESX.ShowNotification(_U('no_veh_att')) + end + else - AttachEntityToEntity(CurrentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) - DetachEntity(CurrentlyTowedVehicle, true, true) + AttachEntityToEntity(CurrentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) + DetachEntity(CurrentlyTowedVehicle, true, true) - if NPCOnJob then + if NPCOnJob then - if CurrentlyTowedVehicle == NPCTargetTowable then - ESX.Game.DeleteVehicle(NPCTargetTowable) - TriggerServerEvent('esx_mecanojob:onNPCJobMissionCompleted') - StopNPCJob() + if CurrentlyTowedVehicle == NPCTargetTowable then + ESX.Game.DeleteVehicle(NPCTargetTowable) + TriggerServerEvent('esx_mecanojob:onNPCJobMissionCompleted') + StopNPCJob() - else - ESX.ShowNotification(_U('not_right_veh')) - end + else + ESX.ShowNotification(_U('not_right_veh')) + end - end + end - CurrentlyTowedVehicle = nil + CurrentlyTowedVehicle = nil - ESX.ShowNotification(_U('veh_det_succ')) - end - else - ESX.ShowNotification(_U('imp_flatbed')) - end - end + ESX.ShowNotification(_U('veh_det_succ')) + end + else + ESX.ShowNotification(_U('imp_flatbed')) + end + end - if data.current.value == 'object_spawner' then + if data.current.value == 'object_spawner' then - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mobile_mecano_actions_spawn', - { - title = _U('objects'), - align = 'top-left', - elements = { - {label = _U('roadcone'), value = 'prop_roadcone02a'}, - {label = _U('toolbox'), value = 'prop_toolchest_01'}, - }, - }, - function(data2, menu2) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'mobile_mecano_actions_spawn', + { + title = _U('objects'), + align = 'top-left', + elements = { + {label = _U('roadcone'), value = 'prop_roadcone02a'}, + {label = _U('toolbox'), value = 'prop_toolchest_01'}, + }, + }, + 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) + 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) - if model == 'prop_roadcone02a' then - z = z - 2.0 - elseif model == 'prop_toolchest_01' then - z = z - 2.0 - end + if model == 'prop_roadcone02a' then + z = z - 2.0 + elseif model == 'prop_toolchest_01' then + z = z - 2.0 + end - ESX.Game.SpawnObject(model, { - x = x, - y = y, - z = z - }, function(obj) - SetEntityHeading(obj, GetEntityHeading(playerPed)) - PlaceObjectOnGroundProperly(obj) - end) + ESX.Game.SpawnObject(model, { + x = x, + y = y, + z = z + }, function(obj) + SetEntityHeading(obj, GetEntityHeading(playerPed)) + PlaceObjectOnGroundProperly(obj) + end) - end, - function(data2, menu2) - menu2.close() - end - ) + end, + function(data2, menu2) + menu2.close() + end + ) - end + end - end, - function(data, menu) - menu.close() - end - ) + end, + function(data, menu) + menu.close() + end + ) end function OpenGetStocksMenu() - ESX.TriggerServerCallback('esx_mecanojob:getStockItems', function(items) + ESX.TriggerServerCallback('esx_mecanojob:getStockItems', function(items) - print(json.encode(items)) + print(json.encode(items)) - local elements = {} + local elements = {} - for i=1, #items, 1 do - table.insert(elements, {label = 'x' .. items[i].count .. ' ' .. items[i].label, value = items[i].name}) - end + for i=1, #items, 1 do + table.insert(elements, {label = 'x' .. items[i].count .. ' ' .. items[i].label, value = items[i].name}) + end - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'stocks_menu', - { - title = _U('mechanic_stock'), - elements = elements - }, - function(data, menu) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'stocks_menu', + { + title = _U('mechanic_stock'), + elements = elements + }, + function(data, menu) - local itemName = data.current.value + local itemName = data.current.value - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'stocks_menu_get_item_count', - { - title = _U('quantity') - }, - function(data2, menu2) + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'stocks_menu_get_item_count', + { + title = _U('quantity') + }, + function(data2, menu2) - local count = tonumber(data2.value) + local count = tonumber(data2.value) - if count == nil then - ESX.ShowNotification(_U('invalid_quantity')) - else - menu2.close() - menu.close() - OpenGetStocksMenu() + if count == nil then + ESX.ShowNotification(_U('invalid_quantity')) + else + menu2.close() + menu.close() + OpenGetStocksMenu() - TriggerServerEvent('esx_mecanojob:getStockItem', itemName, count) - end + TriggerServerEvent('esx_mecanojob:getStockItem', itemName, count) + end - end, - function(data2, menu2) - menu2.close() - end - ) + end, + function(data2, menu2) + menu2.close() + end + ) - end, - function(data, menu) - menu.close() - end - ) + end, + function(data, menu) + menu.close() + end + ) - end) + end) end @@ -698,160 +699,160 @@ function OpenPutStocksMenu() ESX.TriggerServerCallback('esx_mecanojob:getPlayerInventory', function(inventory) - local elements = {} + local elements = {} - for i=1, #inventory.items, 1 do + for i=1, #inventory.items, 1 do - local item = inventory.items[i] + local item = inventory.items[i] - if item.count > 0 then - table.insert(elements, {label = item.label .. ' x' .. item.count, type = 'item_standard', value = item.name}) - end + if item.count > 0 then + table.insert(elements, {label = item.label .. ' x' .. item.count, type = 'item_standard', value = item.name}) + end - end + end - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'stocks_menu', - { - title = _U('inventory'), - elements = elements - }, - function(data, menu) + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'stocks_menu', + { + title = _U('inventory'), + elements = elements + }, + function(data, menu) - local itemName = data.current.value + local itemName = data.current.value - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'stocks_menu_put_item_count', - { - title = _U('quantity') - }, - function(data2, menu2) + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'stocks_menu_put_item_count', + { + title = _U('quantity') + }, + function(data2, menu2) - local count = tonumber(data2.value) + local count = tonumber(data2.value) - if count == nil then - ESX.ShowNotification(_U('invalid_quantity')) - else - menu2.close() - menu.close() - OpenPutStocksMenu() + if count == nil then + ESX.ShowNotification(_U('invalid_quantity')) + else + menu2.close() + menu.close() + OpenPutStocksMenu() - TriggerServerEvent('esx_mecanojob:putStockItems', itemName, count) - end + TriggerServerEvent('esx_mecanojob:putStockItems', itemName, count) + end - end, - function(data2, menu2) - menu2.close() - end - ) + end, + function(data2, menu2) + menu2.close() + end + ) - end, - function(data, menu) - menu.close() - end - ) + end, + function(data, menu) + menu.close() + end + ) - end) + end) end RegisterNetEvent('esx_mecanojob:onHijack') AddEventHandler('esx_mecanojob:onHijack', function() - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - local vehicle = nil + local vehicle = nil - if IsPedInAnyVehicle(playerPed, false) then - vehicle = GetVehiclePedIsIn(playerPed, false) - else - vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) - end + if IsPedInAnyVehicle(playerPed, false) then + vehicle = GetVehiclePedIsIn(playerPed, false) + else + vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) + end - local crochete = math.random(100) - local alarm = math.random(100) + local crochete = math.random(100) + local alarm = math.random(100) - if DoesEntityExist(vehicle) then - if alarm <= 33 then - SetVehicleAlarm(vehicle, true) - StartVehicleAlarm(vehicle) - end - TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_WELDING", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(10000) - if crochete <= 66 then - SetVehicleDoorsLocked(vehicle, 1) - SetVehicleDoorsLockedForAllPlayers(vehicle, false) - ClearPedTasksImmediately(playerPed) - ESX.ShowNotification(_U('veh_unlocked')) - else - ESX.ShowNotification(_U('hijack_failed')) - ClearPedTasksImmediately(playerPed) - end - end) - end + if DoesEntityExist(vehicle) then + if alarm <= 33 then + SetVehicleAlarm(vehicle, true) + StartVehicleAlarm(vehicle) + end + TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_WELDING", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(10000) + if crochete <= 66 then + SetVehicleDoorsLocked(vehicle, 1) + SetVehicleDoorsLockedForAllPlayers(vehicle, false) + ClearPedTasksImmediately(playerPed) + ESX.ShowNotification(_U('veh_unlocked')) + else + ESX.ShowNotification(_U('hijack_failed')) + ClearPedTasksImmediately(playerPed) + end + end) + end - end + end end) RegisterNetEvent('esx_mecanojob:onCarokit') AddEventHandler('esx_mecanojob:onCarokit', function() - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - local vehicle = nil + local vehicle = nil - if IsPedInAnyVehicle(playerPed, false) then - vehicle = GetVehiclePedIsIn(playerPed, false) - else - vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) - 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_HAMMERING", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(10000) - SetVehicleFixed(vehicle) - SetVehicleDeformationFixed(vehicle) - ClearPedTasksImmediately(playerPed) - ESX.ShowNotification(_U('body_repaired')) - end) - end - end + if DoesEntityExist(vehicle) then + TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_HAMMERING", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(10000) + SetVehicleFixed(vehicle) + SetVehicleDeformationFixed(vehicle) + ClearPedTasksImmediately(playerPed) + ESX.ShowNotification(_U('body_repaired')) + end) + end + end end) RegisterNetEvent('esx_mecanojob:onFixkit') AddEventHandler('esx_mecanojob:onFixkit', function() - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - local vehicle = nil + local vehicle = nil - if IsPedInAnyVehicle(playerPed, false) then - vehicle = GetVehiclePedIsIn(playerPed, false) - else - vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) - 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, "PROP_HUMAN_BUM_BIN", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(20000) - SetVehicleFixed(vehicle) - SetVehicleDeformationFixed(vehicle) - SetVehicleUndriveable(vehicle, false) - ClearPedTasksImmediately(playerPed) - ESX.ShowNotification(_U('veh_repaired')) - end) - end - end + 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) + ClearPedTasksImmediately(playerPed) + ESX.ShowNotification(_U('veh_repaired')) + end) + end + end end) function setEntityHeadingFromEntity ( vehicle, playerPed ) @@ -860,9 +861,9 @@ function setEntityHeadingFromEntity ( vehicle, playerPed ) end function getVehicleInDirection(coordFrom, coordTo) - local rayHandle = CastRayPointToPoint(coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 10, GetPlayerPed(-1), 0) - local a, b, c, d, vehicle = GetRaycastResult(rayHandle) - return vehicle + local rayHandle = CastRayPointToPoint(coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 10, GetPlayerPed(-1), 0) + local a, b, c, d, vehicle = GetRaycastResult(rayHandle) + return vehicle end function deleteCar( entity ) @@ -871,100 +872,100 @@ end RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer) - PlayerData = xPlayer + PlayerData = xPlayer end) RegisterNetEvent('esx:setJob') AddEventHandler('esx:setJob', function(job) - PlayerData.job = job + PlayerData.job = job end) AddEventHandler('esx_mecanojob:hasEnteredMarker', function(zone) - if zone == NPCJobTargetTowable then + if zone == NPCJobTargetTowable then - end + end - if zone == 'MecanoActions' then - CurrentAction = 'mecano_actions_menu' - CurrentActionMsg = _U('open_actions') - CurrentActionData = {} - end + if zone == 'MecanoActions' then + CurrentAction = 'mecano_actions_menu' + CurrentActionMsg = _U('open_actions') + CurrentActionData = {} + end - if zone == 'Garage' then - CurrentAction = 'mecano_harvest_menu' - CurrentActionMsg = _U('harvest_menu') - CurrentActionData = {} - end + if zone == 'Garage' then + CurrentAction = 'mecano_harvest_menu' + CurrentActionMsg = _U('harvest_menu') + CurrentActionData = {} + end - if zone == 'Craft' then - CurrentAction = 'mecano_craft_menu' - CurrentActionMsg = _U('craft_menu') - CurrentActionData = {} - end + if zone == 'Craft' then + CurrentAction = 'mecano_craft_menu' + CurrentActionMsg = _U('craft_menu') + CurrentActionData = {} + end - if zone == 'VehicleDeleter' then + if zone == 'VehicleDeleter' then - local playerPed = GetPlayerPed(-1) + local playerPed = GetPlayerPed(-1) - if IsPedInAnyVehicle(playerPed, false) then + if IsPedInAnyVehicle(playerPed, false) then - local vehicle = GetVehiclePedIsIn(playerPed, false) + local vehicle = GetVehiclePedIsIn(playerPed, false) - CurrentAction = 'delete_vehicle' - CurrentActionMsg = _U('veh_stored') - CurrentActionData = {vehicle = vehicle} - end - end + CurrentAction = 'delete_vehicle' + CurrentActionMsg = _U('veh_stored') + CurrentActionData = {vehicle = vehicle} + end + end end) AddEventHandler('esx_mecanojob:hasExitedMarker', function(zone) - if zone == 'Craft' then - TriggerServerEvent('esx_mecanojob:stopCraft') - TriggerServerEvent('esx_mecanojob:stopCraft2') - TriggerServerEvent('esx_mecanojob:stopCraft3') - end + if zone == 'Craft' then + TriggerServerEvent('esx_mecanojob:stopCraft') + TriggerServerEvent('esx_mecanojob:stopCraft2') + TriggerServerEvent('esx_mecanojob:stopCraft3') + end - if zone == 'Garage' then - TriggerServerEvent('esx_mecanojob:stopHarvest') - TriggerServerEvent('esx_mecanojob:stopHarvest2') - TriggerServerEvent('esx_mecanojob:stopHarvest3') - end + if zone == 'Garage' then + TriggerServerEvent('esx_mecanojob:stopHarvest') + TriggerServerEvent('esx_mecanojob:stopHarvest2') + TriggerServerEvent('esx_mecanojob:stopHarvest3') + end - CurrentAction = nil - ESX.UI.Menu.CloseAll() + CurrentAction = nil + ESX.UI.Menu.CloseAll() end) AddEventHandler('esx_mecanojob:hasEnteredEntityZone', function(entity) - local playerPed = GetPlayerPed(-1) + local playerPed = GetPlayerPed(-1) - if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' and not IsPedInAnyVehicle(playerPed, false) then - CurrentAction = 'remove_entity' - CurrentActionMsg = _U('press_remove_obj') - CurrentActionData = {entity = entity} - end + if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' and not IsPedInAnyVehicle(playerPed, false) then + CurrentAction = 'remove_entity' + CurrentActionMsg = _U('press_remove_obj') + CurrentActionData = {entity = entity} + end end) AddEventHandler('esx_mecanojob:hasExitedEntityZone', function(entity) - if CurrentAction == 'remove_entity' then - CurrentAction = nil - end + if CurrentAction == 'remove_entity' then + CurrentAction = nil + end end) RegisterNetEvent('esx_phone:loaded') AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) - local specialContact = { - name = _U('mechanic'), - number = 'mecano', - 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) + local specialContact = { + name = _U('mechanic'), + number = 'mecano', + 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 @@ -983,7 +984,7 @@ Citizen.CreateThread(function() local model = Config.Vehicles[GetRandomIntInRange(1, #Config.Vehicles)] ESX.Game.SpawnVehicle(model, zone.Pos, 0, function(vehicle) - NPCTargetTowable = vehicle + NPCTargetTowable = vehicle end) NPCHasSpawnedTowable = true @@ -1009,91 +1010,91 @@ end) -- Create Blips Citizen.CreateThread(function() - local blip = AddBlipForCoord(Config.Zones.MecanoActions.Pos.x, Config.Zones.MecanoActions.Pos.y, Config.Zones.MecanoActions.Pos.z) - SetBlipSprite (blip, 446) - SetBlipDisplay(blip, 4) - SetBlipScale (blip, 1.8) - SetBlipColour (blip, 5) - SetBlipAsShortRange(blip, true) - BeginTextCommandSetBlipName("STRING") - AddTextComponentString(_U('mechanic')) - EndTextCommandSetBlipName(blip) + local blip = AddBlipForCoord(Config.Zones.MecanoActions.Pos.x, Config.Zones.MecanoActions.Pos.y, Config.Zones.MecanoActions.Pos.z) + SetBlipSprite (blip, 446) + SetBlipDisplay(blip, 4) + SetBlipScale (blip, 1.8) + SetBlipColour (blip, 5) + SetBlipAsShortRange(blip, true) + BeginTextCommandSetBlipName("STRING") + AddTextComponentString(_U('mechanic')) + EndTextCommandSetBlipName(blip) end) -- Display markers Citizen.CreateThread(function() - while true do - Wait(0) - if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + while true do + Wait(0) + if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - local coords = GetEntityCoords(GetPlayerPed(-1)) + local coords = GetEntityCoords(GetPlayerPed(-1)) - for k,v in pairs(Config.Zones) do - if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 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, false, true, 2, false, false, false, false) - end - end - end - end + for k,v in pairs(Config.Zones) do + if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 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, false, true, 2, false, false, false, false) + end + end + end + end end) -- Enter / Exit marker events Citizen.CreateThread(function() - while true do - Wait(0) - if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - local coords = GetEntityCoords(GetPlayerPed(-1)) - local isInMarker = false - local currentZone = nil - for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then - isInMarker = true - currentZone = k - end - end - if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then - HasAlreadyEnteredMarker = true - LastZone = currentZone - TriggerEvent('esx_mecanojob:hasEnteredMarker', currentZone) - end - if not isInMarker and HasAlreadyEnteredMarker then - HasAlreadyEnteredMarker = false - TriggerEvent('esx_mecanojob:hasExitedMarker', LastZone) - end - end - end + while true do + Wait(0) + if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + local coords = GetEntityCoords(GetPlayerPed(-1)) + local isInMarker = false + local currentZone = nil + for k,v in pairs(Config.Zones) do + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then + isInMarker = true + currentZone = k + end + end + if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then + HasAlreadyEnteredMarker = true + LastZone = currentZone + TriggerEvent('esx_mecanojob:hasEnteredMarker', currentZone) + end + if not isInMarker and HasAlreadyEnteredMarker then + HasAlreadyEnteredMarker = false + TriggerEvent('esx_mecanojob:hasExitedMarker', LastZone) + end + end + end end) Citizen.CreateThread(function() - while true do + while true do - Citizen.Wait(0) + Citizen.Wait(0) - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - local entity, distance = ESX.Game.GetClosestObject({ - 'prop_roadcone02a', - 'prop_toolchest_01' - }) + local entity, distance = ESX.Game.GetClosestObject({ + 'prop_roadcone02a', + 'prop_toolchest_01' + }) - if distance ~= -1 and distance <= 3.0 then + if distance ~= -1 and distance <= 3.0 then - if LastEntity ~= entity then - TriggerEvent('esx_mecanojob:hasEnteredEntityZone', entity) - LastEntity = entity - end + if LastEntity ~= entity then + TriggerEvent('esx_mecanojob:hasEnteredEntityZone', entity) + LastEntity = entity + end - else + else - if LastEntity ~= nil then - TriggerEvent('esx_mecanojob:hasExitedEntityZone', LastEntity) - LastEntity = nil - end + if LastEntity ~= nil then + TriggerEvent('esx_mecanojob:hasExitedEntityZone', LastEntity) + LastEntity = nil + end - end + end - end + end end) @@ -1124,29 +1125,29 @@ Citizen.CreateThread(function() if CurrentAction == 'delete_vehicle' then - if Config.EnableSocietyOwnedVehicles then + if Config.EnableSocietyOwnedVehicles then - local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) - TriggerServerEvent('esx_society:putVehicleInGarage', 'mecano', vehicleProps) + local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) + TriggerServerEvent('esx_society:putVehicleInGarage', 'mecano', vehicleProps) - else + else - if - GetEntityModel(vehicle) == GetHashKey('flatbed') or - GetEntityModel(vehicle) == GetHashKey('towtrcuk2') or - GetEntityModel(vehicle) == GetHashKey('slamvan3') - then - TriggerServerEvent('esx_service:disableService', 'mecano') - end + if + GetEntityModel(vehicle) == GetHashKey('flatbed') or + GetEntityModel(vehicle) == GetHashKey('towtrcuk2') or + GetEntityModel(vehicle) == GetHashKey('slamvan3') + then + TriggerServerEvent('esx_service:disableService', 'mecano') + end - end + end - ESX.Game.DeleteVehicle(CurrentActionData.vehicle) + ESX.Game.DeleteVehicle(CurrentActionData.vehicle) end if CurrentAction == 'remove_entity' then - DeleteEntity(CurrentActionData.entity) - end + DeleteEntity(CurrentActionData.entity) + end CurrentAction = nil end @@ -1156,30 +1157,30 @@ Citizen.CreateThread(function() OpenMobileMecanoActionsMenu() end - if IsControlJustReleased(0, Keys['DELETE']) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + if IsControlJustReleased(0, Keys['DELETE']) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - if NPCOnJob then + if NPCOnJob then - if GetGameTimer() - NPCLastCancel > 5 * 60000 then - StopNPCJob(true) - NPCLastCancel = GetGameTimer() - else - ESX.ShowNotification(_U('wait_five')) - end + if GetGameTimer() - NPCLastCancel > 5 * 60000 then + StopNPCJob(true) + NPCLastCancel = GetGameTimer() + else + ESX.ShowNotification(_U('wait_five')) + end - else + else - local playerPed = GetPlayerPed(-1) + local playerPed = GetPlayerPed(-1) - if IsPedInAnyVehicle(playerPed, false) and IsVehicleModel(GetVehiclePedIsIn(playerPed, false), GetHashKey("flatbed")) then - StartNPCJob() - else - ESX.ShowNotification(_U('must_in_flatbed')) - end + if IsPedInAnyVehicle(playerPed, false) and IsVehicleModel(GetVehiclePedIsIn(playerPed, false), GetHashKey("flatbed")) then + StartNPCJob() + else + ESX.ShowNotification(_U('must_in_flatbed')) + end - end + end - end + end end end) diff --git a/config.lua b/config.lua index 208219ec..2ecf3fce 100644 --- a/config.lua +++ b/config.lua @@ -5,112 +5,108 @@ Config.EnablePlayerManagement = false Config.EnableSocietyOwnedVehicles = false Config.NPCSpawnDistance = 500.0 Config.NPCNextToDistance = 25.0 -Config.NPCJobEarnings = {min = 15, max = 40} -Config.Locale = 'fr' +Config.NPCJobEarnings = { min = 15, max = 40 } +Config.Locale = 'fr' Config.Zones = { + MecanoActions = { + Pos = { x = -347.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, + }, - MecanoActions = { - Pos = {x = -347.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 - }, + Garage = { + Pos = { x = -97.5797576904297, y = 6496.11376953125, z = 30.4909038543701 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Color = { r = 204, g = 204, b = 0 }, + Type = 1, + }, - Garage = { - Pos = {x = -97.5797576904297, y = 6496.11376953125, z = 30.4909038543701}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Color = {r = 204, g = 204, b = 0}, - Type = 1 - }, + Craft = { + Pos = { x = -323.140, y = -129.882, z = 37.999 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Color = { r = 204, g = 204, b = 0 }, + Type = 1, + }, - Craft = { - Pos = {x = -323.140, y = -129.882, z = 37.999}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Color = {r = 204, g = 204, b = 0}, - Type = 1 - }, + VehicleSpawnPoint = { + Pos = { x = -366.354, y = -110.766, z = 37.696 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Type = -1, + }, - VehicleSpawnPoint = { - Pos = {x = -366.354, y = -110.766, z = 37.696}, - Size = {x = 1.5, y = 1.5, z = 1.0}, - Type = -1 - }, - - VehicleDeleter = { - Pos = {x = -386.899, y = -105.675, z = 37.683}, - Size = {x = 3.0, y = 3.0, z = 1.0}, - Color = {r = 204, g = 204, b = 0}, - Type = 1 - }, - - VehicleDelivery = { - Pos = {x = -382.925, y = -133.748, z = 37.685}, - Size = {x = 20.0, y = 20.0, z = 3.0}, - Color = {r = 204, g = 204, b = 0}, - Type = -1 - }, + VehicleDeleter = { + Pos = { x = -386.899, y = -105.675, z = 37.683 }, + Size = { x = 3.0, y = 3.0, z = 1.0 }, + Color = { r = 204, g = 204, b = 0 }, + Type = 1, + }, + VehicleDelivery = { + Pos = { x = -382.925, y = -133.748, z = 37.685 }, + Size = { x = 20.0, y = 20.0, z = 3.0 }, + Color = { r = 204, g = 204, b = 0 }, + Type = -1, + }, } Config.Towables = { - { ['x'] = -2480.8720703125, ['y'] = -211.96409606934, ['z'] = 17.397672653198 }, - { ['x'] = -2723.392578125, ['y'] = 13.207388877869, ['z'] = 15.12806892395 }, - { ['x'] = -3169.6235351563, ['y'] = 976.18127441406, ['z'] = 15.038360595703 }, - { ['x'] = -3139.7568359375, ['y'] = 1078.7182617188, ['z'] = 20.189767837524 }, - { ['x'] = -1656.9357910156, ['y'] = -246.16479492188, ['z'] = 54.510955810547 }, - { ['x'] = -1586.6560058594, ['y'] = -647.56115722656, ['z'] = 29.441320419312 }, - { ['x'] = -1036.1470947266, ['y'] = -491.05856323242, ['z'] = 36.214912414551 }, - { ['x'] = -1029.1884765625, ['y'] = -475.53167724609, ['z'] = 36.416831970215 }, - { ['x'] = 75.212287902832, ['y'] = 164.8522644043, ['z'] = 104.69123077393 }, - { ['x'] = -534.60491943359, ['y'] = -756.71801757813, ['z'] = 31.599143981934 }, - { ['x'] = 487.24212646484, ['y'] = -30.827201843262, ['z'] = 88.856712341309 }, - { ['x'] = -772.20111083984, ['y'] = -1281.8114013672, ['z'] = 4.5642876625061 }, - { ['x'] = -663.84173583984, ['y'] = -1206.9936523438, ['z'] = 10.171216011047 }, - { ['x'] = 719.12451171875, ['y'] = -767.77545166016, ['z'] = 24.892364501953 }, - { ['x'] = -970.95465087891, ['y'] = -2410.4453125, ['z'] = 13.344270706177 }, - { ['x'] = -1067.5234375, ['y'] = -2571.4064941406, ['z'] = 13.211874008179 }, - { ['x'] = -619.23968505859, ['y'] = -2207.2927246094, ['z'] = 5.5659561157227 }, - { ['x'] = 1192.0831298828, ['y'] = -1336.9086914063, ['z'] = 35.106426239014 }, - { ['x'] = -432.81033325195, ['y'] = -2166.0505371094, ['z'] = 9.8885231018066 }, - { ['x'] = -451.82403564453, ['y'] = -2269.34765625, ['z'] = 7.1719741821289 }, - { ['x'] = 939.26702880859, ['y'] = -2197.5390625, ['z'] = 30.546691894531 }, - { ['x'] = -556.11486816406, ['y'] = -1794.7312011719, ['z'] = 22.043060302734 }, - { ['x'] = 591.73504638672, ['y'] = -2628.2197265625, ['z'] = 5.5735430717468 }, - { ['x'] = 1654.515625, ['y'] = -2535.8325195313, ['z'] = 74.491394042969 }, - { ['x'] = 1642.6146240234, ['y'] = -2413.3159179688, ['z'] = 93.139915466309 }, - { ['x'] = 1371.3223876953, ['y'] = -2549.525390625, ['z'] = 47.575256347656 }, - { ['x'] = 383.83779907227, ['y'] = -1652.8695068359, ['z'] = 37.278503417969 }, - { ['x'] = 27.219129562378, ['y'] = -1030.8818359375, ['z'] = 29.414621353149 }, - { ['x'] = 229.26435852051, ['y'] = -365.91101074219, ['z'] = 43.750762939453 }, - { ['x'] = -85.809432983398, ['y'] = -51.665500640869, ['z'] = 61.10591506958 }, - { ['x'] = -4.5967531204224, ['y'] = -670.27124023438, ['z'] = 31.85863494873 }, - { ['x'] = -111.89884185791, ['y'] = 91.96940612793, ['z'] = 71.080169677734 }, - { ['x'] = -314.26129150391, ['y'] = -698.23309326172, ['z'] = 32.545776367188 }, - { ['x'] = -366.90979003906, ['y'] = 115.53963470459, ['z'] = 65.575706481934 }, - { ['x'] = -592.06726074219, ['y'] = 138.20733642578, ['z'] = 60.074813842773 }, - { ['x'] = -1613.8572998047, ['y'] = 18.759860992432, ['z'] = 61.799819946289 }, - { ['x'] = -1709.7995605469, ['y'] = 55.105819702148, ['z'] = 65.706237792969 }, - { ['x'] = -521.88830566406, ['y'] = -266.7805480957, ['z'] = 34.940990447998 }, - { ['x'] = -451.08666992188, ['y'] = -333.52026367188, ['z'] = 34.021533966064 }, - { ['x'] = 322.36480712891, ['y'] = -1900.4990234375, ['z'] = 25.773607254028 }, + { ['x'] = -2480.8720703125, ['y'] = -211.96409606934, ['z'] = 17.397672653198 }, + { ['x'] = -2723.392578125, ['y'] = 13.207388877869, ['z'] = 15.12806892395 }, + { ['x'] = -3169.6235351563, ['y'] = 976.18127441406, ['z'] = 15.038360595703 }, + { ['x'] = -3139.7568359375, ['y'] = 1078.7182617188, ['z'] = 20.189767837524 }, + { ['x'] = -1656.9357910156, ['y'] = -246.16479492188, ['z'] = 54.510955810547 }, + { ['x'] = -1586.6560058594, ['y'] = -647.56115722656, ['z'] = 29.441320419312 }, + { ['x'] = -1036.1470947266, ['y'] = -491.05856323242, ['z'] = 36.214912414551 }, + { ['x'] = -1029.1884765625, ['y'] = -475.53167724609, ['z'] = 36.416831970215 }, + { ['x'] = 75.212287902832, ['y'] = 164.8522644043, ['z'] = 104.69123077393 }, + { ['x'] = -534.60491943359, ['y'] = -756.71801757813, ['z'] = 31.599143981934 }, + { ['x'] = 487.24212646484, ['y'] = -30.827201843262, ['z'] = 88.856712341309 }, + { ['x'] = -772.20111083984, ['y'] = -1281.8114013672, ['z'] = 4.5642876625061 }, + { ['x'] = -663.84173583984, ['y'] = -1206.9936523438, ['z'] = 10.171216011047 }, + { ['x'] = 719.12451171875, ['y'] = -767.77545166016, ['z'] = 24.892364501953 }, + { ['x'] = -970.95465087891, ['y'] = -2410.4453125, ['z'] = 13.344270706177 }, + { ['x'] = -1067.5234375, ['y'] = -2571.4064941406, ['z'] = 13.211874008179 }, + { ['x'] = -619.23968505859, ['y'] = -2207.2927246094, ['z'] = 5.5659561157227 }, + { ['x'] = 1192.0831298828, ['y'] = -1336.9086914063, ['z'] = 35.106426239014 }, + { ['x'] = -432.81033325195, ['y'] = -2166.0505371094, ['z'] = 9.8885231018066 }, + { ['x'] = -451.82403564453, ['y'] = -2269.34765625, ['z'] = 7.1719741821289 }, + { ['x'] = 939.26702880859, ['y'] = -2197.5390625, ['z'] = 30.546691894531 }, + { ['x'] = -556.11486816406, ['y'] = -1794.7312011719, ['z'] = 22.043060302734 }, + { ['x'] = 591.73504638672, ['y'] = -2628.2197265625, ['z'] = 5.5735430717468 }, + { ['x'] = 1654.515625, ['y'] = -2535.8325195313, ['z'] = 74.491394042969 }, + { ['x'] = 1642.6146240234, ['y'] = -2413.3159179688, ['z'] = 93.139915466309 }, + { ['x'] = 1371.3223876953, ['y'] = -2549.525390625, ['z'] = 47.575256347656 }, + { ['x'] = 383.83779907227, ['y'] = -1652.8695068359, ['z'] = 37.278503417969 }, + { ['x'] = 27.219129562378, ['y'] = -1030.8818359375, ['z'] = 29.414621353149 }, + { ['x'] = 229.26435852051, ['y'] = -365.91101074219, ['z'] = 43.750762939453 }, + { ['x'] = -85.809432983398, ['y'] = -51.665500640869, ['z'] = 61.10591506958 }, + { ['x'] = -4.5967531204224, ['y'] = -670.27124023438, ['z'] = 31.85863494873 }, + { ['x'] = -111.89884185791, ['y'] = 91.96940612793, ['z'] = 71.080169677734 }, + { ['x'] = -314.26129150391, ['y'] = -698.23309326172, ['z'] = 32.545776367188 }, + { ['x'] = -366.90979003906, ['y'] = 115.53963470459, ['z'] = 65.575706481934 }, + { ['x'] = -592.06726074219, ['y'] = 138.20733642578, ['z'] = 60.074813842773 }, + { ['x'] = -1613.8572998047, ['y'] = 18.759860992432, ['z'] = 61.799819946289 }, + { ['x'] = -1709.7995605469, ['y'] = 55.105819702148, ['z'] = 65.706237792969 }, + { ['x'] = -521.88830566406, ['y'] = -266.7805480957, ['z'] = 34.940990447998 }, + { ['x'] = -451.08666992188, ['y'] = -333.52026367188, ['z'] = 34.021533966064 }, + { ['x'] = 322.36480712891, ['y'] = -1900.4990234375, ['z'] = 25.773607254028 }, } for i=1, #Config.Towables, 1 do - - Config.Zones['Towable' .. i] = { - Pos = Config.Towables[i], - Size = {x = 1.5, y = 1.5, z = 1.0}, - Color = {r = 204, g = 204, b = 0}, - Type = -1 - } - + Config.Zones['Towable' .. i] = { + Pos = Config.Towables[i], + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Color = { r = 204, g = 204, b = 0 }, + Type = -1 + } end Config.Vehicles = { - 'adder', - 'asea', - 'asterope', - 'banshee', - 'buffalo' + 'adder', + 'asea', + 'asterope', + 'banshee', + 'buffalo' } diff --git a/esx_mecanojob.sql b/esx_mecanojob.sql index 70391571..3e6459a1 100644 --- a/esx_mecanojob.sql +++ b/esx_mecanojob.sql @@ -21,10 +21,10 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ; INSERT INTO `items` (name, label) VALUES - ('gazbottle', 'bouteille de gaz'), - ('fixtool', 'outils réparation'), - ('carotool', 'outils carosserie'), - ('blowpipe', 'Chalumeaux'), - ('fixkit', 'Kit réparation'), - ('carokit', 'Kit carosserie') -; \ No newline at end of file + ('gazbottle', 'bouteille de gaz'), + ('fixtool', 'outils réparation'), + ('carotool', 'outils carosserie'), + ('blowpipe', 'Chalumeaux'), + ('fixkit', 'Kit réparation'), + ('carokit', 'Kit carosserie') +; diff --git a/locales/en.lua b/locales/en.lua index 82846444..ba70ae8f 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -1,83 +1,82 @@ Locales['en'] = { - - ['mechanic'] = 'mechanic', - ['drive_to_indicated'] = '~y~Drive~s~ to the indicated location.', - ['mission_canceled'] = 'Mission ~r~canceled~s~', - ['vehicle_list'] = 'vehicle List', - ['work_wear'] = 'workwear', - ['civ_wear'] = 'civilian clothes', - ['deposit_stock'] = 'deposit Stock', - ['withdraw_stock'] = 'withdraw Stock', - ['boss_actions'] = 'boss Actions', - ['service_vehicle'] = 'service Vehicle', - ['flat_bed'] = 'flatbed', - ['tow_truck'] = 'tow Truck', - ['service_full'] = 'service full: ', - ['open_actions'] = 'Press ~INPUT_CONTEXT~ to access the menu.', - ['harvest'] = 'harvest', - ['harvest_menu'] = 'press ~INPUT_CONTEXT~ to access the harvest menu.', - ['not_experienced_enough'] = 'you are not ~r~experienced enough~s~ to perform this action.', - ['gas_can'] = 'gas Can', - ['repair_tools'] = 'repair Tools', - ['body_work_tools'] = 'bodywork Tools', - ['blowtorch'] = 'blowtorch', - ['repair_kit'] = 'repair Kit', - ['body_kit'] = 'body Kit', - ['craft'] = 'craft', - ['craft_menu'] = 'press ~INPUT_CONTEXT~ to access the crafting menu.', - ['billing'] = 'billing', - ['hijack'] = 'hijack', - ['repair'] = 'repair', - ['clean'] = 'clean', - ['imp_veh'] = 'impound', - ['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!', - ['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', - ['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', - ['objects'] = 'objects', - ['roadcone'] = 'roadcone', - ['toolbox'] = 'toolbox', - ['mechanic_stock'] = 'mechanic Stock', - ['quantity'] = 'quantity', - ['invalid_quantity'] = 'invalid quantity', - ['inventory'] = 'inventory', - ['veh_unlocked'] = '~g~Vehicle Unlocked', - ['hijack_failed'] = '~r~Hijack Failed', - ['body_repaired'] = '~g~Body repaired', - ['veh_repaired'] = '~g~Vehicle Repaired', - ['veh_stored'] = 'press ~INPUT_CONTEXT~ to store the vehicle.', - ['press_remove_obj'] = 'press ~INPUT_CONTEXT~ to remove the object', - ['please_tow'] = 'please ~y~tow~s~ the vehicle', - ['wait_five'] = 'you must ~r~wait~s~ 5 mintes', - ['must_in_flatbed'] = 'you must be in a flatbed to being the mission', - ['mechanic_customer'] = 'mechanic Customer', - ['you_do_not_room'] = '~r~You do not have more room', - ['recovery_gas_can'] = '~b~Gas Can~s~ Retrieval...', - ['recovery_repair_tools'] = '~b~Repair Tools~s~ Retrieval...', - ['recovery_body_tools'] = '~b~Body Tools~s~ Retrieval...', - ['not_enough_gas_can'] = 'You do not ~r~have enough~s~ gas cans.', - ['assembling_blowtorch'] = 'Assembling ~b~Blowtorch~s~...', - ['not_enough_repair_tools'] = 'You do not ~r~have enough~s~ repair tools.', - ['assembling_repair_kit'] = 'Assembling ~b~Repair Kit~s~...', - ['not_enough_body_tools'] = 'You do not ~r~have enough~s~ body tools.', - ['assembling_body_kit'] = 'Assembling ~b~Body Kit~s~...', - ['your_comp_earned'] = 'your company has ~g~earned~s~ ~g~$', - ['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', + ['mechanic'] = 'mechanic', + ['drive_to_indicated'] = '~y~Drive~s~ to the indicated location.', + ['mission_canceled'] = 'Mission ~r~canceled~s~', + ['vehicle_list'] = 'vehicle List', + ['work_wear'] = 'workwear', + ['civ_wear'] = 'civilian clothes', + ['deposit_stock'] = 'deposit Stock', + ['withdraw_stock'] = 'withdraw Stock', + ['boss_actions'] = 'boss Actions', + ['service_vehicle'] = 'service Vehicle', + ['flat_bed'] = 'flatbed', + ['tow_truck'] = 'tow Truck', + ['service_full'] = 'service full: ', + ['open_actions'] = 'Press ~INPUT_CONTEXT~ to access the menu.', + ['harvest'] = 'harvest', + ['harvest_menu'] = 'press ~INPUT_CONTEXT~ to access the harvest menu.', + ['not_experienced_enough'] = 'you are not ~r~experienced enough~s~ to perform this action.', + ['gas_can'] = 'gas Can', + ['repair_tools'] = 'repair Tools', + ['body_work_tools'] = 'bodywork Tools', + ['blowtorch'] = 'blowtorch', + ['repair_kit'] = 'repair Kit', + ['body_kit'] = 'body Kit', + ['craft'] = 'craft', + ['craft_menu'] = 'press ~INPUT_CONTEXT~ to access the crafting menu.', + ['billing'] = 'billing', + ['hijack'] = 'hijack', + ['repair'] = 'repair', + ['clean'] = 'clean', + ['imp_veh'] = 'impound', + ['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!', + ['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', + ['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', + ['objects'] = 'objects', + ['roadcone'] = 'roadcone', + ['toolbox'] = 'toolbox', + ['mechanic_stock'] = 'mechanic Stock', + ['quantity'] = 'quantity', + ['invalid_quantity'] = 'invalid quantity', + ['inventory'] = 'inventory', + ['veh_unlocked'] = '~g~Vehicle Unlocked', + ['hijack_failed'] = '~r~Hijack Failed', + ['body_repaired'] = '~g~Body repaired', + ['veh_repaired'] = '~g~Vehicle Repaired', + ['veh_stored'] = 'press ~INPUT_CONTEXT~ to store the vehicle.', + ['press_remove_obj'] = 'press ~INPUT_CONTEXT~ to remove the object', + ['please_tow'] = 'please ~y~tow~s~ the vehicle', + ['wait_five'] = 'you must ~r~wait~s~ 5 mintes', + ['must_in_flatbed'] = 'you must be in a flatbed to being the mission', + ['mechanic_customer'] = 'mechanic Customer', + ['you_do_not_room'] = '~r~You do not have more room', + ['recovery_gas_can'] = '~b~Gas Can~s~ Retrieval...', + ['recovery_repair_tools'] = '~b~Repair Tools~s~ Retrieval...', + ['recovery_body_tools'] = '~b~Body Tools~s~ Retrieval...', + ['not_enough_gas_can'] = 'You do not ~r~have enough~s~ gas cans.', + ['assembling_blowtorch'] = 'Assembling ~b~Blowtorch~s~...', + ['not_enough_repair_tools'] = 'You do not ~r~have enough~s~ repair tools.', + ['assembling_repair_kit'] = 'Assembling ~b~Repair Kit~s~...', + ['not_enough_body_tools'] = 'You do not ~r~have enough~s~ body tools.', + ['assembling_body_kit'] = 'Assembling ~b~Body Kit~s~...', + ['your_comp_earned'] = 'your company has ~g~earned~s~ ~g~$', + ['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', } diff --git a/locales/fr.lua b/locales/fr.lua index a5651c83..aacdc13e 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -1,83 +1,82 @@ Locales['fr'] = { - - ['mechanic'] = 'mecano', - ['drive_to_indicated'] = '~y~Conduisez~s~ jusqu\'à l\'endroit indiqué', - ['mission_canceled'] = 'Mission ~r~annulée~s~', - ['vehicle_list'] = 'sortir Véhicule', - ['work_wear'] = 'tenue de travail', - ['civ_wear'] = 'Tenue civile', - ['deposit_stock'] = 'Déposer Stock', - ['withdraw_stock'] = 'Prendre Stock', - ['boss_actions'] = 'action Patron', - ['service_vehicle'] = 'Véhicule de service', - ['flat_bed'] = 'plateau', - ['tow_truck'] = 'dépaneuse', - ['service_full'] = 'service complet : ', - ['open_actions'] = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu.', - ['harvest'] = 'récolte', - ['harvest_menu'] = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu de récolte.', - ['not_experienced_enough'] = 'Vous n\'êtes ~r~pas assez expérimenté~s~ pour effectuer cette action.', - ['gas_can'] = 'Bouteille de gaz', - ['repair_tools'] = 'Outils réparation', - ['body_work_tools'] = 'Outils Carosserie', - ['blowtorch'] = 'chalumeaux', - ['repair_kit'] = 'kit Réparation', - ['body_kit'] = 'kit Carosserie', - ['craft'] = 'etabli', - ['craft_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder au menu établi.', - ['billing'] = 'facturation', - ['hijack'] = 'crocheter', - ['repair'] = 'réparer', - ['clean'] = 'nettoyer', - ['impound'] = 'fourrière', - ['place_objects'] = 'placer objets', - ['invoice_amount'] = 'montant de la facture', - ['amount_invalid'] = 'montant invalide', - ['no_players_nearby'] = 'aucun joueur à proximité', - ['vehicle_unlocked'] = 'véhicule ~g~déverouillé', - ['vehicle_repaired'] = 'véhicule ~g~réparé', - ['vehicle_cleaned'] = 'véhicule ~g~néttoyé', - ['vehicle_impounded'] = 'vehicule ~r~mis en fourrière', - ['must_seat_driver'] = 'vous devez être assis du ~r~côté conducteur!', - ['must_near'] = 'vous devez être ~r~près d\'un véhicule~s~ pour le mettre en fourrière', - ['vehicle_success_attached'] = 'vehicule ~b~attaché~s~ avec succès!', - ['please_drop_off'] = 'veuillez déposer le véhicule à la concession', - ['cant_attach_own_tt'] = '~r~Impossible~s~ d\'attacher votre propre dépanneuse', - ['no_veh_att'] = 'il n\'y a ~r~pas de véhicule~s~ à attacher', - ['not_right_veh'] = 'ce n\'est pas le bon véhicule', - ['veh_det_succ'] = 'vehicule ~b~détattaché~s~ avec succès!', - ['imp_flatbed'] = '~r~Impossible! ~s~Vous devez avoir un ~b~Flatbed ~s~pour ça', - ['objects'] = 'objets', - ['roadcone'] = 'plot', - ['toolbox'] = 'boîte à outils', - ['mechanic_stock'] = 'mecano Stock', - ['quantity'] = 'quantité', - ['invalid_quantity'] = 'quantité invalide', - ['inventory'] = 'inventaire', - ['veh_unlocked'] = '~g~Véhicule déverouillé', - ['hijack_failed'] = '~r~Crochetage raté', - ['body_repaired'] = '~g~Carosserie réparée', - ['veh_repaired'] = '~g~Véhicule réparé', - ['veh_stored'] = 'appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule.', - ['press_remove_obj'] = 'appuyez sur ~INPUT_CONTEXT~ pour enlever l\'object', - ['please_tow'] = 'veuillez ~y~remorquer~s~ le véhicule', - ['wait_five'] = 'Vous devez ~r~attendre~s~ 5 minutes', - ['must_in_flatbed'] = 'Vous devez être en flatbed pour commencer la mission', - ['mechanic_customer'] = 'client mecano', - ['you_do_not_room'] = '~r~Vous n\'avez plus de place', - ['recovery_gas_can'] = 'Récupération de ~b~bouteille de gaz~s~...', - ['recovery_repair_tools'] = 'Récupération d\'~b~Outils réparation~s~...', - ['recovery_body_tools'] = 'Récupération d\'~b~Outils carosserie~s~...', - ['not_enough_gas_can'] = 'Vous n\'avez ~r~pas assez~s~ de bouteille de gaz', - ['assembling_blowtorch'] = 'Assemblage de ~b~Chalumeaux~s~...', - ['not_enough_repair_tools'] = 'Vous n\'avez ~r~pas assez~s~ d\'outils réparation', - ['assembling_blowtorch'] = 'Assemblage de ~b~Kit réparation~s~...', - ['not_enough_body_tools'] = 'Vous n\'avez ~r~pas assez~s~ d\'outils carosserie', - ['assembling_body_kit'] = 'Assemblage de ~b~kit carosserie~s~...', - ['your_comp_earned'] = 'Votre société a ~g~gagné~s~ ~g~$', - ['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', + ['mechanic'] = 'mecano', + ['drive_to_indicated'] = '~y~Conduisez~s~ jusqu\'à l\'endroit indiqué', + ['mission_canceled'] = 'Mission ~r~annulée~s~', + ['vehicle_list'] = 'sortir Véhicule', + ['work_wear'] = 'tenue de travail', + ['civ_wear'] = 'Tenue civile', + ['deposit_stock'] = 'Déposer Stock', + ['withdraw_stock'] = 'Prendre Stock', + ['boss_actions'] = 'action Patron', + ['service_vehicle'] = 'Véhicule de service', + ['flat_bed'] = 'plateau', + ['tow_truck'] = 'dépaneuse', + ['service_full'] = 'service complet : ', + ['open_actions'] = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu.', + ['harvest'] = 'récolte', + ['harvest_menu'] = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu de récolte.', + ['not_experienced_enough'] = 'Vous n\'êtes ~r~pas assez expérimenté~s~ pour effectuer cette action.', + ['gas_can'] = 'Bouteille de gaz', + ['repair_tools'] = 'Outils réparation', + ['body_work_tools'] = 'Outils Carosserie', + ['blowtorch'] = 'chalumeaux', + ['repair_kit'] = 'kit Réparation', + ['body_kit'] = 'kit Carosserie', + ['craft'] = 'etabli', + ['craft_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder au menu établi.', + ['billing'] = 'facturation', + ['hijack'] = 'crocheter', + ['repair'] = 'réparer', + ['clean'] = 'nettoyer', + ['impound'] = 'fourrière', + ['place_objects'] = 'placer objets', + ['invoice_amount'] = 'montant de la facture', + ['amount_invalid'] = 'montant invalide', + ['no_players_nearby'] = 'aucun joueur à proximité', + ['vehicle_unlocked'] = 'véhicule ~g~déverouillé', + ['vehicle_repaired'] = 'véhicule ~g~réparé', + ['vehicle_cleaned'] = 'véhicule ~g~néttoyé', + ['vehicle_impounded'] = 'vehicule ~r~mis en fourrière', + ['must_seat_driver'] = 'vous devez être assis du ~r~côté conducteur!', + ['must_near'] = 'vous devez être ~r~près d\'un véhicule~s~ pour le mettre en fourrière', + ['vehicle_success_attached'] = 'vehicule ~b~attaché~s~ avec succès!', + ['please_drop_off'] = 'veuillez déposer le véhicule à la concession', + ['cant_attach_own_tt'] = '~r~Impossible~s~ d\'attacher votre propre dépanneuse', + ['no_veh_att'] = 'il n\'y a ~r~pas de véhicule~s~ à attacher', + ['not_right_veh'] = 'ce n\'est pas le bon véhicule', + ['veh_det_succ'] = 'vehicule ~b~détattaché~s~ avec succès!', + ['imp_flatbed'] = '~r~Impossible! ~s~Vous devez avoir un ~b~Flatbed ~s~pour ça', + ['objects'] = 'objets', + ['roadcone'] = 'plot', + ['toolbox'] = 'boîte à outils', + ['mechanic_stock'] = 'mecano Stock', + ['quantity'] = 'quantité', + ['invalid_quantity'] = 'quantité invalide', + ['inventory'] = 'inventaire', + ['veh_unlocked'] = '~g~Véhicule déverouillé', + ['hijack_failed'] = '~r~Crochetage raté', + ['body_repaired'] = '~g~Carosserie réparée', + ['veh_repaired'] = '~g~Véhicule réparé', + ['veh_stored'] = 'appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule.', + ['press_remove_obj'] = 'appuyez sur ~INPUT_CONTEXT~ pour enlever l\'object', + ['please_tow'] = 'veuillez ~y~remorquer~s~ le véhicule', + ['wait_five'] = 'Vous devez ~r~attendre~s~ 5 minutes', + ['must_in_flatbed'] = 'Vous devez être en flatbed pour commencer la mission', + ['mechanic_customer'] = 'client mecano', + ['you_do_not_room'] = '~r~Vous n\'avez plus de place', + ['recovery_gas_can'] = 'Récupération de ~b~bouteille de gaz~s~...', + ['recovery_repair_tools'] = 'Récupération d\'~b~Outils réparation~s~...', + ['recovery_body_tools'] = 'Récupération d\'~b~Outils carosserie~s~...', + ['not_enough_gas_can'] = 'Vous n\'avez ~r~pas assez~s~ de bouteille de gaz', + ['assembling_blowtorch'] = 'Assemblage de ~b~Chalumeaux~s~...', + ['not_enough_repair_tools'] = 'Vous n\'avez ~r~pas assez~s~ d\'outils réparation', + ['assembling_blowtorch'] = 'Assemblage de ~b~Kit réparation~s~...', + ['not_enough_body_tools'] = 'Vous n\'avez ~r~pas assez~s~ d\'outils carosserie', + ['assembling_body_kit'] = 'Assemblage de ~b~kit carosserie~s~...', + ['your_comp_earned'] = 'Votre société a ~g~gagné~s~ ~g~$', + ['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', } diff --git a/localization/esx_mecanojob_en.sql b/localization/esx_mecanojob_en.sql index 66571646..31c457f2 100644 --- a/localization/esx_mecanojob_en.sql +++ b/localization/esx_mecanojob_en.sql @@ -21,10 +21,10 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ; INSERT INTO `items` (name, label) VALUES - ('gazbottle', 'Gas Bottle'), - ('fixtool', 'Repair Tools'), - ('carotool', 'Tools'), - ('blowpipe', 'Blowtorch'), - ('fixkit', 'Repair Kit'), - ('carokit', 'Body Kit') + ('gazbottle', 'Gas Bottle'), + ('fixtool', 'Repair Tools'), + ('carotool', 'Tools'), + ('blowpipe', 'Blowtorch'), + ('fixkit', 'Repair Kit'), + ('carokit', 'Body Kit') ; diff --git a/server/main.lua b/server/main.lua index f7681785..44cd7b45 100644 --- a/server/main.lua +++ b/server/main.lua @@ -9,7 +9,7 @@ PlayersCrafting3 = {} TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) if Config.MaxInService ~= -1 then - TriggerEvent('esx_service:activateService', 'mecano', Config.MaxInService) + TriggerEvent('esx_service:activateService', 'mecano', Config.MaxInService) end TriggerEvent('esx_phone:registerNumber', 'mecano', _U('mechanic_customer'), true, true) @@ -19,205 +19,205 @@ TriggerEvent('esx_society:registerSociety', 'mecano', 'Mecano', 'society_mecano' ---- Sqlut je teste ------ local function Harvest(source) - SetTimeout(4000, function() + SetTimeout(4000, function() - if PlayersHarvesting[source] == true then + if PlayersHarvesting[source] == true then - local xPlayer = ESX.GetPlayerFromId(source) - local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count + local xPlayer = ESX.GetPlayerFromId(source) + local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count - if GazBottleQuantity >= 5 then - TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) - else + if GazBottleQuantity >= 5 then + TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) + else xPlayer.addInventoryItem('gazbottle', 1) - Harvest(source) - end - end - end) + Harvest(source) + end + end + end) end RegisterServerEvent('esx_mecanojob:startHarvest') AddEventHandler('esx_mecanojob:startHarvest', function() - local _source = source - PlayersHarvesting[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('recovery_gas_can')) - Harvest(source) + local _source = source + PlayersHarvesting[_source] = true + TriggerClientEvent('esx:showNotification', _source, _U('recovery_gas_can')) + Harvest(source) end) RegisterServerEvent('esx_mecanojob:stopHarvest') AddEventHandler('esx_mecanojob:stopHarvest', function() - local _source = source - PlayersHarvesting[_source] = false + local _source = source + PlayersHarvesting[_source] = false end) ------------ Récupération Outils Réparation -------------- local function Harvest2(source) - SetTimeout(4000, function() + SetTimeout(4000, function() - if PlayersHarvesting2[source] == true then + if PlayersHarvesting2[source] == true then - local xPlayer = ESX.GetPlayerFromId(source) - local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count - if FixToolQuantity >= 5 then - TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) - else + local xPlayer = ESX.GetPlayerFromId(source) + local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count + if FixToolQuantity >= 5 then + TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) + else xPlayer.addInventoryItem('fixtool', 1) - Harvest2(source) - end - end - end) + Harvest2(source) + end + end + end) end RegisterServerEvent('esx_mecanojob:startHarvest2') AddEventHandler('esx_mecanojob:startHarvest2', function() - local _source = source - PlayersHarvesting2[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('recovery_repair_tools')) - Harvest2(_source) + local _source = source + PlayersHarvesting2[_source] = true + TriggerClientEvent('esx:showNotification', _source, _U('recovery_repair_tools')) + Harvest2(_source) end) RegisterServerEvent('esx_mecanojob:stopHarvest2') AddEventHandler('esx_mecanojob:stopHarvest2', function() - local _source = source - PlayersHarvesting2[_source] = false + local _source = source + PlayersHarvesting2[_source] = false end) ----------------- Récupération Outils Carosserie ---------------- local function Harvest3(source) - SetTimeout(4000, function() + SetTimeout(4000, function() - if PlayersHarvesting3[source] == true then + if PlayersHarvesting3[source] == true then - local xPlayer = ESX.GetPlayerFromId(source) - local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count + local xPlayer = ESX.GetPlayerFromId(source) + local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count if CaroToolQuantity >= 5 then - TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) - else + TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) + else xPlayer.addInventoryItem('carotool', 1) - Harvest3(source) - end - end - end) + Harvest3(source) + end + end + end) end RegisterServerEvent('esx_mecanojob:startHarvest3') AddEventHandler('esx_mecanojob:startHarvest3', function() - local _source = source - PlayersHarvesting3[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('recovery_body_tools')) - Harvest3(_source) + local _source = source + PlayersHarvesting3[_source] = true + TriggerClientEvent('esx:showNotification', _source, _U('recovery_body_tools')) + Harvest3(_source) end) RegisterServerEvent('esx_mecanojob:stopHarvest3') AddEventHandler('esx_mecanojob:stopHarvest3', function() - local _source = source - PlayersHarvesting3[_source] = false + local _source = source + PlayersHarvesting3[_source] = false end) ------------ Craft Chalumeau ------------------- local function Craft(source) - SetTimeout(4000, function() + SetTimeout(4000, function() - if PlayersCrafting[source] == true then + if PlayersCrafting[source] == true then - local xPlayer = ESX.GetPlayerFromId(source) - local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count + local xPlayer = ESX.GetPlayerFromId(source) + local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count - if GazBottleQuantity <= 0 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_gas_can')) - else + if GazBottleQuantity <= 0 then + TriggerClientEvent('esx:showNotification', source, _U('not_enough_gas_can')) + else xPlayer.removeInventoryItem('gazbottle', 1) xPlayer.addInventoryItem('blowpipe', 1) - Craft(source) - end - end - end) + Craft(source) + end + end + end) end RegisterServerEvent('esx_mecanojob:startCraft') AddEventHandler('esx_mecanojob:startCraft', function() - local _source = source - PlayersCrafting[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('assembling_blowtorch')) - Craft(_source) + local _source = source + PlayersCrafting[_source] = true + TriggerClientEvent('esx:showNotification', _source, _U('assembling_blowtorch')) + Craft(_source) end) RegisterServerEvent('esx_mecanojob:stopCraft') AddEventHandler('esx_mecanojob:stopCraft', function() - local _source = source - PlayersCrafting[_source] = false + local _source = source + PlayersCrafting[_source] = false end) ------------ Craft kit Réparation -------------- local function Craft2(source) - SetTimeout(4000, function() + SetTimeout(4000, function() - if PlayersCrafting2[source] == true then + if PlayersCrafting2[source] == true then - local xPlayer = ESX.GetPlayerFromId(source) - local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count - if FixToolQuantity <= 0 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_repair_tools')) - else + local xPlayer = ESX.GetPlayerFromId(source) + local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count + if FixToolQuantity <= 0 then + TriggerClientEvent('esx:showNotification', source, _U('not_enough_repair_tools')) + else xPlayer.removeInventoryItem('fixtool', 1) xPlayer.addInventoryItem('fixkit', 1) - Craft2(source) - end - end - end) + Craft2(source) + end + end + end) end RegisterServerEvent('esx_mecanojob:startCraft2') AddEventHandler('esx_mecanojob:startCraft2', function() - local _source = source - PlayersCrafting2[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('assembling_blowtorch')) - Craft2(_source) + local _source = source + PlayersCrafting2[_source] = true + TriggerClientEvent('esx:showNotification', _source, _U('assembling_blowtorch')) + Craft2(_source) end) RegisterServerEvent('esx_mecanojob:stopCraft2') AddEventHandler('esx_mecanojob:stopCraft2', function() - local _source = source - PlayersCrafting2[_source] = false + local _source = source + PlayersCrafting2[_source] = false end) ----------------- Craft kit Carosserie ---------------- local function Craft3(source) - SetTimeout(4000, function() + SetTimeout(4000, function() - if PlayersCrafting3[source] == true then + if PlayersCrafting3[source] == true then - local xPlayer = ESX.GetPlayerFromId(source) - local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count + local xPlayer = ESX.GetPlayerFromId(source) + local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count if CaroToolQuantity <= 0 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_body_tools')) - else + TriggerClientEvent('esx:showNotification', source, _U('not_enough_body_tools')) + else xPlayer.removeInventoryItem('carotool', 1) xPlayer.addInventoryItem('carokit', 1) - Craft3(source) - end - end - end) + Craft3(source) + end + end + end) end RegisterServerEvent('esx_mecanojob:startCraft3') AddEventHandler('esx_mecanojob:startCraft3', function() - local _source = source - PlayersCrafting3[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('assembling_body_kit')) - Craft3(_source) + local _source = source + PlayersCrafting3[_source] = true + TriggerClientEvent('esx:showNotification', _source, _U('assembling_body_kit')) + Craft3(_source) end) RegisterServerEvent('esx_mecanojob:stopCraft3') AddEventHandler('esx_mecanojob:stopCraft3', function() - local _source = source - PlayersCrafting3[_source] = false + local _source = source + PlayersCrafting3[_source] = false end) ---------------------------- NPC Job Earnings ------------------------------------------------------ @@ -225,55 +225,55 @@ end) RegisterServerEvent('esx_mecanojob:onNPCJobMissionCompleted') AddEventHandler('esx_mecanojob:onNPCJobMissionCompleted', function() - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) local total = math.random(Config.NPCJobEarnings.min, Config.NPCJobEarnings.max); if xPlayer.job.grade >= 3 then - total = total * 2 + total = total * 2 end TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mecano', function(account) - account.addMoney(total) + account.addMoney(total) end) - TriggerClientEvent("esx:showNotification", _source, _U('your_comp_earned').. total) + TriggerClientEvent("esx:showNotification", _source, _U('your_comp_earned').. total) end) ---------------------------- register usable item -------------------------------------------------- ESX.RegisterUsableItem('blowpipe', function(source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) - xPlayer.removeInventoryItem('blowpipe', 1) + xPlayer.removeInventoryItem('blowpipe', 1) - TriggerClientEvent('esx_mecanojob:onHijack', _source) + TriggerClientEvent('esx_mecanojob:onHijack', _source) TriggerClientEvent('esx:showNotification', _source, _U('you_used_blowtorch')) end) ESX.RegisterUsableItem('fixkit', function(source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) - xPlayer.removeInventoryItem('fixkit', 1) + xPlayer.removeInventoryItem('fixkit', 1) - TriggerClientEvent('esx_mecanojob:onFixkit', _source) + TriggerClientEvent('esx_mecanojob:onFixkit', _source) TriggerClientEvent('esx:showNotification', _source, _U('you_used_repair_kit')) end) ESX.RegisterUsableItem('carokit', function(source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) - xPlayer.removeInventoryItem('carokit', 1) + xPlayer.removeInventoryItem('carokit', 1) - TriggerClientEvent('esx_mecanojob:onCarokit', _source) + TriggerClientEvent('esx_mecanojob:onCarokit', _source) TriggerClientEvent('esx:showNotification', _source, _U('you_used_body_kit')) end) @@ -285,30 +285,30 @@ end) RegisterServerEvent('esx_mecanojob:getStockItem') AddEventHandler('esx_mecanojob:getStockItem', function(itemName, count) - local xPlayer = ESX.GetPlayerFromId(source) + local xPlayer = ESX.GetPlayerFromId(source) - TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) + TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) - local item = inventory.getItem(itemName) + local item = inventory.getItem(itemName) - if item.count >= count then - inventory.removeItem(itemName, count) - xPlayer.addInventoryItem(itemName, count) - else - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity')) - end + if item.count >= count then + inventory.removeItem(itemName, count) + xPlayer.addInventoryItem(itemName, count) + else + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity')) + end - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('you_removed') .. count .. ' ' .. item.label) + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('you_removed') .. count .. ' ' .. item.label) - end) + end) end) ESX.RegisterServerCallback('esx_mecanojob:getStockItems', function(source, cb) - TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) - cb(inventory.items) - end) + TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) + cb(inventory.items) + end) end) @@ -319,40 +319,40 @@ end) RegisterServerEvent('esx_mecanojob:putStockItems') AddEventHandler('esx_mecanojob:putStockItems', function(itemName, count) - local xPlayer = ESX.GetPlayerFromId(source) + local xPlayer = ESX.GetPlayerFromId(source) - TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) + TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) - local item = inventory.getItem(itemName) + local item = inventory.getItem(itemName) - if item.count >= 0 then - xPlayer.removeInventoryItem(itemName, count) - inventory.addItem(itemName, count) - else - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity')) - end + if item.count >= 0 then + xPlayer.removeInventoryItem(itemName, count) + inventory.addItem(itemName, count) + else + 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('you_added') .. count .. ' ' .. item.label) - end) + end) end) --ESX.RegisterServerCallback('esx_mecanojob:putStockItems', function(source, cb) --- TriggerEvent('esx_addoninventory:getSharedInventory', 'society_policestock', function(inventory) --- cb(inventory.items) --- end) +-- TriggerEvent('esx_addoninventory:getSharedInventory', 'society_policestock', function(inventory) +-- cb(inventory.items) +-- end) --end) ESX.RegisterServerCallback('esx_mecanojob:getPlayerInventory', function(source, cb) - local xPlayer = ESX.GetPlayerFromId(source) - local items = xPlayer.inventory + local xPlayer = ESX.GetPlayerFromId(source) + local items = xPlayer.inventory - cb({ - items = items - }) + cb({ + items = items + }) end) From e9438fa1be68546a29c3ff1933b7eb231011cceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 14 Sep 2017 23:17:40 +0200 Subject: [PATCH 22/66] Update LICENSE.txt --- LICENSE.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 30ace6a8..8f58e359 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} + fxserver-esx_mecanojob + Copyright (C) 2015 Jérémie N'gadi This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - {project} Copyright (C) {year} {fullname} + fxserver-esx_mecanojob Copyright (C) 2015 Jérémie N'gadi This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. From 7b662112f632c0cf5802807d2c0f8135e20fd4f1 Mon Sep 17 00:00:00 2001 From: CMDTelhada <31828535+CMDTelhada@users.noreply.github.com> Date: Thu, 14 Sep 2017 20:55:57 -0300 Subject: [PATCH 23/66] br.lua Added portuguese language --- locales/br.lua | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 locales/br.lua diff --git a/locales/br.lua b/locales/br.lua new file mode 100644 index 00000000..cd935a5f --- /dev/null +++ b/locales/br.lua @@ -0,0 +1,82 @@ +Locales['en'] = { + ['mechanic'] = 'Mecânico', + ['drive_to_indicated'] = '~y~Dirija~s~ para a localização indicada.', + ['mission_canceled'] = 'Missão ~r~cancelada~s~', + ['vehicle_list'] = 'Lista de veículos', + ['work_wear'] = 'Vestuário de trabalho', + ['civ_wear'] = 'Roupas normal', + ['deposit_stock'] = 'Depósito de estoque', + ['withdraw_stock'] = 'Retirar do estoque', + ['boss_actions'] = 'Administração', + ['service_vehicle'] = 'Veículo de serviço', + ['flat_bed'] = 'Reboque Pranha', + ['tow_truck'] = 'Reboque Guincho', + ['service_full'] = 'Serviço cheio: ', + ['open_actions'] = 'Aperte ~INPUT_CONTEXT~ para acessar menu.', + ['harvest'] = 'Processando', + ['harvest_menu'] = 'Aperte ~INPUT_CONTEXT~ para acessar o menu de processamento.', + ['not_experienced_enough'] = 'Você não é ~r~experiente o suficiente~s~ para executar está ação.', + ['gas_can'] = 'Lata de gás', + ['repair_tools'] = 'Ferramentas de reparo', + ['body_work_tools'] = 'Ferramentas de carroçaria', + ['blowtorch'] = 'Maçarico', + ['repair_kit'] = 'Kit de reparação', + ['body_kit'] = 'Kit de corpo', + ['craft'] = 'Construir', + ['craft_menu'] = 'Aperte ~INPUT_CONTEXT~ para acessar menu de criar feramentas.', + ['billing'] = 'Faturamento', + ['hijack'] = 'Sequestro', + ['repair'] = 'Reparar', + ['clean'] = 'Limpar', + ['imp_veh'] = 'Veículo rebocado', + ['place_objects'] = 'Objetos de trabalho', + ['invoice_amount'] = 'Valor da fatura', + ['amount_invalid'] = 'Valor inválido', + ['no_players_nearby'] = 'Sem jogadores nas proximidades', + ['vehicle_unlocked'] = 'Veículo ~g~Destrancado', + ['vehicle_repaired'] = 'Veículo ~g~Reparado', + ['vehicle_cleaned'] = 'Veículo ~g~Limpo', + ['vehicle_impounded'] = 'Veículo ~r~removido', + ['must_seat_driver'] = 'Você deve estar sentado ~r~no banco do motorista!', + ['must_near'] = 'Você deve estar perto de um ~r~veículo~s~ para rebocalo.', + ['vehicle_success_attached'] = 'Veículo foi ~b~rebocado~s~ com sucesso!.', + ['please_drop_off'] = 'Por favor, deixe o veículo na oficina mecânica', + ['cant_attach_own_tt'] = '~r~Você não pode~s~ rebocar seu próprio veículo!', + ['no_veh_att'] = 'Não há ~r~veículo~s~ para ser rebocado!', + ['not_right_veh'] = 'Este não é o veículo certo', + ['veh_det_succ'] = 'Veículo foi ~b~entregue~s~ com sucesso...', + ['imp_flatbed'] = '~r~Ação impossível!~s~ você precisa de um ~b~reboque de prancha~s~ para isso.', + ['objects'] = 'Objetos', + ['roadcone'] = 'Cone', + ['toolbox'] = 'Caixa de ferramentas', + ['mechanic_stock'] = 'Estoque do mecânico', + ['quantity'] = 'Quantidade', + ['invalid_quantity'] = 'Quantidade inválida', + ['inventory'] = 'Inventário', + ['veh_unlocked'] = '~g~Veículo destrancado', + ['hijack_failed'] = '~r~Destrava falhou', + ['body_repaired'] = '~g~Carro reparado', + ['veh_repaired'] = '~g~Veículo reparado', + ['veh_stored'] = 'Aperte ~INPUT_CONTEXT~ para armazenar o veículo.', + ['press_remove_obj'] = 'Aperte ~INPUT_CONTEXT~ para remover o objeto', + ['please_tow'] = 'Por favor ~y~reboque~s~ este veículo!', + ['wait_five'] = 'Você deve ~r~aguardar~s~ 5 minutos', + ['must_in_flatbed'] = 'Você deve estar em um caminhão de mecânico para iniciar a missão', + ['mechanic_customer'] = 'Cliente mecânico', + ['you_do_not_room'] = '~r~Você não tem mais espaço', + ['recovery_gas_can'] = '~b~Lata de gâs~s~ fabricado...', + ['recovery_repair_tools'] = '~b~Ferramentas de reparo~s~ fabricado...', + ['recovery_body_tools'] = '~b~Ferramentas de capo~s~ fabricado...', + ['not_enough_gas_can'] = 'Você não tem ~r~lata de gás ~s~ o suficiente.', + ['assembling_blowtorch'] = 'Montagem ~b~Maçarico~s~...', + ['not_enough_repair_tools'] = 'Você não tem ~r~ferramentas de reparo~s~ o suficiente.', + ['assembling_repair_kit'] = 'Fabricando ~b~Kit de reparação~s~...', + ['not_enough_body_tools'] = 'Você não tem ~r~ferramentas corporais~s~ o suficiente.', + ['assembling_body_kit'] = 'Fabricando ~b~Kit de corpo~s~...', + ['your_comp_earned'] = 'Sua empresa ~g~recebeu~s~ ~g~$', + ['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', +} From f40a75c10b924eaa412294132621d5205d2ad88e Mon Sep 17 00:00:00 2001 From: CMDTelhada <31828535+CMDTelhada@users.noreply.github.com> Date: Thu, 14 Sep 2017 21:02:39 -0300 Subject: [PATCH 24/66] add portugues language __resource.lua Added portuguese language --- __resource | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 __resource diff --git a/__resource b/__resource new file mode 100644 index 00000000..dd8b8e2d --- /dev/null +++ b/__resource @@ -0,0 +1,21 @@ +resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' + +description 'ESX Mecano Job' + +client_scripts { + '@es_extended/locale.lua', + 'locales/br.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'config.lua', + 'client/main.lua' +} + +server_scripts { + '@es_extended/locale.lua', + 'locales/br.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'config.lua', + 'server/main.lua' +} From c041e1834ffdb0be7f7948292d108226595148dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Fri, 15 Sep 2017 15:30:12 +0200 Subject: [PATCH 25/66] chore(resource): Add version --- __resource.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/__resource.lua b/__resource.lua index fd64bbc2..09326032 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,6 +2,8 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Mecano Job' +version '1.0.0' + client_scripts { '@es_extended/locale.lua', 'locales/en.lua', From b837f95794a0d62e03f13ac9456ec222dc5f07e4 Mon Sep 17 00:00:00 2001 From: LuaDeldu Date: Wed, 8 Nov 2017 19:25:25 +0100 Subject: [PATCH 26/66] Fix vehicle delivery Mecanos must be in VehicleDelivery to complete NPCJobMission ! No more glitches --- client/main.lua | 26 +++++++++++++++++++++----- locales/fr.lua | 1 + 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/client/main.lua b/client/main.lua index 9fb72829..b32693ee 100644 --- a/client/main.lua +++ b/client/main.lua @@ -27,6 +27,7 @@ local NPCTargetTowableZone = nil local NPCHasSpawnedTowable = false local NPCLastCancel = GetGameTimer() - 5 * 60000 local NPCHasBeenNextToTowable = false +local NPCTargetDeleterZone = false ESX = nil GUI.Time = 0 @@ -567,13 +568,20 @@ function OpenMobileMecanoActionsMenu() if NPCOnJob then - if CurrentlyTowedVehicle == NPCTargetTowable then - ESX.Game.DeleteVehicle(NPCTargetTowable) - TriggerServerEvent('esx_mecanojob:onNPCJobMissionCompleted') - StopNPCJob() + if NPCTargetDeleterZone then + + if CurrentlyTowedVehicle == NPCTargetTowable then + ESX.Game.DeleteVehicle(NPCTargetTowable) + TriggerServerEvent('esx_mecanojob:onNPCJobMissionCompleted') + StopNPCJob() + NPCTargetDeleterZone = false + + else + ESX.ShowNotification(_U('not_right_veh')) + end else - ESX.ShowNotification(_U('not_right_veh')) + ESX.ShowNotification(_U('not_right_place')) end end @@ -886,6 +894,10 @@ AddEventHandler('esx_mecanojob:hasEnteredMarker', function(zone) end + if zone =='VehicleDelivery' then + NPCTargetDeleterZone = true + end + if zone == 'MecanoActions' then CurrentAction = 'mecano_actions_menu' CurrentActionMsg = _U('open_actions') @@ -922,6 +934,10 @@ end) AddEventHandler('esx_mecanojob:hasExitedMarker', function(zone) + if zone =='VehicleDelivery' then + NPCTargetDeleterZone = false + end + if zone == 'Craft' then TriggerServerEvent('esx_mecanojob:stopCraft') TriggerServerEvent('esx_mecanojob:stopCraft2') diff --git a/locales/fr.lua b/locales/fr.lua index aacdc13e..90409948 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -62,6 +62,7 @@ Locales['fr'] = { ['please_tow'] = 'veuillez ~y~remorquer~s~ le véhicule', ['wait_five'] = 'Vous devez ~r~attendre~s~ 5 minutes', ['must_in_flatbed'] = 'Vous devez être en flatbed pour commencer la mission', + ['not_right_place'] = 'Vous devez être au bon endroit pour faire cela', ['mechanic_customer'] = 'client mecano', ['you_do_not_room'] = '~r~Vous n\'avez plus de place', ['recovery_gas_can'] = 'Récupération de ~b~bouteille de gaz~s~...', From 16a25c4c6a3d94ba1a8e3bdd584c3e8d586c0045 Mon Sep 17 00:00:00 2001 From: Sylundef Date: Fri, 10 Nov 2017 02:18:45 +0100 Subject: [PATCH 27/66] Avoid getting more item than possible --- server/main.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/main.lua b/server/main.lua index 44cd7b45..ad359584 100644 --- a/server/main.lua +++ b/server/main.lua @@ -324,8 +324,9 @@ AddEventHandler('esx_mecanojob:putStockItems', function(itemName, count) TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) local item = inventory.getItem(itemName) + local playerItemCount = xPlayer.getInventoryItem(itemName).count - if item.count >= 0 then + if item.count >= 0 and count <= playerItemCount then xPlayer.removeInventoryItem(itemName, count) inventory.addItem(itemName, count) else From 674ad72a343485ad7bdf73918bd2b6451fc7a588 Mon Sep 17 00:00:00 2001 From: KandaSoranyan <32266067+KandaSoranyan@users.noreply.github.com> Date: Mon, 29 Jan 2018 17:49:14 +0100 Subject: [PATCH 28/66] prevent sending negativ bill --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index b32693ee..0f5a2604 100644 --- a/client/main.lua +++ b/client/main.lua @@ -374,7 +374,7 @@ function OpenMobileMecanoActionsMenu() }, function(data, menu) local amount = tonumber(data.value) - if amount == nil then + if amount == nil or amount < 0 then ESX.ShowNotification(_U('amount_invalid')) else menu.close() From cfc2e037c3fca8a20fabc8223b8c7d9e0196cc10 Mon Sep 17 00:00:00 2001 From: Vanheden <33155577+Vanheden@users.noreply.github.com> Date: Wed, 7 Mar 2018 14:58:44 +0100 Subject: [PATCH 29/66] Create sv.lua --- locales/sv.lua | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 locales/sv.lua diff --git a/locales/sv.lua b/locales/sv.lua new file mode 100644 index 00000000..fcafea0a --- /dev/null +++ b/locales/sv.lua @@ -0,0 +1,82 @@ +Locales['sv'] = { + ['mechanic'] = 'mekaniker', + ['drive_to_indicated'] = '~y~Kör~s~ till den angivna platsen.', + ['mission_canceled'] = 'Uppdrag ~r~avbrutet~s~', + ['fordon_list'] = 'fordons lista', + ['work_wear'] = 'arbetskläder', + ['civ_wear'] = 'civil kläder', + ['deposit_stock'] = 'insättning fond', + ['withdraw_stock'] = 'annullera fond', + ['boss_actions'] = 'boss Actions', + ['service_fordon'] = 'service fordon', + ['flat_bed'] = 'flatbed', + ['tow_truck'] = 'tow Truck', + ['service_full'] = 'service fullt: ', + ['open_actions'] = 'tryck ~INPUT_CONTEXT~ för att öppna menyn.', + ['harvest'] = 'bärga', + ['harvest_menu'] = 'tryck ~INPUT_CONTEXT~ för att öppna bärningsmenyn.', + ['not_experienced_enough'] = 'du har inte tillräckligt med ~r~erfarenheter~s~ för att göra detta.', + ['gas_can'] = 'bensindunk', + ['repair_tools'] = 'reparationsverktyg', + ['body_work_tools'] = 'karossverktyg', + ['blowtorch'] = 'blåslampa', + ['repair_kit'] = 'reparationssats', + ['body_kit'] = 'kroppssats', + ['craft'] = 'hantverk', + ['craft_menu'] = 'tryck ~INPUT_CONTEXT~ för att komma till hantverksmenyn.', + ['billing'] = 'fakturering', + ['hijack'] = 'kapa', + ['repair'] = 'reparera', + ['clean'] = 'rengör', + ['imp_veh'] = 'beslagta', + ['place_objects'] = 'placera Objekt', + ['invoice_amount'] = 'fakturabelopp', + ['amount_invalid'] = 'Ogiltigt belopp', + ['no_players_nearby'] = 'inga spelare nära', + ['vehicle_unlocked'] = 'fordon ~g~Olåst', + ['vehicle_repaired'] = 'fordon ~g~Reparerat', + ['vehicle_cleaned'] = 'fordon ~g~Rengjort', + ['vehicle_impounded'] = 'fordon ~r~Beslagtagit', + ['must_seat_driver'] = 'du måste sitta i ~r~förarsätet!', + ['must_near'] = 'du måste vara ~r~nära ett fordon~s~ för att beslagta.', + ['fordon_success_attached'] = 'fordon ~b~påkopplat~s~!.', + ['please_drop_off'] = 'vänligen släpp av fordonet hos bilförsäljaren', + ['cant_attach_own_tt'] = '~r~du kan inte~s~ koppla på din egna tow truck', + ['no_veh_att'] = 'det finns inget ~r~fordon~s~ att koppla på', + ['not_right_veh'] = 'detta är inte korrekt fordon', + ['veh_det_succ'] = 'fordon ~b~avkopplat~s~!', + ['imp_flatbed'] = '~r~Åtgärd omöjligt!~s~ Du behöver en ~b~Flatbed~s~ för att kunna göra detta', + ['objects'] = 'föremål', + ['roadcone'] = 'vägkon', + ['toolbox'] = 'verktygslåda', + ['mechanic_stock'] = 'mekaniker Fond', + ['quantity'] = 'mängd', + ['invalid_quantity'] = 'ogiltig mängd', + ['inventory'] = 'förråd', + ['veh_unlocked'] = '~g~fordon Olåst', + ['hijack_failed'] = '~r~Kapning misslyckat', + ['body_repaired'] = '~g~Body reparerat', + ['veh_repaired'] = '~g~fordon reparerat', + ['veh_stored'] = 'tryck ~INPUT_CONTEXT~ för att spara fordon.', + ['tryck_remove_obj'] = 'tryck ~INPUT_CONTEXT~ för att ta bort föremål', + ['please_tow'] = 'vänligen ~y~bogsera~s~ fordonet', + ['wait_five'] = 'du måste ~r~vänta~s~ 5 minuter', + ['must_in_flatbed'] = 'du måste vara i en flatbed för att påbörja uppdraget', + ['mechanic_customer'] = 'mekaniker Kund', + ['you_do_not_room'] = '~r~Du har inte mer utrymme', + ['recovery_gas_can'] = '~b~Bensindunks~s~ hämtning...', + ['recovery_repair_tools'] = '~b~Reparationsverktygs~s~ hämtning...', + ['recovery_body_tools'] = '~b~Kroppsverktygs~s~ hämtning...', + ['not_enough_gas_can'] = 'Du har inte ~r~tillräckligt~s~ med bensindunkar.', + ['assembling_blowtorch'] = 'Monterar ~b~Blåslampa~s~...', + ['not_enough_repair_tools'] = 'Du har inte ~r~tillräckligt~s~ Reparationsverktyg.', + ['assembling_repair_kit'] = 'Monterar ~b~Reparationsverktyg~s~...', + ['not_enough_body_tools'] = 'Du har inte ~r~tillräckligt~s~ Kroppsverktyg.', + ['assembling_body_kit'] = 'Monterar ~b~Kroppsverktyg~s~...', + ['your_comp_earned'] = 'ditt företag har ~g~fått~s~ ~g~$', + ['you_used_blowtorch'] = 'du använde en ~b~Blåslampa', + ['you_used_repair_kit'] = 'du använde ~b~Reparationsverktyg', + ['you_used_body_kit'] = 'du använde ~b~Kroppsverktyg', + ['you_removed'] = 'du har tagit bort x', + ['you_added'] = 'du har lagt till x', +} From d0e71684842b9098ea317cfc11d57fbf7f17d299 Mon Sep 17 00:00:00 2001 From: Vanheden <33155577+Vanheden@users.noreply.github.com> Date: Wed, 7 Mar 2018 14:59:15 +0100 Subject: [PATCH 30/66] Update __resource.lua --- __resource.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/__resource.lua b/__resource.lua index 09326032..8b44d660 100644 --- a/__resource.lua +++ b/__resource.lua @@ -8,6 +8,7 @@ client_scripts { '@es_extended/locale.lua', 'locales/en.lua', 'locales/fr.lua', + 'locales/sv.lua', 'config.lua', 'client/main.lua' } @@ -16,6 +17,7 @@ server_scripts { '@es_extended/locale.lua', 'locales/en.lua', 'locales/fr.lua', + 'locales/sv.lua', 'config.lua', 'server/main.lua' } From 4baac7d4c737318bfdd302a689b6365ec6eaf8cc Mon Sep 17 00:00:00 2001 From: Vanheden <33155577+Vanheden@users.noreply.github.com> Date: Wed, 7 Mar 2018 15:01:39 +0100 Subject: [PATCH 31/66] Create esx_mecanojob_sv.sql --- localization/esx_mecanojob_sv.sql | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 localization/esx_mecanojob_sv.sql diff --git a/localization/esx_mecanojob_sv.sql b/localization/esx_mecanojob_sv.sql new file mode 100644 index 00000000..b2bcfcbb --- /dev/null +++ b/localization/esx_mecanojob_sv.sql @@ -0,0 +1,30 @@ +USE `essentialmode`; + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_mecano','Mekaniker',1) +; + +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_mecano','Mekaniker',1) +; + +INSERT INTO `jobs` (name, label) VALUES + ('mecano','Mekaniker') +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('mecano',0,'Rekryt','Recruit',12,'{}','{}'), + ('mecano',1,'Nyanställd','Novice',24,'{}','{}'), + ('mecano',2,'Erfaren','Experienced',36,'{}','{}'), + ('mecano',3,'Chef','Leader',48,'{}','{}'), + ('mecano',4,'Bossen','Boss',0,'{}','{}') +; + +INSERT INTO `items` (name, label) VALUES + ('gazbottle', 'Gas Flaska'), + ('fixtool', 'Reparationsverktyg'), + ('carotool', 'Verktyg'), + ('blowpipe', 'Blåslampa'), + ('fixkit', 'Reparationssats'), + ('carokit', 'Plåt Verktyg') +; From f2903fc97b57ce5b41c0a98ed4c8423f5b059fd2 Mon Sep 17 00:00:00 2001 From: Vanheden <33155577+Vanheden@users.noreply.github.com> Date: Wed, 7 Mar 2018 15:02:44 +0100 Subject: [PATCH 32/66] Update esx_mecanojob_sv.sql --- localization/esx_mecanojob_sv.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/localization/esx_mecanojob_sv.sql b/localization/esx_mecanojob_sv.sql index b2bcfcbb..8c78e056 100644 --- a/localization/esx_mecanojob_sv.sql +++ b/localization/esx_mecanojob_sv.sql @@ -13,11 +13,11 @@ INSERT INTO `jobs` (name, label) VALUES ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('mecano',0,'Rekryt','Recruit',12,'{}','{}'), - ('mecano',1,'Nyanställd','Novice',24,'{}','{}'), - ('mecano',2,'Erfaren','Experienced',36,'{}','{}'), - ('mecano',3,'Chef','Leader',48,'{}','{}'), - ('mecano',4,'Bossen','Boss',0,'{}','{}') + ('mecano',0,'recrue','Rekryt',12,'{}','{}'), + ('mecano',1,'novice','Nyanställd',24,'{}','{}'), + ('mecano',2,'experimente','Erfaren',36,'{}','{}'), + ('mecano',3,'chief','Chef',48,'{}','{}'), + ('mecano',4,'boss','Bossen',0,'{}','{}') ; INSERT INTO `items` (name, label) VALUES From 5b51d3f26b08af1e73d97fd487dc75c4c5adf921 Mon Sep 17 00:00:00 2001 From: scorpio686 <31187145+scorpio686@users.noreply.github.com> Date: Wed, 28 Mar 2018 13:17:31 +0200 Subject: [PATCH 33/66] Update main.lua --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index 0f5a2604..5eedc6d2 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1150,7 +1150,7 @@ Citizen.CreateThread(function() if GetEntityModel(vehicle) == GetHashKey('flatbed') or - GetEntityModel(vehicle) == GetHashKey('towtrcuk2') or + GetEntityModel(vehicle) == GetHashKey('towtruck2') or GetEntityModel(vehicle) == GetHashKey('slamvan3') then TriggerServerEvent('esx_service:disableService', 'mecano') From ee1b71cbad4935f7c46096725e645c0ec86f0e3b Mon Sep 17 00:00:00 2001 From: sabbo2001 Date: Sun, 29 Apr 2018 19:49:16 +0200 Subject: [PATCH 34/66] Solve Time Resource Warning --- client/main.lua | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/client/main.lua b/client/main.lua index 5eedc6d2..33e71e1e 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1082,23 +1082,45 @@ Citizen.CreateThread(function() end) Citizen.CreateThread(function() + + local trackedEntities = { + 'prop_roadcone02a', + 'prop_toolchest_01' + } + while true do - Citizen.Wait(0) + Citizen.Wait(10) local playerPed = GetPlayerPed(-1) local coords = GetEntityCoords(playerPed) - local entity, distance = ESX.Game.GetClosestObject({ - 'prop_roadcone02a', - 'prop_toolchest_01' - }) + local closestDistance = -1 + local closestEntity = nil - if distance ~= -1 and distance <= 3.0 then + for i=1, #trackedEntities, 1 do - if LastEntity ~= entity then - TriggerEvent('esx_mecanojob:hasEnteredEntityZone', entity) - LastEntity = entity + local object = GetClosestObjectOfType(coords.x, coords.y, coords.z, 3.0, GetHashKey(trackedEntities[i]), false, false, false) + + if DoesEntityExist(object) then + + local objCoords = GetEntityCoords(object) + local distance = GetDistanceBetweenCoords(coords.x, coords.y, coords.z, objCoords.x, objCoords.y, objCoords.z, true) + + 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_mecanojob:hasEnteredEntityZone', closestEntity) + LastEntity = closestEntity end else @@ -1113,7 +1135,6 @@ Citizen.CreateThread(function() end end) - -- Key Controls Citizen.CreateThread(function() while true do From 8fbc5b27c5f4ccbb1a446a72e140a46b36bd898b Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Mon, 30 Apr 2018 16:27:37 +0200 Subject: [PATCH 35/66] Dead cannot use F6, proper alignment, missing SQL info, i18n fixes --- __resource.lua | 28 ++++--- client/main.lua | 35 ++++++-- esx_mecanojob.sql | 30 +++---- locales/br.lua | 2 +- locales/sv.lua | 128 +++++++++++++++--------------- localization/esx_mecanojob_en.sql | 30 +++---- localization/esx_mecanojob_sv.sql | 30 +++---- 7 files changed, 152 insertions(+), 131 deletions(-) diff --git a/__resource.lua b/__resource.lua index 8b44d660..78891252 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,22 +2,24 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Mecano Job' -version '1.0.0' +version '1.1.0' client_scripts { - '@es_extended/locale.lua', - 'locales/en.lua', - 'locales/fr.lua', - 'locales/sv.lua', - 'config.lua', - 'client/main.lua' + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'locales/br.lua', + 'locales/sv.lua', + 'config.lua', + 'client/main.lua' } server_scripts { - '@es_extended/locale.lua', - 'locales/en.lua', - 'locales/fr.lua', - 'locales/sv.lua', - 'config.lua', - 'server/main.lua' + '@es_extended/locale.lua', + 'locales/en.lua', + 'locales/fr.lua', + 'locales/br.lua', + 'locales/sv.lua', + 'config.lua', + 'server/main.lua' } diff --git a/client/main.lua b/client/main.lua index 33e71e1e..9db24127 100644 --- a/client/main.lua +++ b/client/main.lua @@ -22,21 +22,25 @@ local TargetCoords = nil local CurrentlyTowedVehicle = nil local Blips = {} local NPCOnJob = false -local NPCTargetTowable = nil -local NPCTargetTowableZone = nil +local NPCTargetTowable = nil +local NPCTargetTowableZone = nil local NPCHasSpawnedTowable = false local NPCLastCancel = GetGameTimer() - 5 * 60000 local NPCHasBeenNextToTowable = false local NPCTargetDeleterZone = false +local IsDead = false ESX = nil GUI.Time = 0 Citizen.CreateThread(function() - while ESX == nil do - TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) - Citizen.Wait(0) - end + while ESX == nil do + TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) + Citizen.Wait(0) + end + + Citizen.Wait(5000) + PlayerData = ESX.GetPlayerData() end) function SelectRandomTowable() @@ -112,6 +116,7 @@ function OpenMecanoActionsMenu() 'default', GetCurrentResourceName(), 'mecano_actions', { title = _U('mechanic'), + align = 'top-left', elements = elements }, function(data, menu) @@ -174,6 +179,7 @@ function OpenMecanoActionsMenu() 'default', GetCurrentResourceName(), 'spawn_vehicle', { title = _U('service_vehicle'), + align = 'top-left', elements = elements }, function(data, menu) @@ -270,6 +276,7 @@ function OpenMecanoHarvestMenu() 'default', GetCurrentResourceName(), 'mecano_harvest', { title = _U('harvest'), + align = 'top-left', elements = elements }, function(data, menu) @@ -316,6 +323,7 @@ function OpenMecanoCraftMenu() 'default', GetCurrentResourceName(), 'mecano_craft', { title = _U('craft'), + align = 'top-left', elements = elements }, function(data, menu) @@ -355,6 +363,7 @@ function OpenMobileMecanoActionsMenu() 'default', GetCurrentResourceName(), 'mobile_mecano_actions', { title = _U('mechanic'), + align = 'top-left', elements = { {label = _U('billing'), value = 'billing'}, {label = _U('hijack'), value = 'hijack_vehicle'}, @@ -662,6 +671,7 @@ function OpenGetStocksMenu() 'default', GetCurrentResourceName(), 'stocks_menu', { title = _U('mechanic_stock'), + align = 'top-left', elements = elements }, function(data, menu) @@ -723,6 +733,7 @@ ESX.TriggerServerCallback('esx_mecanojob:getPlayerInventory', function(inventory 'default', GetCurrentResourceName(), 'stocks_menu', { title = _U('inventory'), + align = 'top-left', elements = elements }, function(data, menu) @@ -1190,11 +1201,11 @@ Citizen.CreateThread(function() end end - if IsControlJustReleased(0, Keys['F6']) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + if IsControlJustReleased(0, Keys['F6']) and not IsDead and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then OpenMobileMecanoActionsMenu() end - if IsControlJustReleased(0, Keys['DELETE']) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + if IsControlJustReleased(0, Keys['DELETE']) and not IsDead and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then if NPCOnJob then @@ -1221,3 +1232,11 @@ Citizen.CreateThread(function() end end) + +AddEventHandler('esx:onPlayerDeath', function() + IsDead = true +end) + +AddEventHandler('playerSpawned', function(spawn) + IsDead = false +end) \ No newline at end of file diff --git a/esx_mecanojob.sql b/esx_mecanojob.sql index 3e6459a1..d839578f 100644 --- a/esx_mecanojob.sql +++ b/esx_mecanojob.sql @@ -1,30 +1,30 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_mecano','Mécano',1) + ('society_mecano', 'Mécano', 1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_mecano','Mécano',1) + ('society_mecano', 'Mécano', 1) ; INSERT INTO `jobs` (name, label) VALUES - ('mecano','Mécano') + ('mecano', 'Mécano') ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('mecano',0,'recrue','Recrue',12,'{}','{}'), - ('mecano',1,'novice','Novice',24,'{}','{}'), - ('mecano',2,'experimente','Experimente',36,'{}','{}'), - ('mecano',3,'chief','Chef d\'équipe',48,'{}','{}'), - ('mecano',4,'boss','Patron',0,'{}','{}') + ('mecano',0,'recrue','Recrue',12,'{}','{}'), + ('mecano',1,'novice','Novice',24,'{}','{}'), + ('mecano',2,'experimente','Experimente',36,'{}','{}'), + ('mecano',3,'chief','Chef d\'équipe',48,'{}','{}'), + ('mecano',4,'boss','Patron',0,'{}','{}') ; -INSERT INTO `items` (name, label) VALUES - ('gazbottle', 'bouteille de gaz'), - ('fixtool', 'outils réparation'), - ('carotool', 'outils carosserie'), - ('blowpipe', 'Chalumeaux'), - ('fixkit', 'Kit réparation'), - ('carokit', 'Kit carosserie') +INSERT INTO `items` (name, label, limit) VALUES + ('gazbottle', 'bouteille de gaz', 11), + ('fixtool', 'outils réparation', 6), + ('carotool', 'outils carosserie', 4), + ('blowpipe', 'Chalumeaux', 10), + ('fixkit', 'Kit réparation', 5), + ('carokit', 'Kit carosserie', 3) ; diff --git a/locales/br.lua b/locales/br.lua index cd935a5f..799b868e 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -1,4 +1,4 @@ -Locales['en'] = { +Locales['br'] = { ['mechanic'] = 'Mecânico', ['drive_to_indicated'] = '~y~Dirija~s~ para a localização indicada.', ['mission_canceled'] = 'Missão ~r~cancelada~s~', diff --git a/locales/sv.lua b/locales/sv.lua index fcafea0a..d617f0f0 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -1,82 +1,82 @@ Locales['sv'] = { ['mechanic'] = 'mekaniker', - ['drive_to_indicated'] = '~y~Kör~s~ till den angivna platsen.', - ['mission_canceled'] = 'Uppdrag ~r~avbrutet~s~', - ['fordon_list'] = 'fordons lista', + ['drive_to_indicated'] = 'Vänligen ~y~kör~s~ till den angivna platsen.', + ['mission_canceled'] = '~r~Uppdraget har avbrutits~s~', + ['vehicle_list'] = 'Fordon', ['work_wear'] = 'arbetskläder', - ['civ_wear'] = 'civil kläder', - ['deposit_stock'] = 'insättning fond', - ['withdraw_stock'] = 'annullera fond', - ['boss_actions'] = 'boss Actions', - ['service_fordon'] = 'service fordon', + ['civ_wear'] = 'civil klädsel', + ['deposit_stock'] = 'Sätt in objekt', + ['withdraw_stock'] = 'Ta ut objekt', + ['boss_actions'] = 'Chef meny', + ['service_vehicle'] = 'service fordon', ['flat_bed'] = 'flatbed', - ['tow_truck'] = 'tow Truck', - ['service_full'] = 'service fullt: ', - ['open_actions'] = 'tryck ~INPUT_CONTEXT~ för att öppna menyn.', - ['harvest'] = 'bärga', - ['harvest_menu'] = 'tryck ~INPUT_CONTEXT~ för att öppna bärningsmenyn.', - ['not_experienced_enough'] = 'du har inte tillräckligt med ~r~erfarenheter~s~ för att göra detta.', - ['gas_can'] = 'bensindunk', + ['tow_truck'] = 'bärgningsbil', + ['service_full'] = 'service full: ', + ['open_actions'] = 'Tryck ~INPUT_CONTEXT~ för att öppna menyn.', + ['harvest'] = 'skörda', + ['harvest_menu'] = 'Tryck ~INPUT_CONTEXT~ för att öppna menyn.', + ['not_experienced_enough'] = 'Du är inte ~r~erfaren nog~s~ att utföra uppgiften.', + ['gas_can'] = 'gasbehållare', ['repair_tools'] = 'reparationsverktyg', ['body_work_tools'] = 'karossverktyg', ['blowtorch'] = 'blåslampa', ['repair_kit'] = 'reparationssats', ['body_kit'] = 'kroppssats', ['craft'] = 'hantverk', - ['craft_menu'] = 'tryck ~INPUT_CONTEXT~ för att komma till hantverksmenyn.', + ['craft_menu'] = 'Tryck ~INPUT_CONTEXT~ för att öppna menyn.', ['billing'] = 'fakturering', ['hijack'] = 'kapa', ['repair'] = 'reparera', - ['clean'] = 'rengör', + ['clean'] = 'Tvätta', ['imp_veh'] = 'beslagta', - ['place_objects'] = 'placera Objekt', + ['place_objects'] = 'placera objekt', ['invoice_amount'] = 'fakturabelopp', ['amount_invalid'] = 'Ogiltigt belopp', - ['no_players_nearby'] = 'inga spelare nära', - ['vehicle_unlocked'] = 'fordon ~g~Olåst', - ['vehicle_repaired'] = 'fordon ~g~Reparerat', - ['vehicle_cleaned'] = 'fordon ~g~Rengjort', - ['vehicle_impounded'] = 'fordon ~r~Beslagtagit', - ['must_seat_driver'] = 'du måste sitta i ~r~förarsätet!', - ['must_near'] = 'du måste vara ~r~nära ett fordon~s~ för att beslagta.', - ['fordon_success_attached'] = 'fordon ~b~påkopplat~s~!.', - ['please_drop_off'] = 'vänligen släpp av fordonet hos bilförsäljaren', - ['cant_attach_own_tt'] = '~r~du kan inte~s~ koppla på din egna tow truck', - ['no_veh_att'] = 'det finns inget ~r~fordon~s~ att koppla på', - ['not_right_veh'] = 'detta är inte korrekt fordon', - ['veh_det_succ'] = 'fordon ~b~avkopplat~s~!', - ['imp_flatbed'] = '~r~Åtgärd omöjligt!~s~ Du behöver en ~b~Flatbed~s~ för att kunna göra detta', - ['objects'] = 'föremål', - ['roadcone'] = 'vägkon', + ['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~', + ['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~', + ['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', + ['veh_det_succ'] = 'fordonet har ~b~lossnat~s~!', + ['imp_flatbed'] = '~r~Det går inte!~s~ Du måste ha en ~b~Flatbed~s~ för det!', + ['objects'] = 'objekt', + ['roadcone'] = 'kona', ['toolbox'] = 'verktygslåda', - ['mechanic_stock'] = 'mekaniker Fond', - ['quantity'] = 'mängd', - ['invalid_quantity'] = 'ogiltig mängd', + ['mechanic_stock'] = 'mekaniker lager', + ['quantity'] = 'kvantitet', + ['invalid_quantity'] = 'ogiltig kvantitet', ['inventory'] = 'förråd', - ['veh_unlocked'] = '~g~fordon Olåst', - ['hijack_failed'] = '~r~Kapning misslyckat', - ['body_repaired'] = '~g~Body reparerat', - ['veh_repaired'] = '~g~fordon reparerat', - ['veh_stored'] = 'tryck ~INPUT_CONTEXT~ för att spara fordon.', - ['tryck_remove_obj'] = 'tryck ~INPUT_CONTEXT~ för att ta bort föremål', - ['please_tow'] = 'vänligen ~y~bogsera~s~ fordonet', - ['wait_five'] = 'du måste ~r~vänta~s~ 5 minuter', - ['must_in_flatbed'] = 'du måste vara i en flatbed för att påbörja uppdraget', - ['mechanic_customer'] = 'mekaniker Kund', - ['you_do_not_room'] = '~r~Du har inte mer utrymme', - ['recovery_gas_can'] = '~b~Bensindunks~s~ hämtning...', - ['recovery_repair_tools'] = '~b~Reparationsverktygs~s~ hämtning...', - ['recovery_body_tools'] = '~b~Kroppsverktygs~s~ hämtning...', - ['not_enough_gas_can'] = 'Du har inte ~r~tillräckligt~s~ med bensindunkar.', - ['assembling_blowtorch'] = 'Monterar ~b~Blåslampa~s~...', - ['not_enough_repair_tools'] = 'Du har inte ~r~tillräckligt~s~ Reparationsverktyg.', - ['assembling_repair_kit'] = 'Monterar ~b~Reparationsverktyg~s~...', - ['not_enough_body_tools'] = 'Du har inte ~r~tillräckligt~s~ Kroppsverktyg.', - ['assembling_body_kit'] = 'Monterar ~b~Kroppsverktyg~s~...', - ['your_comp_earned'] = 'ditt företag har ~g~fått~s~ ~g~$', - ['you_used_blowtorch'] = 'du använde en ~b~Blåslampa', - ['you_used_repair_kit'] = 'du använde ~b~Reparationsverktyg', - ['you_used_body_kit'] = 'du använde ~b~Kroppsverktyg', - ['you_removed'] = 'du har tagit bort x', - ['you_added'] = 'du har lagt till x', -} + ['veh_unlocked'] = '~g~Fordon har låsts upp', + ['hijack_failed'] = '~r~Kapningen misslyckades', + ['body_repaired'] = '~g~Karossen har lagats', + ['veh_repaired'] = '~g~Fordonet har lagats', + ['veh_stored'] = 'tryck ~INPUT_CONTEXT~ för att förvara fordonet.', + ['press_remove_obj'] = 'tryck ~INPUT_CONTEXT~ för att ta bort objektet.', + ['please_tow'] = 'Vänligen ~y~bogsera~s~ fordonet', + ['wait_five'] = 'Du måste ~r~vänta~s~ 5 minuter', + ['must_in_flatbed'] = 'Du måste vara i en ~y~flatbed~s~ för att starta uppdraget', + ['mechanic_customer'] = 'mekaniker kund', + ['you_do_not_room'] = '~r~Du har inte mer plats', + ['recovery_gas_can'] = '~b~Gasbehållare~s~ återvinns...', + ['recovery_repair_tools'] = '~b~Reparationsverktyg~s~ återvinns...', + ['recovery_body_tools'] = '~b~Karossverktyg~s~ återvinns...', + ['not_enough_gas_can'] = 'Du har ~r~inte tillräckligt~s~ många gasbehållare!', + ['assembling_blowtorch'] = 'Tillverkar ~b~blåslampa~s~...', + ['not_enough_repair_tools'] = 'Du har ~r~inte tillräckligt~s~ många reparationsverktyg!', + ['assembling_repair_kit'] = 'Tillverkar ~b~reparationssats~s~...', + ['not_enough_body_tools'] = 'Du har ~r~inte tillräckligt~s~ många karossverktyg!', + ['assembling_body_kit'] = 'Tillverkar ~b~karossverktyg~s~...', + ['your_comp_earned'] = 'ditt företag har ~g~tjänat~s~ ~g~$', + ['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' +} \ No newline at end of file diff --git a/localization/esx_mecanojob_en.sql b/localization/esx_mecanojob_en.sql index 31c457f2..8d223092 100644 --- a/localization/esx_mecanojob_en.sql +++ b/localization/esx_mecanojob_en.sql @@ -1,30 +1,30 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_mecano','Mechanic',1) + ('society_mecano', 'Mechanic', 1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_mecano','Mechanic',1) + ('society_mecano', 'Mechanic', 1) ; INSERT INTO `jobs` (name, label) VALUES - ('mecano','Mechanic') + ('mecano', 'Mechanic') ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('mecano',0,'recrue','Recruit',12,'{}','{}'), - ('mecano',1,'novice','Novice',24,'{}','{}'), - ('mecano',2,'experimente','Experienced',36,'{}','{}'), - ('mecano',3,'chief','Leader',48,'{}','{}'), - ('mecano',4,'boss','Boss',0,'{}','{}') + ('mecano',0,'recrue','Recruit',12,'{}','{}'), + ('mecano',1,'novice','Novice',24,'{}','{}'), + ('mecano',2,'experimente','Experienced',36,'{}','{}'), + ('mecano',3,'chief','Leader',48,'{}','{}'), + ('mecano',4,'boss','Boss',0,'{}','{}') ; -INSERT INTO `items` (name, label) VALUES - ('gazbottle', 'Gas Bottle'), - ('fixtool', 'Repair Tools'), - ('carotool', 'Tools'), - ('blowpipe', 'Blowtorch'), - ('fixkit', 'Repair Kit'), - ('carokit', 'Body Kit') +INSERT INTO `items` (name, label, limit) VALUES + ('gazbottle', 'Gas Bottle', 11), + ('fixtool', 'Repair Tools', 6), + ('carotool', 'Tools', 4), + ('blowpipe', 'Blowtorch', 10), + ('fixkit', 'Repair Kit', 5), + ('carokit', 'Body Kit', 3) ; diff --git a/localization/esx_mecanojob_sv.sql b/localization/esx_mecanojob_sv.sql index 8c78e056..ad085adf 100644 --- a/localization/esx_mecanojob_sv.sql +++ b/localization/esx_mecanojob_sv.sql @@ -1,30 +1,30 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_mecano','Mekaniker',1) + ('society_mecano', 'Mekaniker', 1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_mecano','Mekaniker',1) + ('society_mecano', 'Mekaniker', 1) ; INSERT INTO `jobs` (name, label) VALUES - ('mecano','Mekaniker') + ('mecano', 'Mekaniker') ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('mecano',0,'recrue','Rekryt',12,'{}','{}'), - ('mecano',1,'novice','Nyanställd',24,'{}','{}'), - ('mecano',2,'experimente','Erfaren',36,'{}','{}'), - ('mecano',3,'chief','Chef',48,'{}','{}'), - ('mecano',4,'boss','Bossen',0,'{}','{}') + ('mecano',0,'recrue','Rekryt',12,'{}','{}'), + ('mecano',1,'novice','Nyanställd',24,'{}','{}'), + ('mecano',2,'experimente','Erfaren',36,'{}','{}'), + ('mecano',3,'chief','Chef',48,'{}','{}'), + ('mecano',4,'boss','Ägare',0,'{}','{}') ; -INSERT INTO `items` (name, label) VALUES - ('gazbottle', 'Gas Flaska'), - ('fixtool', 'Reparationsverktyg'), - ('carotool', 'Verktyg'), - ('blowpipe', 'Blåslampa'), - ('fixkit', 'Reparationssats'), - ('carokit', 'Plåt Verktyg') +INSERT INTO `items` (name, label, limit) VALUES + ('gazbottle', 'Gas Flaska', 11), + ('fixtool', 'Reparationsverktyg', 6), + ('carotool', 'Verktyg', 4), + ('blowpipe', 'Blåslampa', 10), + ('fixkit', 'Reparationssats', 5), + ('carokit', 'Karosskit', 3) ; From d5520be5d77000824c0929ff7ccf570198fb0df8 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Thu, 3 May 2018 16:41:34 +0200 Subject: [PATCH 36/66] Fixed SQL file, closes #19 --- __resource | 21 --------------------- esx_mecanojob.sql | 2 +- localization/esx_mecanojob_en.sql | 2 +- localization/esx_mecanojob_sv.sql | 2 +- 4 files changed, 3 insertions(+), 24 deletions(-) delete mode 100644 __resource diff --git a/__resource b/__resource deleted file mode 100644 index dd8b8e2d..00000000 --- a/__resource +++ /dev/null @@ -1,21 +0,0 @@ -resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' - -description 'ESX Mecano Job' - -client_scripts { - '@es_extended/locale.lua', - 'locales/br.lua', - 'locales/en.lua', - 'locales/fr.lua', - 'config.lua', - 'client/main.lua' -} - -server_scripts { - '@es_extended/locale.lua', - 'locales/br.lua', - 'locales/en.lua', - 'locales/fr.lua', - 'config.lua', - 'server/main.lua' -} diff --git a/esx_mecanojob.sql b/esx_mecanojob.sql index d839578f..9bb4bf5d 100644 --- a/esx_mecanojob.sql +++ b/esx_mecanojob.sql @@ -20,7 +20,7 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ('mecano',4,'boss','Patron',0,'{}','{}') ; -INSERT INTO `items` (name, label, limit) VALUES +INSERT INTO `items` (name, label, `limit`) VALUES ('gazbottle', 'bouteille de gaz', 11), ('fixtool', 'outils réparation', 6), ('carotool', 'outils carosserie', 4), diff --git a/localization/esx_mecanojob_en.sql b/localization/esx_mecanojob_en.sql index 8d223092..8fda8b83 100644 --- a/localization/esx_mecanojob_en.sql +++ b/localization/esx_mecanojob_en.sql @@ -20,7 +20,7 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ('mecano',4,'boss','Boss',0,'{}','{}') ; -INSERT INTO `items` (name, label, limit) VALUES +INSERT INTO `items` (name, label, `limit`) VALUES ('gazbottle', 'Gas Bottle', 11), ('fixtool', 'Repair Tools', 6), ('carotool', 'Tools', 4), diff --git a/localization/esx_mecanojob_sv.sql b/localization/esx_mecanojob_sv.sql index ad085adf..a6bd08f8 100644 --- a/localization/esx_mecanojob_sv.sql +++ b/localization/esx_mecanojob_sv.sql @@ -20,7 +20,7 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ('mecano',4,'boss','Ägare',0,'{}','{}') ; -INSERT INTO `items` (name, label, limit) VALUES +INSERT INTO `items` (name, label, `limit`) VALUES ('gazbottle', 'Gas Flaska', 11), ('fixtool', 'Reparationsverktyg', 6), ('carotool', 'Verktyg', 4), From 1ea1c5b2037d2717d3e77be6404751633e35dbb8 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 5 May 2018 23:56:51 +0200 Subject: [PATCH 37/66] Use new ESX function, secutiy fixes and cleanup --- client/main.lua | 54 ++++++++------------------- locales/br.lua | 1 + locales/en.lua | 1 + locales/fr.lua | 1 + locales/sv.lua | 3 +- server/main.lua | 98 +++++++++++++++++++------------------------------ 6 files changed, 57 insertions(+), 101 deletions(-) diff --git a/client/main.lua b/client/main.lua index 9db24127..0c9347e1 100644 --- a/client/main.lua +++ b/client/main.lua @@ -490,30 +490,26 @@ function OpenMobileMecanoActionsMenu() if data.current.value == 'del_vehicle' then - local ped = GetPlayerPed( -1 ) + local ped = GetPlayerPed(-1) - if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then + if DoesEntityExist(ped) and not IsEntityDead(ped) then local pos = GetEntityCoords( ped ) - if ( IsPedSittingInAnyVehicle( ped ) ) then + if IsPedSittingInAnyVehicle(ped) then local vehicle = GetVehiclePedIsIn( ped, false ) - if ( GetPedInVehicleSeat( vehicle, -1 ) == ped ) then + if GetPedInVehicleSeat(vehicle, -1) == ped then ESX.ShowNotification(_U('vehicle_impounded')) - SetEntityAsMissionEntity( vehicle, true, true ) - deleteCar( vehicle ) + ESX.Game.DeleteVehicle(vehicle) else ESX.ShowNotification(_U('must_seat_driver')) end else - local playerPos = GetEntityCoords( ped, 1 ) - local inFrontOfPlayer = GetOffsetFromEntityInWorldCoords( ped, 0.0, distanceToCheck, 0.0 ) - local vehicle = GetVehicleInDirection( playerPos, inFrontOfPlayer ) + local vehicle = ESX.Game.GetVehicleInDirection() - if ( DoesEntityExist( vehicle ) ) then + if DoesEntityExist(vehicle) then ESX.ShowNotification(_U('vehicle_impounded')) - SetEntityAsMissionEntity( vehicle, true, true ) - deleteCar( vehicle ) + ESX.Game.DeleteVehicle(vehicle) else ESX.ShowNotification(_U('must_near')) end @@ -530,10 +526,7 @@ function OpenMobileMecanoActionsMenu() local isVehicleTow = IsVehicleModel(vehicle, towmodel) if isVehicleTow then - - local coordA = GetEntityCoords(playerped, 1) - local coordB = GetOffsetFromEntityInWorldCoords(playerped, 0.0, 5.0, 0.0) - local targetVehicle = getVehicleInDirection(coordA, coordB) + local targetVehicle = ESX.Game.GetVehicleInDirection() if CurrentlyTowedVehicle == nil then if targetVehicle ~= 0 then @@ -656,11 +649,7 @@ function OpenMobileMecanoActionsMenu() end function OpenGetStocksMenu() - ESX.TriggerServerCallback('esx_mecanojob:getStockItems', function(items) - - print(json.encode(items)) - local elements = {} for i=1, #items, 1 do @@ -692,9 +681,10 @@ function OpenGetStocksMenu() else menu2.close() menu.close() - OpenGetStocksMenu() - TriggerServerEvent('esx_mecanojob:getStockItem', itemName, count) + + Citizen.Wait(1000) + OpenGetStocksMenu() end end, @@ -754,9 +744,10 @@ ESX.TriggerServerCallback('esx_mecanojob:getPlayerInventory', function(inventory else menu2.close() menu.close() - OpenPutStocksMenu() - TriggerServerEvent('esx_mecanojob:putStockItems', itemName, count) + + Citizen.Wait(1000) + OpenPutStocksMenu() end end, @@ -874,21 +865,6 @@ AddEventHandler('esx_mecanojob:onFixkit', function() end end) -function setEntityHeadingFromEntity ( vehicle, playerPed ) - local heading = GetEntityHeading(vehicle) - SetEntityHeading( playerPed, heading ) -end - -function getVehicleInDirection(coordFrom, coordTo) - local rayHandle = CastRayPointToPoint(coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 10, GetPlayerPed(-1), 0) - local a, b, c, d, vehicle = GetRaycastResult(rayHandle) - return vehicle -end - -function deleteCar( entity ) - Citizen.InvokeNative( 0xEA386986E786A54F, Citizen.PointerValueIntInitialized( entity ) ) -end - RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer) PlayerData = xPlayer diff --git a/locales/br.lua b/locales/br.lua index 799b868e..e5dd9b0a 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -79,4 +79,5 @@ Locales['br'] = { ['you_used_body_kit'] = 'Você usou um ~b~Kit de corpo', ['you_removed'] = 'Você removeu x', ['you_added'] = 'Você adicionou x', + ['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 ba70ae8f..b04bee39 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -79,4 +79,5 @@ Locales['en'] = { ['you_used_body_kit'] = 'you used a ~b~Body Kit', ['you_removed'] = 'you have removed x', ['you_added'] = 'you have added x', + ['player_cannot_hold'] = 'you do ~r~not~w~ have enough ~y~free space~w~ in your inventory!', } diff --git a/locales/fr.lua b/locales/fr.lua index 90409948..06f6da76 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -80,4 +80,5 @@ Locales['fr'] = { ['you_used_body_kit'] = 'Vous avez utilisé un ~b~Kit de carosserie', ['you_removed'] = 'vous avez retiré x', ['you_added'] = 'Vous avez ajouté x', + ['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 d617f0f0..2ae76b55 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -78,5 +78,6 @@ Locales['sv'] = { ['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' + ['you_added'] = 'du ~y~la till~s~ x', + ['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 ad359584..954c6e07 100644 --- a/server/main.lua +++ b/server/main.lua @@ -15,8 +15,6 @@ end TriggerEvent('esx_phone:registerNumber', 'mecano', _U('mechanic_customer'), true, true) TriggerEvent('esx_society:registerSociety', 'mecano', 'Mecano', 'society_mecano', 'society_mecano', 'society_mecano', {type = 'private'}) --------------- Récupération bouteille de gaz ------------- ----- Sqlut je teste ------ local function Harvest(source) SetTimeout(4000, function() @@ -29,8 +27,7 @@ local function Harvest(source) if GazBottleQuantity >= 5 then TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) else - xPlayer.addInventoryItem('gazbottle', 1) - + xPlayer.addInventoryItem('gazbottle', 1) Harvest(source) end end @@ -62,8 +59,7 @@ local function Harvest2(source) if FixToolQuantity >= 5 then TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) else - xPlayer.addInventoryItem('fixtool', 1) - + xPlayer.addInventoryItem('fixtool', 1) Harvest2(source) end end @@ -83,7 +79,7 @@ AddEventHandler('esx_mecanojob:stopHarvest2', function() local _source = source PlayersHarvesting2[_source] = false end) ------------------ Récupération Outils Carosserie ---------------- + local function Harvest3(source) SetTimeout(4000, function() @@ -92,11 +88,10 @@ local function Harvest3(source) local xPlayer = ESX.GetPlayerFromId(source) local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count - if CaroToolQuantity >= 5 then + if CaroToolQuantity >= 5 then TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) else - xPlayer.addInventoryItem('carotool', 1) - + xPlayer.addInventoryItem('carotool', 1) Harvest3(source) end end @@ -116,7 +111,7 @@ AddEventHandler('esx_mecanojob:stopHarvest3', function() local _source = source PlayersHarvesting3[_source] = false end) ------------- Craft Chalumeau ------------------- + local function Craft(source) SetTimeout(4000, function() @@ -129,9 +124,8 @@ local function Craft(source) if GazBottleQuantity <= 0 then TriggerClientEvent('esx:showNotification', source, _U('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 @@ -151,7 +145,7 @@ AddEventHandler('esx_mecanojob:stopCraft', function() local _source = source PlayersCrafting[_source] = false end) ------------- Craft kit Réparation -------------- + local function Craft2(source) SetTimeout(4000, function() @@ -163,9 +157,8 @@ local function Craft2(source) if FixToolQuantity <= 0 then TriggerClientEvent('esx:showNotification', source, _U('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 @@ -185,7 +178,7 @@ AddEventHandler('esx_mecanojob:stopCraft2', function() local _source = source PlayersCrafting2[_source] = false end) ------------------ Craft kit Carosserie ---------------- + local function Craft3(source) SetTimeout(4000, function() @@ -197,9 +190,8 @@ local function Craft3(source) if CaroToolQuantity <= 0 then TriggerClientEvent('esx:showNotification', source, _U('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 @@ -220,8 +212,6 @@ AddEventHandler('esx_mecanojob:stopCraft3', function() PlayersCrafting3[_source] = false end) ----------------------------- NPC Job Earnings ------------------------------------------------------ - RegisterServerEvent('esx_mecanojob:onNPCJobMissionCompleted') AddEventHandler('esx_mecanojob:onNPCJobMissionCompleted', function() @@ -241,7 +231,6 @@ AddEventHandler('esx_mecanojob:onNPCJobMissionCompleted', function() end) ----------------------------- register usable item -------------------------------------------------- ESX.RegisterUsableItem('blowpipe', function(source) local _source = source @@ -250,7 +239,7 @@ ESX.RegisterUsableItem('blowpipe', function(source) xPlayer.removeInventoryItem('blowpipe', 1) TriggerClientEvent('esx_mecanojob:onHijack', _source) - TriggerClientEvent('esx:showNotification', _source, _U('you_used_blowtorch')) + TriggerClientEvent('esx:showNotification', _source, _U('you_used_blowtorch')) end) @@ -262,7 +251,7 @@ ESX.RegisterUsableItem('fixkit', function(source) xPlayer.removeInventoryItem('fixkit', 1) TriggerClientEvent('esx_mecanojob:onFixkit', _source) - TriggerClientEvent('esx:showNotification', _source, _U('you_used_repair_kit')) + TriggerClientEvent('esx:showNotification', _source, _U('you_used_repair_kit')) end) @@ -274,34 +263,33 @@ ESX.RegisterUsableItem('carokit', function(source) xPlayer.removeInventoryItem('carokit', 1) TriggerClientEvent('esx_mecanojob:onCarokit', _source) - TriggerClientEvent('esx:showNotification', _source, _U('you_used_body_kit')) + TriggerClientEvent('esx:showNotification', _source, _U('you_used_body_kit')) end) ----------------------------------- ----- Ajout Gestion Stock Boss ---- ----------------------------------- - RegisterServerEvent('esx_mecanojob:getStockItem') AddEventHandler('esx_mecanojob:getStockItem', function(itemName, count) + local xPlayer = ESX.GetPlayerFromId(source) - local xPlayer = ESX.GetPlayerFromId(source) - - TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) - - local item = inventory.getItem(itemName) - - if item.count >= count then - inventory.removeItem(itemName, count) - xPlayer.addInventoryItem(itemName, count) - else - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity')) - end - - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('you_removed') .. count .. ' ' .. item.label) - - end) - + TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) + local item = inventory.getItem(itemName) + local sourceItem = xPlayer.getInventoryItem(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 sourceItem.limit ~= -1 and (sourceItem.count + count) > sourceItem.limit then + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('player_cannot_hold')) + else + inventory.removeItem(itemName, count) + xPlayer.addInventoryItem(itemName, count) + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_withdrawn', count, item.label)) + end + else + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity')) + end + end) end) ESX.RegisterServerCallback('esx_mecanojob:getStockItems', function(source, cb) @@ -312,10 +300,6 @@ ESX.RegisterServerCallback('esx_mecanojob:getStockItems', function(source, cb) end) -------------- --- AJOUT 2 -- -------------- - RegisterServerEvent('esx_mecanojob:putStockItems') AddEventHandler('esx_mecanojob:putStockItems', function(itemName, count) @@ -339,14 +323,6 @@ AddEventHandler('esx_mecanojob:putStockItems', function(itemName, count) end) ---ESX.RegisterServerCallback('esx_mecanojob:putStockItems', function(source, cb) - --- TriggerEvent('esx_addoninventory:getSharedInventory', 'society_policestock', function(inventory) --- cb(inventory.items) --- end) - ---end) - ESX.RegisterServerCallback('esx_mecanojob:getPlayerInventory', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) From a58adcc9fc15ad01c918d896ffef4cd4bb479425 Mon Sep 17 00:00:00 2001 From: AdrineX Date: Tue, 12 Jun 2018 22:41:21 +0300 Subject: [PATCH 38/66] Add Finnish lang... --- __resource.lua | 2 + locales/fi.lua | 83 +++++++++++++++++++++++++++++++ localization/esx_mecanojob_fi.sql | 30 +++++++++++ 3 files changed, 115 insertions(+) create mode 100644 locales/fi.lua create mode 100644 localization/esx_mecanojob_fi.sql diff --git a/__resource.lua b/__resource.lua index 78891252..636d536a 100644 --- a/__resource.lua +++ b/__resource.lua @@ -7,6 +7,7 @@ version '1.1.0' client_scripts { '@es_extended/locale.lua', 'locales/en.lua', + 'locales/fi.lua', 'locales/fr.lua', 'locales/br.lua', 'locales/sv.lua', @@ -17,6 +18,7 @@ client_scripts { server_scripts { '@es_extended/locale.lua', 'locales/en.lua', + 'locales/fi.lua', 'locales/fr.lua', 'locales/br.lua', 'locales/sv.lua', diff --git a/locales/fi.lua b/locales/fi.lua new file mode 100644 index 00000000..14dc703a --- /dev/null +++ b/locales/fi.lua @@ -0,0 +1,83 @@ +Locales['fi'] = { + ['mechanic'] = 'mekaanikko', + ['drive_to_indicated'] = '~y~Aja~s~ merkattuun pisteeseen.', + ['mission_canceled'] = 'tehtävä ~r~peruutettu~s~', + ['vehicle_list'] = 'ajoneuvo lista', + ['work_wear'] = 'työvaatteet', + ['civ_wear'] = 'siviilivaatteet', + ['deposit_stock'] = 'talleta varastoon', + ['withdraw_stock'] = 'ota varastosta', + ['boss_actions'] = 'pomo toiminnot', + ['service_vehicle'] = 'huoltoajoneuvo', + ['flat_bed'] = 'flatbed', + ['tow_truck'] = 'hinausajoneuvo', + ['service_full'] = 'työntekijöitä tarpeeksi: ', + ['open_actions'] = 'paina ~INPUT_CONTEXT~ avataksesi menun.', + ['harvest'] = 'kerää', + ['harvest_menu'] = 'paina ~INPUT_CONTEXT~ avataksesi keräys menun.', + ['not_experienced_enough'] = 'et ole ~r~tarpeeksi koulutettu~s~ että voit tehdä tätä.', + ['gas_can'] = 'kaasupullo', + ['repair_tools'] = 'korjaustyökalut', + ['body_work_tools'] = 'korin korjaustyökalut', + ['blowtorch'] = 'polttoleikkuri', + ['repair_kit'] = 'korjauskitti', + ['body_kit'] = 'korikitti', + ['craft'] = 'valmista', + ['craft_menu'] = 'paina ~INPUT_CONTEXT~ avataksesi valmistus menu', + ['billing'] = 'laskutus', + ['hijack'] = 'avaa lukot', + ['repair'] = 'korjaa', + ['clean'] = 'pese', + ['imp_veh'] = 'takavarikoi', + ['place_objects'] = 'aseta objekteja', + ['invoice_amount'] = 'laskun summa', + ['amount_invalid'] = 'virheellinen summa', + ['no_players_nearby'] = 'ei pelaajia lähettyvillä', + ['vehicle_unlocked'] = 'ajoneuvo ~g~Avattu', + ['vehicle_repaired'] = 'ajoneuvo ~g~Korjattu', + ['vehicle_cleaned'] = 'ajoneuvo ~g~pesty', + ['vehicle_impounded'] = 'ajoneuvo ~r~Takavarikoitu', + ['must_seat_driver'] = 'sinun pitää olla ~r~kuskin paikalla', + ['must_near'] = 'sinun pitää olla ~r~ajoneuvon lähellä~s~ että voit takavarikoida.', + ['vehicle_success_attached'] = 'ajoneuvo onnistuneesti ~b~kytketty~s~!.', + ['please_drop_off'] = 'vie ajoneuvo korjauspajan pihalle, kiitos.', + ['cant_attach_own_tt'] = '~r~Et voi~s~ kytkeä omaa hinausautoa', + ['no_veh_att'] = 'täällä ei ole ~r~ajoneuvoa~s~ jota kytkeä', + ['not_right_veh'] = 'tämä ei ole oikea ajoneuvo', + ['veh_det_succ'] = 'ajoneuvo onnistuunesti ~b~irroitettu~s~!', + ['imp_flatbed'] = '~r~Toiminto mahdoton!~s~ Sinulla pitää olla ~b~Flatbed~s~ tähän.', + ['objects'] = 'objektit', + ['roadcone'] = 'kartio', + ['toolbox'] = 'työkalupakki', + ['mechanic_stock'] = 'mekaanikon varasto', + ['quantity'] = 'määrä', + ['invalid_quantity'] = 'virheellinen summa', + ['inventory'] = 'reppu', + ['veh_unlocked'] = '~g~Ajoneuvo avattu', + ['hijack_failed'] = '~r~Tiirikointi epäonnistu', + ['body_repaired'] = '~g~Kori korjattu', + ['veh_repaired'] = '~g~Ajoneuvo korjattu', + ['veh_stored'] = 'paina ~INPUT_CONTEXT~ laittaaksesi auto talliin.', + ['press_remove_obj'] = 'paina ~INPUT_CONTEXT~ poistaaksesi objekti', + ['please_tow'] = 'voisitko ~y~hinata~s~ ajoneuvon, kiitos', + ['wait_five'] = 'sinun pitää ~r~odottaa~s~ 5 minuuttia', + ['must_in_flatbed'] = 'sinun pitää olla flatbedin kyydissä aloitaaksesi.', + ['mechanic_customer'] = 'mekaanikon Asiakas', + ['you_do_not_room'] = '~r~Sinulla ei ole enempää tilaa', + ['recovery_gas_can'] = '~b~Kaasupullon~s~ täyttö menossa...', + ['recovery_repair_tools'] = '~b~Korjaustyökalujen~s~ kerääminen menossa...', + ['recovery_body_tools'] = '~b~Korin työkalujen~s~ kerääminen menossa...', + ['not_enough_gas_can'] = 'sinulla ~r~ei ole tarpeeksi~s~ kaasupulloja.', + ['assembling_blowtorch'] = 'kasataan ~b~Polttoleikkuria~s~...', + ['not_enough_repair_tools'] = 'sinulla ~r~ei ole tarpeeksi~s~ korjaus työkaluja.', + ['assembling_repair_kit'] = 'kasataan ~b~Korjauskittiä~s~...', + ['not_enough_body_tools'] = 'sinulla ~r~ei ole tarpeeksi~s~ kori työkaluja.', + ['assembling_body_kit'] = 'kasataan ~b~Korikittiä~s~...', + ['your_comp_earned'] = 'yrityksesi ~g~tienasi~s~ ~g~$', + ['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', + ['player_cannot_hold'] = 'sinulla ~r~ei ole~w~ tarpeeksi ~y~vapaata tilaa~w~ repussasi!', +} diff --git a/localization/esx_mecanojob_fi.sql b/localization/esx_mecanojob_fi.sql new file mode 100644 index 00000000..2d9b9b83 --- /dev/null +++ b/localization/esx_mecanojob_fi.sql @@ -0,0 +1,30 @@ +USE `essentialmode`; + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_mecano', 'Mekaanikko', 1) +; + +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_mecano', 'Mekaanikko', 1) +; + +INSERT INTO `jobs` (name, label) VALUES + ('mecano', 'Mekaanikko') +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('mecano',0,'recrue','Harjottelija',12,'{}','{}'), + ('mecano',1,'novice','Aloittelija',24,'{}','{}'), + ('mecano',2,'experimente','Kokenut',36,'{}','{}'), + ('mecano',3,'chief','Johtaja',48,'{}','{}'), + ('mecano',4,'boss','Pomo',0,'{}','{}') +; + +INSERT INTO `items` (name, label, `limit`) VALUES + ('gazbottle', 'Kaasupullo', 11), + ('fixtool', 'Korjaustyökalut', 6), + ('carotool', 'Työkalut', 4), + ('blowpipe', 'Polttoleikkuri', 10), + ('fixkit', 'Korjauskitti', 5), + ('carokit', 'Korikitti', 3) +; From 7e2eabada6ff77358789bb0233ff884773be8573 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 8 Jul 2018 19:27:57 +0200 Subject: [PATCH 39/66] Minor updates --- README.md | 47 ++++++++++++++++++++++++++++++++--------------- client/main.lua | 19 ++++++++----------- esx_mecanojob.sql | 2 +- 3 files changed, 41 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 9d802b28..6f27877a 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,49 @@ -# fxserver-esx_mecanojob +# esx_mecanojob -FXServer ESX Mecano Job - -[REQUIREMENTS] +## Requirements * Auto mode * No need to download another resource * Player management (billing and boss actions) - * esx_society => https://github.com/FXServer-ESX/fxserver-esx_society - * esx_billing => https://github.com/FXServer-ESX/fxserver-esx_billing + * [esx_society](https://github.com/ESX-Org/esx_society) + * [esx_billing](https://github.com/ESX-Org/esx_billing) -[INSTALLATION] +## Download & Installation -1) CD in your resources/[esx] folder -2) Clone the repository +### Using [fvm](https://github.com/qlaffont/fvm-installer) ``` -git clone https://github.com/FXServer-ESX/fxserver-esx_mecanojob esx_mecanojob +fvm install --save --folder=esx esx-org/esx_mecanojob ``` -3) Import esx_mecanojob.sql in your database -4) Add this in your server.cfg : +### Using Git +``` +cd resources +git clone https://github.com/ESX-Org/esx_mecanojob [esx]/esx_mecanojob +``` + +### Manually +- Download https://github.com/ESX-Org/esx_mecanojob/archive/master.zip +- Put it in the `[esx]` directory + + +## Installation +- Import `esx_mecanojob.sql` in your database +- If you want player management you have to set `Config.EnablePlayerManagement` to `true` in `config.lua` +- Add this to your `server.cfg`: ``` start esx_mecanojob ``` -5) If you want player management you have to set Config.EnablePlayerManagement to true in config.lua -[KNOWN BUGS] +# Legal +### License +esx_mecanojob - mechanic job for ESX -* Props spawn don't work at all +Copyright (C) 2015-2018 Jérémie N'gadi + +This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version. + +This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details. + +You should have received a copy Of the GNU General Public License along with this program. If Not, see http://www.gnu.org/licenses/. \ No newline at end of file diff --git a/client/main.lua b/client/main.lua index 0c9347e1..a12debb2 100644 --- a/client/main.lua +++ b/client/main.lua @@ -11,14 +11,12 @@ local Keys = { } local PlayerData = {} -local GUI = {} local HasAlreadyEnteredMarker = false local LastZone = nil local CurrentAction = nil local CurrentActionMsg = '' local CurrentActionData = {} local OnJob = false -local TargetCoords = nil local CurrentlyTowedVehicle = nil local Blips = {} local NPCOnJob = false @@ -31,7 +29,6 @@ local NPCTargetDeleterZone = false local IsDead = false ESX = nil -GUI.Time = 0 Citizen.CreateThread(function() while ESX == nil do @@ -164,7 +161,7 @@ function OpenMecanoActionsMenu() else local elements = { - {label = _U('flat_bed'), value = 'flatbed'}, + {label = _U('flat_bed'), value = 'flatbed'}, {label = _U('tow_truck'), value = 'towtruck2'} } @@ -365,12 +362,12 @@ function OpenMobileMecanoActionsMenu() title = _U('mechanic'), align = 'top-left', elements = { - {label = _U('billing'), value = 'billing'}, - {label = _U('hijack'), value = 'hijack_vehicle'}, - {label = _U('repair'), value = 'fix_vehicle'}, - {label = _U('clean'), value = 'clean_vehicle'}, - {label = _U('imp_veh'), value = 'del_vehicle'}, - {label = _U('flat_bed'), value = 'dep_vehicle'}, + {label = _U('billing'), value = 'billing'}, + {label = _U('hijack'), value = 'hijack_vehicle'}, + {label = _U('repair'), value = 'fix_vehicle'}, + {label = _U('clean'), value = 'clean_vehicle'}, + {label = _U('imp_veh'), value = 'del_vehicle'}, + {label = _U('flat_bed'), value = 'dep_vehicle'}, {label = _U('place_objects'), value = 'object_spawner'} } }, @@ -1196,7 +1193,7 @@ Citizen.CreateThread(function() local playerPed = GetPlayerPed(-1) - if IsPedInAnyVehicle(playerPed, false) and IsVehicleModel(GetVehiclePedIsIn(playerPed, false), GetHashKey("flatbed")) then + if IsPedInAnyVehicle(playerPed, false) and IsVehicleModel(GetVehiclePedIsIn(playerPed, false), GetHashKey("flatbed")) then StartNPCJob() else ESX.ShowNotification(_U('must_in_flatbed')) diff --git a/esx_mecanojob.sql b/esx_mecanojob.sql index 9bb4bf5d..03b45f44 100644 --- a/esx_mecanojob.sql +++ b/esx_mecanojob.sql @@ -16,7 +16,7 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ('mecano',0,'recrue','Recrue',12,'{}','{}'), ('mecano',1,'novice','Novice',24,'{}','{}'), ('mecano',2,'experimente','Experimente',36,'{}','{}'), - ('mecano',3,'chief','Chef d\'équipe',48,'{}','{}'), + ('mecano',3,'chief',"Chef d\'équipe",48,'{}','{}'), ('mecano',4,'boss','Patron',0,'{}','{}') ; From 8e0320be7a1512718bbbe736a26f5452caef6719 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 8 Jul 2018 22:11:53 +0200 Subject: [PATCH 40/66] Major script improvements, see desc - Moved zone to avoid problems with existing objects in the area - Removed possiblity to repair, clean & more from inside vehicles, and made sure only one action can be performed at the time - Added missing locale - General code improvements --- client/main.lua | 168 +++++++++++++++++++++++++----------------------- config.lua | 2 +- locales/br.lua | 6 +- locales/en.lua | 24 +++---- locales/fi.lua | 6 +- locales/fr.lua | 8 ++- locales/sv.lua | 24 +++---- server/main.lua | 4 +- 8 files changed, 129 insertions(+), 113 deletions(-) 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) From 4a56fb7021bc445e32acaf0bf5d8c7a03992e8e6 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 14 Jul 2018 23:11:12 +0200 Subject: [PATCH 41/66] Fixed inproper string --- .editorconfig | 4 ++-- server/main.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index 41c2aaf2..6866fb40 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,8 +1,8 @@ root = true [*] -indent_size = 2 -indent_style = space +indent_size = 4 +indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true diff --git a/server/main.lua b/server/main.lua index 7c90d40c..890bdd75 100644 --- a/server/main.lua +++ b/server/main.lua @@ -169,7 +169,7 @@ RegisterServerEvent('esx_mecanojob:startCraft2') AddEventHandler('esx_mecanojob:startCraft2', function() local _source = source PlayersCrafting2[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('assembling_blowtorch')) + TriggerClientEvent('esx:showNotification', _source, _U('assembling_repair_kit')) Craft2(_source) end) From 66e9021854545efa689554eed90f999f1cc572d4 Mon Sep 17 00:00:00 2001 From: deviljin112 <39461646+deviljin112@users.noreply.github.com> Date: Mon, 23 Jul 2018 21:41:06 +0100 Subject: [PATCH 42/66] Polish translation --- __resource.lua | 2 + locales/pl.lua | 85 +++++++++++++++++++++++++++++++ localization/esx_mecanojob_pl.sql | 30 +++++++++++ 3 files changed, 117 insertions(+) create mode 100644 locales/pl.lua create mode 100644 localization/esx_mecanojob_pl.sql diff --git a/__resource.lua b/__resource.lua index 636d536a..4e772a80 100644 --- a/__resource.lua +++ b/__resource.lua @@ -11,6 +11,7 @@ client_scripts { 'locales/fr.lua', 'locales/br.lua', 'locales/sv.lua', + 'locales/pl.lua', 'config.lua', 'client/main.lua' } @@ -22,6 +23,7 @@ server_scripts { 'locales/fr.lua', 'locales/br.lua', 'locales/sv.lua', + 'locales/pl.lua', 'config.lua', 'server/main.lua' } diff --git a/locales/pl.lua b/locales/pl.lua new file mode 100644 index 00000000..2454b9cc --- /dev/null +++ b/locales/pl.lua @@ -0,0 +1,85 @@ +Locales['pl'] = { + ['mechanic'] = 'mechanik', + ['drive_to_indicated'] = '~y~Jedz~s~ do wskazanej lokalizacji.', + ['mission_canceled'] = 'misja ~r~anulowana~s~', + ['vehicle_list'] = 'lista pojazdów', + ['work_wear'] = 'ubrania robocze', + ['civ_wear'] = 'ubrania cywilne', + ['deposit_stock'] = 'deponuj przedmioty', + ['withdraw_stock'] = 'wyciągnij przedmioty', + ['boss_actions'] = 'akcje szefa', + ['service_vehicle'] = 'serwisuj pojazd', + ['flat_bed'] = 'laweta', + ['tow_truck'] = 'holownik', + ['service_full'] = 'serwis pełny: ', + ['open_actions'] = 'wciśnij ~INPUT_CONTEXT~ aby otworzyć menu.', + ['harvest'] = 'zbieraj', + ['harvest_menu'] = 'wcisnij ~INPUT_CONTEXT~ aby otworzyć menu zbierania.', + ['not_experienced_enough'] = 'nie jesteś wystarczająco ~r~doświadczony~s~ aby zrobić tą akcję.', + ['gas_can'] = 'kanister z paliwem', + ['repair_tools'] = 'zestaw do naprawy', + ['body_work_tools'] = 'zestaw blacharski', + ['blowtorch'] = 'palnik', + ['repair_kit'] = 'narzedzia naprawcze', + ['body_kit'] = 'karoseria', + ['craft'] = 'twórz', + ['craft_menu'] = 'wcisnij ~INPUT_CONTEXT~ aby otworzyc menu tworzenia.', + ['billing'] = 'faktury', + ['hijack'] = 'forsowanie', + ['repair'] = 'naprawa', + ['clean'] = 'wyczyść', + ['imp_veh'] = 'odholowywanie', + ['place_objects'] = 'połóż objekt', + ['invoice_amount'] = 'suma faktury', + ['amount_invalid'] = 'nieprawidłowa suma', + ['no_players_nearby'] = 'brak gracza w pobliżu', + ['no_vehicle_nearby'] = 'brak pojazdu w pobliżu', + ['inside_vehicle'] = 'nie możesz tego zrobić z środka pojazdu!', + ['vehicle_unlocked'] = 'pojazd został ~g~odblokowany', + ['vehicle_repaired'] = 'pojazd został ~g~naprawiony', + ['vehicle_cleaned'] = 'pojazd został ~g~umyty', + ['vehicle_impounded'] = 'pojazd został ~r~odholowany', + ['must_seat_driver'] = 'musisz być na siedzeniu kierowcy!', + ['must_near'] = 'musisz być ~r~blisko pojazdu~s~ aby go odholować.', + ['vehicle_success_attached'] = 'pojazd ~b~przyłączony~s~', + ['please_drop_off'] = 'proszę odstawić pojazd w garażu', + ['cant_attach_own_tt'] = '~r~nie możesz~s~ podłączyć własnego holwnika', + ['no_veh_att'] = 'nie ma ~r~pojazdu~s~ do podłączenia', + ['not_right_veh'] = 'to nie jest prawidłowy pojazd', + ['veh_det_succ'] = 'pojazd ~b~odłączony~s~!', + ['imp_flatbed'] = '~r~Akcja niemożliwa!~s~ Potrzebujesz ~b~lawety~s~ aby załadować pojazd', + ['objects'] = 'objekty', + ['roadcone'] = 'pachołek', + ['toolbox'] = 'skrzynka z narzędziami', + ['mechanic_stock'] = 'magazyn mechanika', + ['quantity'] = 'ilość', + ['invalid_quantity'] = 'nieprawidłowa ilość', + ['inventory'] = 'ekwipunek', + ['veh_unlocked'] = '~g~Pojazd odblokowany', + ['hijack_failed'] = '~r~Forsowanie nie udane', + ['body_repaired'] = '~g~Karoseria naprawiona', + ['veh_repaired'] = '~g~Pojazd naprawiony', + ['veh_stored'] = 'wcisnij ~INPUT_CONTEXT~ aby schować pojazd.', + ['press_remove_obj'] = 'wcisnij ~INPUT_CONTEXT~ aby usunąć objekt', + ['please_tow'] = 'proszę ~y~odholować~s~ pojazd', + ['wait_five'] = 'musisz ~r~poczekać~s~ 5 minut', + ['must_in_flatbed'] = 'musisz być w lawecie aby rozpocząć misje', + ['mechanic_customer'] = 'klient mechanika', + ['you_do_not_room'] = '~r~Nie masz wiecej miejsca', + ['recovery_gas_can'] = 'odzyskiwanie ~b~Kanistra z paliwem~s~...', + ['recovery_repair_tools'] = 'odzyskiwanie ~b~Części naprawczych~s~...', + ['recovery_body_tools'] = 'odzyskiwanie ~b~Części blacharskich~s~...', + ['not_enough_gas_can'] = 'nie posiadasz ~r~wystarczająco~s~ paliwa w kanistrze.', + ['assembling_blowtorch'] = 'składanie ~b~Palnika~s~...', + ['not_enough_repair_tools'] = 'nie posiadasz ~r~wystarczająco~s~ częsci naprawczych.', + ['assembling_repair_kit'] = 'składanie ~b~częsci naprawczych~s~...', + ['not_enough_body_tools'] = 'nie posiadasz ~r~wystarczająco~s~ częsci blacharskich.', + ['assembling_body_kit'] = 'składanie ~b~częsci blacharskich~s~...', + ['your_comp_earned'] = 'twoja firma ~g~zarobiła~s~ ~g~$', + ['you_used_blowtorch'] = 'użyłeś ~b~palnik', + ['you_used_repair_kit'] = 'użyłeś ~b~częsci naprawczych', + ['you_used_body_kit'] = 'użyłeś ~b~częsci blacharskich', + ['have_withdrawn'] = 'wyciągnąłeś ~y~x%s~s~ ~b~%s~s~', + ['have_deposited'] = 'zdeponowałeś ~y~x%s~s~ ~b~%s~s~', + ['player_cannot_hold'] = '~r~nie masz~w~ wystarczająco ~y~wolnego~w~ miejsca w ekwipunku!', +} diff --git a/localization/esx_mecanojob_pl.sql b/localization/esx_mecanojob_pl.sql new file mode 100644 index 00000000..b8c9f819 --- /dev/null +++ b/localization/esx_mecanojob_pl.sql @@ -0,0 +1,30 @@ +USE `essentialmode`; + +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_mecano', 'Mechanik', 1) +; + +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_mecano', 'Mechanik', 1) +; + +INSERT INTO `jobs` (name, label) VALUES + ('mecano', 'Mechanik') +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('mecano',0,'recrue','Praktykant',12,'{}','{}'), + ('mecano',1,'novice','Nowicjusz',24,'{}','{}'), + ('mecano',2,'experimente','Doświadczony',36,'{}','{}'), + ('mecano',3,'chief','Kierownik',48,'{}','{}'), + ('mecano',4,'boss','Szef',0,'{}','{}') +; + +INSERT INTO `items` (name, label, `limit`) VALUES + ('gazbottle', 'Butelka z gazem', 11), + ('fixtool', 'Zestaw do naprawy', 6), + ('carotool', 'Częsci naprawcze', 4), + ('blowpipe', 'Palnik', 10), + ('fixkit', 'Narzedzia naprawcze', 5), + ('carokit', 'Części blacharskie', 3) +; From a539b78c37420bc7906cf34addf1b45459be0e23 Mon Sep 17 00:00:00 2001 From: nearbyplayer Date: Wed, 8 Aug 2018 20:25:46 -0400 Subject: [PATCH 43/66] Fixed File Name(s) --- localization/{esx_mecanojob_en.sql => en_esx_mecanojob.sql} | 0 localization/{esx_mecanojob_fi.sql => fi_esx_mecanojob.sql} | 0 localization/{esx_mecanojob_pl.sql => pl_esx_mecanojob.sql} | 0 localization/{esx_mecanojob_sv.sql => sv_esx_mecanojob.sql} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename localization/{esx_mecanojob_en.sql => en_esx_mecanojob.sql} (100%) rename localization/{esx_mecanojob_fi.sql => fi_esx_mecanojob.sql} (100%) rename localization/{esx_mecanojob_pl.sql => pl_esx_mecanojob.sql} (100%) rename localization/{esx_mecanojob_sv.sql => sv_esx_mecanojob.sql} (100%) diff --git a/localization/esx_mecanojob_en.sql b/localization/en_esx_mecanojob.sql similarity index 100% rename from localization/esx_mecanojob_en.sql rename to localization/en_esx_mecanojob.sql diff --git a/localization/esx_mecanojob_fi.sql b/localization/fi_esx_mecanojob.sql similarity index 100% rename from localization/esx_mecanojob_fi.sql rename to localization/fi_esx_mecanojob.sql diff --git a/localization/esx_mecanojob_pl.sql b/localization/pl_esx_mecanojob.sql similarity index 100% rename from localization/esx_mecanojob_pl.sql rename to localization/pl_esx_mecanojob.sql diff --git a/localization/esx_mecanojob_sv.sql b/localization/sv_esx_mecanojob.sql similarity index 100% rename from localization/esx_mecanojob_sv.sql rename to localization/sv_esx_mecanojob.sql From 97c234d39251548d5093e20192640b53649fceac Mon Sep 17 00:00:00 2001 From: nearbyplayer Date: Fri, 10 Aug 2018 00:54:29 -0400 Subject: [PATCH 44/66] Repo Update --- .editorconfig | 2 +- LICENSE.txt => LICENSE | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename LICENSE.txt => LICENSE (100%) diff --git a/.editorconfig b/.editorconfig index 6866fb40..9b425256 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,7 +3,7 @@ root = true [*] indent_size = 4 indent_style = tab -end_of_line = lf +end_of_line = crlf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE similarity index 100% rename from LICENSE.txt rename to LICENSE From 714a16c60bb31dbe12a342e1aebdcadaceb4e5a6 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 30 Sep 2018 22:28:45 +0200 Subject: [PATCH 45/66] Performance improvement by not looking for entity every frame --- client/main.lua | 77 +++++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 44 deletions(-) diff --git a/client/main.lua b/client/main.lua index d1be3dd5..df823fc7 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1072,57 +1072,46 @@ Citizen.CreateThread(function() end) Citizen.CreateThread(function() + local trackedEntities = { + 'prop_roadcone02a', + 'prop_toolchest_01' + } - local trackedEntities = { - 'prop_roadcone02a', - 'prop_toolchest_01' - } + while true do + Citizen.Wait(500) - while true do + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - Citizen.Wait(10) + local closestDistance = -1 + local closestEntity = nil - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + for i=1, #trackedEntities, 1 do + local object = GetClosestObjectOfType(coords.x, coords.y, coords.z, 3.0, GetHashKey(trackedEntities[i]), false, false, false) - local closestDistance = -1 - local closestEntity = nil + if DoesEntityExist(object) then + local objCoords = GetEntityCoords(object) + local distance = GetDistanceBetweenCoords(coords.x, coords.y, coords.z, objCoords.x, objCoords.y, objCoords.z, true) - for i=1, #trackedEntities, 1 do + if closestDistance == -1 or closestDistance > distance then + closestDistance = distance + closestEntity = object + end + end + end - local object = GetClosestObjectOfType(coords.x, coords.y, coords.z, 3.0, GetHashKey(trackedEntities[i]), false, false, false) - - if DoesEntityExist(object) then - - local objCoords = GetEntityCoords(object) - local distance = GetDistanceBetweenCoords(coords.x, coords.y, coords.z, objCoords.x, objCoords.y, objCoords.z, true) - - 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_mecanojob:hasEnteredEntityZone', closestEntity) - LastEntity = closestEntity - end - - else - - if LastEntity ~= nil then - TriggerEvent('esx_mecanojob:hasExitedEntityZone', LastEntity) - LastEntity = nil - end - - end - - end + if closestDistance ~= -1 and closestDistance <= 3.0 then + if LastEntity ~= closestEntity then + TriggerEvent('esx_mecanojob:hasEnteredEntityZone', closestEntity) + LastEntity = closestEntity + end + else + if LastEntity ~= nil then + TriggerEvent('esx_mecanojob:hasExitedEntityZone', LastEntity) + LastEntity = nil + end + end + end end) -- Key Controls From b5d389a82e7546835a0c156e9ac9283882fce8ba Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 10 Nov 2018 13:20:11 +0100 Subject: [PATCH 46/66] 4 tab indent, cleanup --- README.md | 1 - client/main.lua | 1495 ++++++++++++++++++++++------------------------- config.lua | 180 +++--- server/main.lua | 335 +++++------ 4 files changed, 933 insertions(+), 1078 deletions(-) diff --git a/README.md b/README.md index 6f27877a..ca7a1d38 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,6 @@ git clone https://github.com/ESX-Org/esx_mecanojob [esx]/esx_mecanojob - Download https://github.com/ESX-Org/esx_mecanojob/archive/master.zip - Put it in the `[esx]` directory - ## Installation - Import `esx_mecanojob.sql` in your database - If you want player management you have to set `Config.EnablePlayerManagement` to `true` in `config.lua` diff --git a/client/main.lua b/client/main.lua index df823fc7..b3e58a14 100644 --- a/client/main.lua +++ b/client/main.lua @@ -16,7 +16,6 @@ local LastZone = nil local CurrentAction = nil local CurrentActionMsg = '' local CurrentActionData = {} -local OnJob = false local CurrentlyTowedVehicle = nil local Blips = {} local NPCOnJob = false @@ -36,375 +35,320 @@ Citizen.CreateThread(function() TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) Citizen.Wait(0) end - + Citizen.Wait(5000) PlayerData = ESX.GetPlayerData() end) function SelectRandomTowable() + local index = GetRandomIntInRange(1, #Config.Towables) - local index = GetRandomIntInRange(1, #Config.Towables) - - for k,v in pairs(Config.Zones) do - if v.Pos.x == Config.Towables[index].x and v.Pos.y == Config.Towables[index].y and v.Pos.z == Config.Towables[index].z then - return k - end - end - + for k,v in pairs(Config.Zones) do + if v.Pos.x == Config.Towables[index].x and v.Pos.y == Config.Towables[index].y and v.Pos.z == Config.Towables[index].z then + return k + end + end end function StartNPCJob() + NPCOnJob = true - NPCOnJob = true + NPCTargetTowableZone = SelectRandomTowable() + local zone = Config.Zones[NPCTargetTowableZone] - NPCTargetTowableZone = SelectRandomTowable() - local zone = Config.Zones[NPCTargetTowableZone] + Blips['NPCTargetTowableZone'] = AddBlipForCoord(zone.Pos.x, zone.Pos.y, zone.Pos.z) + SetBlipRoute(Blips['NPCTargetTowableZone'], true) - Blips['NPCTargetTowableZone'] = AddBlipForCoord(zone.Pos.x, zone.Pos.y, zone.Pos.z) - SetBlipRoute(Blips['NPCTargetTowableZone'], true) - - ESX.ShowNotification(_U('drive_to_indicated')) + ESX.ShowNotification(_U('drive_to_indicated')) end function StopNPCJob(cancel) + if Blips['NPCTargetTowableZone'] ~= nil then + RemoveBlip(Blips['NPCTargetTowableZone']) + Blips['NPCTargetTowableZone'] = nil + end - if Blips['NPCTargetTowableZone'] ~= nil then - RemoveBlip(Blips['NPCTargetTowableZone']) - Blips['NPCTargetTowableZone'] = nil - end + if Blips['NPCDelivery'] ~= nil then + RemoveBlip(Blips['NPCDelivery']) + Blips['NPCDelivery'] = nil + end - if Blips['NPCDelivery'] ~= nil then - RemoveBlip(Blips['NPCDelivery']) - Blips['NPCDelivery'] = nil - end + Config.Zones.VehicleDelivery.Type = -1 + NPCOnJob = false + NPCTargetTowable = nil + NPCTargetTowableZone = nil + NPCHasSpawnedTowable = false + NPCHasBeenNextToTowable = false - Config.Zones.VehicleDelivery.Type = -1 - - NPCOnJob = false - NPCTargetTowable = nil - NPCTargetTowableZone = nil - NPCHasSpawnedTowable = false - NPCHasBeenNextToTowable = false - - if cancel then - ESX.ShowNotification(_U('mission_canceled')) - else - TriggerServerEvent('esx_mecanojob:onNPCJobCompleted') - end - + if cancel then + ESX.ShowNotification(_U('mission_canceled')) + else + --TriggerServerEvent('esx_mecanojob:onNPCJobCompleted') + end 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('withdraw_stock'), value = 'get_stock'} - } - if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name == 'boss' then - table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) - end + 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('withdraw_stock'), value = 'get_stock'} + } - ESX.UI.Menu.CloseAll() + if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name == 'boss' then + table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) + end - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mecano_actions', - { - title = _U('mechanic'), - align = 'top-left', - elements = elements - }, - function(data, menu) - if data.current.value == 'vehicle_list' then + ESX.UI.Menu.CloseAll() - if Config.EnableSocietyOwnedVehicles then + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mecano_actions', { + title = _U('mechanic'), + align = 'top-left', + elements = elements + }, function(data, menu) + if data.current.value == 'vehicle_list' then - local elements = {} + if Config.EnableSocietyOwnedVehicles then - ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) + local elements = {} - for i=1, #vehicles, 1 do - table.insert(elements, {label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', value = vehicles[i]}) - end + ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles) + for i=1, #vehicles, 1 do + table.insert(elements, { + label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']', + value = vehicles[i] + }) + end - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'vehicle_spawner', - { - title = _U('service_vehicle'), - align = 'top-left', - elements = elements, - }, - function(data, menu) + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_spawner', { + title = _U('service_vehicle'), + align = 'top-left', + elements = elements + }, function(data, menu) + menu.close() + local vehicleProps = data.current.value - menu.close() + ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) + ESX.Game.SetVehicleProperties(vehicle, vehicleProps) + local playerPed = PlayerPedId() + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) - local vehicleProps = data.current.value + TriggerServerEvent('esx_society:removeVehicleFromGarage', 'mecano', vehicleProps) + end, function(data, menu) + menu.close() + end) + end, 'mecano') - ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle) - ESX.Game.SetVehicleProperties(vehicle, vehicleProps) - local playerPed = GetPlayerPed(-1) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) + else - TriggerServerEvent('esx_society:removeVehicleFromGarage', 'mecano', vehicleProps) + local elements = { + {label = _U('flat_bed'), value = 'flatbed'}, + {label = _U('tow_truck'), value = 'towtruck2'} + } - end, - function(data, menu) - menu.close() - end - ) + if Config.EnablePlayerManagement and PlayerData.job ~= nil and (PlayerData.job.grade_name == 'boss' or PlayerData.job.grade_name == 'chef' or PlayerData.job.grade_name == 'experimente') then + table.insert(elements, {label = 'SlamVan', value = 'slamvan3'}) + end - end, 'mecano') + ESX.UI.Menu.CloseAll() - else + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'spawn_vehicle', { + title = _U('service_vehicle'), + align = 'top-left', + elements = elements + }, function(data, menu) + if Config.MaxInService == -1 then + ESX.Game.SpawnVehicle(data.current.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle) + local playerPed = PlayerPedId() + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + else + ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount) + if canTakeService then + ESX.Game.SpawnVehicle(data.current.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle) + local playerPed = PlayerPedId() + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) + else + ESX.ShowNotification(_U('service_full') .. inServiceCount .. '/' .. maxInService) + end + end, 'mecano') + end - local elements = { - {label = _U('flat_bed'), value = 'flatbed'}, - {label = _U('tow_truck'), value = 'towtruck2'} - } + menu.close() + end, function(data, menu) + menu.close() + OpenMecanoActionsMenu() + end) - if Config.EnablePlayerManagement and PlayerData.job ~= nil and - (PlayerData.job.grade_name == 'boss' or PlayerData.job.grade_name == 'chef' or PlayerData.job.grade_name == 'experimente') then - table.insert(elements, {label = 'SlamVan', value = 'slamvan3'}) - end + end - ESX.UI.Menu.CloseAll() + elseif data.current.value == 'cloakroom' then - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'spawn_vehicle', - { - title = _U('service_vehicle'), - align = 'top-left', - elements = elements - }, - function(data, menu) - for i=1, #elements, 1 do - if Config.MaxInService == -1 then - ESX.Game.SpawnVehicle(data.current.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle) - local playerPed = GetPlayerPed(-1) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - break - else - ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount) - if canTakeService then - ESX.Game.SpawnVehicle(data.current.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle) - local playerPed = GetPlayerPed(-1) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) - else - ESX.ShowNotification(_U('service_full') .. inServiceCount .. '/' .. maxInService) - end - end, 'mecano') - break - end - end - menu.close() - end, - function(data, menu) - menu.close() - OpenMecanoActionsMenu() - end - ) + menu.close() + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + if skin.sex == 0 then + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) + else + TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) + end + end) - end - end + elseif data.current.value == 'cloakroom2' then - if data.current.value == 'cloakroom' then - menu.close() - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + menu.close() + ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) + TriggerEvent('skinchanger:loadSkin', skin) + end) - if skin.sex == 0 then - TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male) - else - TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) - end + elseif data.current.value == 'put_stock' then + OpenPutStocksMenu() + elseif data.current.value == 'get_stock' then + OpenGetStocksMenu() + elseif data.current.value == 'boss_actions' then + TriggerEvent('esx_society:openBossMenu', 'mecano', function(data, menu) + menu.close() + end) + end - end) - end + end, function(data, menu) + menu.close() - if data.current.value == 'cloakroom2' then - menu.close() - ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) - - TriggerEvent('skinchanger:loadSkin', skin) - - end) - end - - if data.current.value == 'put_stock' then - OpenPutStocksMenu() - end - - if data.current.value == 'get_stock' then - OpenGetStocksMenu() - end - - if data.current.value == 'boss_actions' then - TriggerEvent('esx_society:openBossMenu', 'mecano', function(data, menu) - menu.close() - end) - end - - end, - function(data, menu) - menu.close() - CurrentAction = 'mecano_actions_menu' - CurrentActionMsg = _U('open_actions') - CurrentActionData = {} - end - ) + CurrentAction = 'mecano_actions_menu' + CurrentActionMsg = _U('open_actions') + CurrentActionData = {} + end) end function OpenMecanoHarvestMenu() - if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then - local elements = { - {label = _U('gas_can'), value = 'gaz_bottle'}, - {label = _U('repair_tools'), value = 'fix_tool'}, - {label = _U('body_work_tools'), value = 'caro_tool'} - } + if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then - ESX.UI.Menu.CloseAll() + local elements = { + {label = _U('gas_can'), value = 'gaz_bottle'}, + {label = _U('repair_tools'), value = 'fix_tool'}, + {label = _U('body_work_tools'), value = 'caro_tool'} + } - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mecano_harvest', - { - title = _U('harvest'), - align = 'top-left', - elements = elements - }, - function(data, menu) - if data.current.value == 'gaz_bottle' then - menu.close() - TriggerServerEvent('esx_mecanojob:startHarvest') - end + ESX.UI.Menu.CloseAll() - if data.current.value == 'fix_tool' then - menu.close() - TriggerServerEvent('esx_mecanojob:startHarvest2') - end + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mecano_harvest', { + title = _U('harvest'), + align = 'top-left', + elements = elements + }, function(data, menu) - if data.current.value == 'caro_tool' then - menu.close() - TriggerServerEvent('esx_mecanojob:startHarvest3') - end + if data.current.value == 'gaz_bottle' then + menu.close() + TriggerServerEvent('esx_mecanojob:startHarvest') + elseif data.current.value == 'fix_tool' then + menu.close() + TriggerServerEvent('esx_mecanojob:startHarvest2') + elseif data.current.value == 'caro_tool' then + menu.close() + TriggerServerEvent('esx_mecanojob:startHarvest3') + end - end, - function(data, menu) - menu.close() - CurrentAction = 'mecano_harvest_menu' - CurrentActionMsg = _U('harvest_menu') - CurrentActionData = {} - end - ) - else - ESX.ShowNotification(_U('not_experienced_enough')) - end + end, function(data, menu) + menu.close() + CurrentAction = 'mecano_harvest_menu' + CurrentActionMsg = _U('harvest_menu') + CurrentActionData = {} + end) + + else + ESX.ShowNotification(_U('not_experienced_enough')) + end end function OpenMecanoCraftMenu() - if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then + if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then - local elements = { - {label = _U('blowtorch'), value = 'blow_pipe'}, - {label = _U('repair_kit'), value = 'fix_kit'}, - {label = _U('body_kit'), value = 'caro_kit'} - } + local elements = { + {label = _U('blowtorch'), value = 'blow_pipe'}, + {label = _U('repair_kit'), value = 'fix_kit'}, + {label = _U('body_kit'), value = 'caro_kit'} + } - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mecano_craft', - { - title = _U('craft'), - align = 'top-left', - elements = elements - }, - function(data, menu) - if data.current.value == 'blow_pipe' then - menu.close() - TriggerServerEvent('esx_mecanojob:startCraft') - end + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mecano_craft', { + title = _U('craft'), + align = 'top-left', + elements = elements + }, function(data, menu) + if data.current.value == 'blow_pipe' then + menu.close() + TriggerServerEvent('esx_mecanojob:startCraft') + elseif data.current.value == 'fix_kit' then + menu.close() + TriggerServerEvent('esx_mecanojob:startCraft2') + elseif data.current.value == 'caro_kit' then + menu.close() + TriggerServerEvent('esx_mecanojob:startCraft3') + end - if data.current.value == 'fix_kit' then - menu.close() - TriggerServerEvent('esx_mecanojob:startCraft2') - end + end, function(data, menu) + menu.close() - if data.current.value == 'caro_kit' then - menu.close() - TriggerServerEvent('esx_mecanojob:startCraft3') - end + CurrentAction = 'mecano_craft_menu' + CurrentActionMsg = _U('craft_menu') + CurrentActionData = {} + end) - end, - function(data, menu) - menu.close() - CurrentAction = 'mecano_craft_menu' - CurrentActionMsg = _U('craft_menu') - CurrentActionData = {} - end - ) - else - ESX.ShowNotification(_U('not_experienced_enough')) - end + else + ESX.ShowNotification(_U('not_experienced_enough')) + end end function OpenMobileMecanoActionsMenu() - ESX.UI.Menu.CloseAll() + ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mobile_mecano_actions', - { - title = _U('mechanic'), - align = 'top-left', - elements = { - {label = _U('billing'), value = 'billing'}, - {label = _U('hijack'), value = 'hijack_vehicle'}, - {label = _U('repair'), value = 'fix_vehicle'}, - {label = _U('clean'), value = 'clean_vehicle'}, - {label = _U('imp_veh'), value = 'del_vehicle'}, - {label = _U('flat_bed'), value = 'dep_vehicle'}, - {label = _U('place_objects'), value = 'object_spawner'} - } - }, - function(data, menu) - if IsBusy then return end + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_mecano_actions', { + title = _U('mechanic'), + align = 'top-left', + elements = { + {label = _U('billing'), value = 'billing'}, + {label = _U('hijack'), value = 'hijack_vehicle'}, + {label = _U('repair'), value = 'fix_vehicle'}, + {label = _U('clean'), value = 'clean_vehicle'}, + {label = _U('imp_veh'), value = 'del_vehicle'}, + {label = _U('flat_bed'), value = 'dep_vehicle'}, + {label = _U('place_objects'), value = 'object_spawner'} + } + }, function(data, menu) + if IsBusy then return end - if data.current.value == 'billing' then - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'billing', - { - title = _U('invoice_amount') - }, - function(data, menu) - local amount = tonumber(data.value) - if amount == nil or amount < 0 then - ESX.ShowNotification(_U('amount_invalid')) - else - - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players_nearby')) - else + if data.current.value == 'billing' then + + ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'billing', { + title = _U('invoice_amount') + }, function(data, menu) + local amount = tonumber(data.value) + + if amount == nil or amount < 0 then + ESX.ShowNotification(_U('amount_invalid')) + else + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players_nearby')) + else + menu.close() + TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mecano', _U('mechanic'), amount) + end + end + end, function(data, menu) menu.close() - TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mecano', _U('mechanic'), amount) - end - end - end, - function(data, menu) - menu.close() - end - ) - end + end) - if data.current.value == 'hijack_vehicle' then + elseif data.current.value == 'hijack_vehicle' then - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() local vehicle = ESX.Game.GetVehicleInDirection() local coords = GetEntityCoords(playerPed) @@ -432,7 +376,7 @@ function OpenMobileMecanoActionsMenu() elseif data.current.value == 'fix_vehicle' then - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() local vehicle = ESX.Game.GetVehicleInDirection() local coords = GetEntityCoords(playerPed) @@ -462,7 +406,7 @@ function OpenMobileMecanoActionsMenu() elseif data.current.value == 'clean_vehicle' then - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() local vehicle = ESX.Game.GetVehicleInDirection() local coords = GetEntityCoords(playerPed) @@ -487,588 +431,529 @@ function OpenMobileMecanoActionsMenu() ESX.ShowNotification(_U('no_vehicle_nearby')) end - elseif data.current.value == 'del_vehicle' then + elseif data.current.value == 'del_vehicle' then - local ped = GetPlayerPed(-1) + local ped = PlayerPedId() - if DoesEntityExist(ped) and not IsEntityDead(ped) then - local pos = GetEntityCoords( ped ) + if DoesEntityExist(ped) and not IsEntityDead(ped) then + local pos = GetEntityCoords( ped ) - if IsPedSittingInAnyVehicle(ped) then - local vehicle = GetVehiclePedIsIn( ped, false ) + if IsPedSittingInAnyVehicle(ped) then + local vehicle = GetVehiclePedIsIn( ped, false ) - if GetPedInVehicleSeat(vehicle, -1) == ped then - ESX.ShowNotification(_U('vehicle_impounded')) - ESX.Game.DeleteVehicle(vehicle) - else - ESX.ShowNotification(_U('must_seat_driver')) - end - else - local vehicle = ESX.Game.GetVehicleInDirection() + if GetPedInVehicleSeat(vehicle, -1) == ped then + ESX.ShowNotification(_U('vehicle_impounded')) + ESX.Game.DeleteVehicle(vehicle) + else + ESX.ShowNotification(_U('must_seat_driver')) + end + else + local vehicle = ESX.Game.GetVehicleInDirection() - if DoesEntityExist(vehicle) then - ESX.ShowNotification(_U('vehicle_impounded')) - ESX.Game.DeleteVehicle(vehicle) - else - ESX.ShowNotification(_U('must_near')) - end - end - end - end + if DoesEntityExist(vehicle) then + ESX.ShowNotification(_U('vehicle_impounded')) + ESX.Game.DeleteVehicle(vehicle) + else + ESX.ShowNotification(_U('must_near')) + end + end + end - if data.current.value == 'dep_vehicle' then + elseif data.current.value == 'dep_vehicle' then - local playerped = GetPlayerPed(-1) - local vehicle = GetVehiclePedIsIn(playerped, true) + local playerPed = PlayerPedId() + local vehicle = GetVehiclePedIsIn(playerPed, true) - local towmodel = GetHashKey('flatbed') - local isVehicleTow = IsVehicleModel(vehicle, towmodel) + local towmodel = GetHashKey('flatbed') + local isVehicleTow = IsVehicleModel(vehicle, towmodel) - if isVehicleTow then - local targetVehicle = ESX.Game.GetVehicleInDirection() + if isVehicleTow then + local targetVehicle = ESX.Game.GetVehicleInDirection() - if CurrentlyTowedVehicle == nil then - if targetVehicle ~= 0 then - if not IsPedInAnyVehicle(playerped, true) then - if vehicle ~= targetVehicle then - AttachEntityToEntity(targetVehicle, vehicle, 20, -0.5, -5.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) - CurrentlyTowedVehicle = targetVehicle - ESX.ShowNotification(_U('vehicle_success_attached')) + if CurrentlyTowedVehicle == nil then + if targetVehicle ~= 0 then + if not IsPedInAnyVehicle(playerPed, true) then + if vehicle ~= targetVehicle then + AttachEntityToEntity(targetVehicle, vehicle, 20, -0.5, -5.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) + CurrentlyTowedVehicle = targetVehicle + ESX.ShowNotification(_U('vehicle_success_attached')) - if NPCOnJob then + if NPCOnJob then + if NPCTargetTowable == targetVehicle then + ESX.ShowNotification(_U('please_drop_off')) + Config.Zones.VehicleDelivery.Type = 1 - if NPCTargetTowable == targetVehicle then - ESX.ShowNotification(_U('please_drop_off')) + if Blips['NPCTargetTowableZone'] ~= nil then + RemoveBlip(Blips['NPCTargetTowableZone']) + Blips['NPCTargetTowableZone'] = nil + end - Config.Zones.VehicleDelivery.Type = 1 + Blips['NPCDelivery'] = AddBlipForCoord(Config.Zones.VehicleDelivery.Pos.x, Config.Zones.VehicleDelivery.Pos.y, Config.Zones.VehicleDelivery.Pos.z) + SetBlipRoute(Blips['NPCDelivery'], true) + end + end + else + ESX.ShowNotification(_U('cant_attach_own_tt')) + end + end + else + ESX.ShowNotification(_U('no_veh_att')) + end + else - if Blips['NPCTargetTowableZone'] ~= nil then - RemoveBlip(Blips['NPCTargetTowableZone']) - Blips['NPCTargetTowableZone'] = nil - end + AttachEntityToEntity(CurrentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) + DetachEntity(CurrentlyTowedVehicle, true, true) - Blips['NPCDelivery'] = AddBlipForCoord(Config.Zones.VehicleDelivery.Pos.x, Config.Zones.VehicleDelivery.Pos.y, Config.Zones.VehicleDelivery.Pos.z) + if NPCOnJob then + if NPCTargetDeleterZone then - SetBlipRoute(Blips['NPCDelivery'], true) + if CurrentlyTowedVehicle == NPCTargetTowable then + ESX.Game.DeleteVehicle(NPCTargetTowable) + TriggerServerEvent('esx_mecanojob:onNPCJobMissionCompleted') + StopNPCJob() + NPCTargetDeleterZone = false + else + ESX.ShowNotification(_U('not_right_veh')) + end - end + else + ESX.ShowNotification(_U('not_right_place')) + end + end - end + CurrentlyTowedVehicle = nil + ESX.ShowNotification(_U('veh_det_succ')) - else - ESX.ShowNotification(_U('cant_attach_own_tt')) - end - end - else - ESX.ShowNotification(_U('no_veh_att')) - end - else + end + else + ESX.ShowNotification(_U('imp_flatbed')) + end - AttachEntityToEntity(CurrentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) - DetachEntity(CurrentlyTowedVehicle, true, true) + elseif data.current.value == 'object_spawner' then - if NPCOnJob then - - if NPCTargetDeleterZone then - - if CurrentlyTowedVehicle == NPCTargetTowable then - ESX.Game.DeleteVehicle(NPCTargetTowable) - TriggerServerEvent('esx_mecanojob:onNPCJobMissionCompleted') - StopNPCJob() - NPCTargetDeleterZone = false - - else - ESX.ShowNotification(_U('not_right_veh')) - end - - else - ESX.ShowNotification(_U('not_right_place')) - end - - end - - CurrentlyTowedVehicle = nil - - ESX.ShowNotification(_U('veh_det_succ')) - end - else - ESX.ShowNotification(_U('imp_flatbed')) - end - end - - if data.current.value == 'object_spawner' then - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() if IsPedSittingInAnyVehicle(playerPed) then ESX.ShowNotification(_U('inside_vehicle')) return end - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'mobile_mecano_actions_spawn', - { - title = _U('objects'), - align = 'top-left', - elements = { - {label = _U('roadcone'), value = 'prop_roadcone02a'}, - {label = _U('toolbox'), value = 'prop_toolchest_01'}, - }, - }, - function(data2, menu2) + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_mecano_actions_spawn', { + title = _U('objects'), + align = 'top-left', + elements = { + {label = _U('roadcone'), value = 'prop_roadcone02a'}, + {label = _U('toolbox'), value = 'prop_toolchest_01'} + } + }, function(data2, menu2) + local model = data2.current.value + local coords = GetEntityCoords(playerPed) + local forward = GetEntityForwardVector(playerPed) + local x, y, z = table.unpack(coords + forward * 1.0) - local model = data2.current.value - local coords = GetEntityCoords(playerPed) - local forward = GetEntityForwardVector(playerPed) - local x, y, z = table.unpack(coords + forward * 1.0) + if model == 'prop_roadcone02a' then + z = z - 2.0 + elseif model == 'prop_toolchest_01' then + z = z - 2.0 + end - if model == 'prop_roadcone02a' then - z = z - 2.0 - elseif model == 'prop_toolchest_01' then - z = z - 2.0 - end + ESX.Game.SpawnObject(model, { + x = x, + y = y, + z = z + }, function(obj) + SetEntityHeading(obj, GetEntityHeading(playerPed)) + PlaceObjectOnGroundProperly(obj) + end) - ESX.Game.SpawnObject(model, { - x = x, - y = y, - z = z - }, function(obj) - SetEntityHeading(obj, GetEntityHeading(playerPed)) - PlaceObjectOnGroundProperly(obj) - end) + end, function(data2, menu2) + menu2.close() + end) - end, - function(data2, menu2) - menu2.close() - end - ) + end - end - - end, - function(data, menu) - menu.close() - end - ) + end, function(data, menu) + menu.close() + end) end function OpenGetStocksMenu() - ESX.TriggerServerCallback('esx_mecanojob:getStockItems', function(items) - local elements = {} + ESX.TriggerServerCallback('esx_mecanojob:getStockItems', function(items) - for i=1, #items, 1 do - table.insert(elements, {label = 'x' .. items[i].count .. ' ' .. items[i].label, value = items[i].name}) - end + local elements = {} - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'stocks_menu', - { - title = _U('mechanic_stock'), - align = 'top-left', - elements = elements - }, - function(data, menu) + for i=1, #items, 1 do + table.insert(elements, { + label = 'x' .. items[i].count .. ' ' .. items[i].label, + value = items[i].name + }) + end - local itemName = data.current.value + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'stocks_menu', + { + title = _U('mechanic_stock'), + align = 'top-left', + elements = elements + }, function(data, menu) - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'stocks_menu_get_item_count', - { - title = _U('quantity') - }, - function(data2, menu2) + local itemName = data.current.value - local count = tonumber(data2.value) + ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'stocks_menu_get_item_count', { + title = _U('quantity') + }, function(data2, menu2) + local count = tonumber(data2.value) - if count == nil then - ESX.ShowNotification(_U('invalid_quantity')) - else - menu2.close() - menu.close() - TriggerServerEvent('esx_mecanojob:getStockItem', itemName, count) + if count == nil then + ESX.ShowNotification(_U('invalid_quantity')) + else + menu2.close() + menu.close() + TriggerServerEvent('esx_mecanojob:getStockItem', itemName, count) - Citizen.Wait(1000) - OpenGetStocksMenu() - end + Citizen.Wait(1000) + OpenGetStocksMenu() + end + end, function(data2, menu2) + menu2.close() + end) - end, - function(data2, menu2) - menu2.close() - end - ) + end, function(data, menu) + menu.close() + end) - end, - function(data, menu) - menu.close() - end - ) - - end) + end) end function OpenPutStocksMenu() -ESX.TriggerServerCallback('esx_mecanojob:getPlayerInventory', function(inventory) + ESX.TriggerServerCallback('esx_mecanojob:getPlayerInventory', function(inventory) + local elements = {} - local elements = {} + for i=1, #inventory.items, 1 do + local item = inventory.items[i] - for i=1, #inventory.items, 1 do + if item.count > 0 then + table.insert(elements, { + label = item.label .. ' x' .. item.count, + type = 'item_standard', + value = item.name + }) + end + end - local item = inventory.items[i] + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'stocks_menu', { + title = _U('inventory'), + align = 'top-left', + elements = elements + }, function(data, menu) - if item.count > 0 then - table.insert(elements, {label = item.label .. ' x' .. item.count, type = 'item_standard', value = item.name}) - end + local itemName = data.current.value - end + ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'stocks_menu_put_item_count', { + title = _U('quantity') + }, function(data2, menu2) + local count = tonumber(data2.value) - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'stocks_menu', - { - title = _U('inventory'), - align = 'top-left', - elements = elements - }, - function(data, menu) + if count == nil then + ESX.ShowNotification(_U('invalid_quantity')) + else + menu2.close() + menu.close() + TriggerServerEvent('esx_mecanojob:putStockItems', itemName, count) - local itemName = data.current.value + Citizen.Wait(1000) + OpenPutStocksMenu() + end + end, function(data2, menu2) + menu2.close() + end) + end, function(data, menu) + menu.close() + end) - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'stocks_menu_put_item_count', - { - title = _U('quantity') - }, - function(data2, menu2) - - local count = tonumber(data2.value) - - if count == nil then - ESX.ShowNotification(_U('invalid_quantity')) - else - menu2.close() - menu.close() - TriggerServerEvent('esx_mecanojob:putStockItems', itemName, count) - - Citizen.Wait(1000) - OpenPutStocksMenu() - end - - end, - function(data2, menu2) - menu2.close() - end - ) - - end, - function(data, menu) - menu.close() - end - ) - - end) + end) end RegisterNetEvent('esx_mecanojob:onHijack') AddEventHandler('esx_mecanojob:onHijack', function() - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + local vehicle = nil - local vehicle = nil + if IsPedInAnyVehicle(playerPed, false) then + vehicle = GetVehiclePedIsIn(playerPed, false) + else + vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) + end - if IsPedInAnyVehicle(playerPed, false) then - vehicle = GetVehiclePedIsIn(playerPed, false) - else - vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) - end + local chance = math.random(100) + local alarm = math.random(100) - local crochete = math.random(100) - local alarm = math.random(100) + if DoesEntityExist(vehicle) then + if alarm <= 33 then + SetVehicleAlarm(vehicle, true) + StartVehicleAlarm(vehicle) + end - if DoesEntityExist(vehicle) then - if alarm <= 33 then - SetVehicleAlarm(vehicle, true) - StartVehicleAlarm(vehicle) - end - TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_WELDING", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(10000) - if crochete <= 66 then - SetVehicleDoorsLocked(vehicle, 1) - SetVehicleDoorsLockedForAllPlayers(vehicle, false) - ClearPedTasksImmediately(playerPed) - ESX.ShowNotification(_U('veh_unlocked')) - else - ESX.ShowNotification(_U('hijack_failed')) - ClearPedTasksImmediately(playerPed) - end - end) - end + TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_WELDING", 0, true) - end + Citizen.CreateThread(function() + Citizen.Wait(10000) + if chance <= 66 then + SetVehicleDoorsLocked(vehicle, 1) + SetVehicleDoorsLockedForAllPlayers(vehicle, false) + ClearPedTasksImmediately(playerPed) + ESX.ShowNotification(_U('veh_unlocked')) + else + ESX.ShowNotification(_U('hijack_failed')) + ClearPedTasksImmediately(playerPed) + end + end) + + end + end end) RegisterNetEvent('esx_mecanojob:onCarokit') AddEventHandler('esx_mecanojob:onCarokit', function() - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + local vehicle = nil - local vehicle = nil + if IsPedInAnyVehicle(playerPed, false) then + vehicle = GetVehiclePedIsIn(playerPed, false) + else + vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) + 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_HAMMERING", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(10000) - SetVehicleFixed(vehicle) - SetVehicleDeformationFixed(vehicle) - ClearPedTasksImmediately(playerPed) - ESX.ShowNotification(_U('body_repaired')) - end) - end - end + if DoesEntityExist(vehicle) then + TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_HAMMERING", 0, true) + Citizen.CreateThread(function() + Citizen.Wait(10000) + SetVehicleFixed(vehicle) + SetVehicleDeformationFixed(vehicle) + ClearPedTasksImmediately(playerPed) + ESX.ShowNotification(_U('body_repaired')) + end) + end + end end) RegisterNetEvent('esx_mecanojob:onFixkit') AddEventHandler('esx_mecanojob:onFixkit', function() - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + local vehicle = nil - local vehicle = nil + if IsPedInAnyVehicle(playerPed, false) then + vehicle = GetVehiclePedIsIn(playerPed, false) + else + vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) + 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, "PROP_HUMAN_BUM_BIN", 0, true) - Citizen.CreateThread(function() - Citizen.Wait(20000) - SetVehicleFixed(vehicle) - SetVehicleDeformationFixed(vehicle) - SetVehicleUndriveable(vehicle, false) - ClearPedTasksImmediately(playerPed) - ESX.ShowNotification(_U('veh_repaired')) - end) - end - end + 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) + ClearPedTasksImmediately(playerPed) + ESX.ShowNotification(_U('veh_repaired')) + end) + end + end end) RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer) - PlayerData = xPlayer + PlayerData = xPlayer end) RegisterNetEvent('esx:setJob') AddEventHandler('esx:setJob', function(job) - PlayerData.job = job + PlayerData.job = job end) AddEventHandler('esx_mecanojob:hasEnteredMarker', function(zone) + if zone == NPCJobTargetTowable then - if zone == NPCJobTargetTowable then + elseif zone =='VehicleDelivery' then + NPCTargetDeleterZone = true + elseif zone == 'MecanoActions' then + CurrentAction = 'mecano_actions_menu' + CurrentActionMsg = _U('open_actions') + CurrentActionData = {} + elseif zone == 'Garage' then + CurrentAction = 'mecano_harvest_menu' + CurrentActionMsg = _U('harvest_menu') + CurrentActionData = {} + elseif zone == 'Craft' then + CurrentAction = 'mecano_craft_menu' + CurrentActionMsg = _U('craft_menu') + CurrentActionData = {} + elseif zone == 'VehicleDeleter' then + local playerPed = PlayerPedId() - end - - if zone =='VehicleDelivery' then - NPCTargetDeleterZone = true - end - - if zone == 'MecanoActions' then - CurrentAction = 'mecano_actions_menu' - CurrentActionMsg = _U('open_actions') - CurrentActionData = {} - end - - if zone == 'Garage' then - CurrentAction = 'mecano_harvest_menu' - CurrentActionMsg = _U('harvest_menu') - CurrentActionData = {} - end - - if zone == 'Craft' then - CurrentAction = 'mecano_craft_menu' - CurrentActionMsg = _U('craft_menu') - CurrentActionData = {} - end - - if zone == 'VehicleDeleter' then - - local playerPed = GetPlayerPed(-1) - - if IsPedInAnyVehicle(playerPed, false) then - - local vehicle = GetVehiclePedIsIn(playerPed, false) - - CurrentAction = 'delete_vehicle' - CurrentActionMsg = _U('veh_stored') - CurrentActionData = {vehicle = vehicle} - end - end + if IsPedInAnyVehicle(playerPed, false) then + local vehicle = GetVehiclePedIsIn(playerPed, false) + CurrentAction = 'delete_vehicle' + CurrentActionMsg = _U('veh_stored') + CurrentActionData = {vehicle = vehicle} + end + end end) AddEventHandler('esx_mecanojob:hasExitedMarker', function(zone) + if zone =='VehicleDelivery' then + NPCTargetDeleterZone = false + elseif zone == 'Craft' then + TriggerServerEvent('esx_mecanojob:stopCraft') + TriggerServerEvent('esx_mecanojob:stopCraft2') + TriggerServerEvent('esx_mecanojob:stopCraft3') + elseif zone == 'Garage' then + TriggerServerEvent('esx_mecanojob:stopHarvest') + TriggerServerEvent('esx_mecanojob:stopHarvest2') + TriggerServerEvent('esx_mecanojob:stopHarvest3') + end - if zone =='VehicleDelivery' then - NPCTargetDeleterZone = false - end - - if zone == 'Craft' then - TriggerServerEvent('esx_mecanojob:stopCraft') - TriggerServerEvent('esx_mecanojob:stopCraft2') - TriggerServerEvent('esx_mecanojob:stopCraft3') - end - - if zone == 'Garage' then - TriggerServerEvent('esx_mecanojob:stopHarvest') - TriggerServerEvent('esx_mecanojob:stopHarvest2') - TriggerServerEvent('esx_mecanojob:stopHarvest3') - end - - CurrentAction = nil - ESX.UI.Menu.CloseAll() + CurrentAction = nil + ESX.UI.Menu.CloseAll() end) AddEventHandler('esx_mecanojob:hasEnteredEntityZone', function(entity) + local playerPed = PlayerPedId() - local playerPed = GetPlayerPed(-1) - - if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' and not IsPedInAnyVehicle(playerPed, false) then - CurrentAction = 'remove_entity' - CurrentActionMsg = _U('press_remove_obj') - CurrentActionData = {entity = entity} - end - + if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' and not IsPedInAnyVehicle(playerPed, false) then + CurrentAction = 'remove_entity' + CurrentActionMsg = _U('press_remove_obj') + CurrentActionData = {entity = entity} + end end) AddEventHandler('esx_mecanojob:hasExitedEntityZone', function(entity) - - if CurrentAction == 'remove_entity' then - CurrentAction = nil - end - + if CurrentAction == 'remove_entity' then + CurrentAction = nil + end end) RegisterNetEvent('esx_phone:loaded') AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) - local specialContact = { - name = _U('mechanic'), - number = 'mecano', - 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) + local specialContact = { + name = _U('mechanic'), + number = 'mecano', + 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 Citizen.CreateThread(function() - while true do + while true do - Wait(0) + Citizen.Wait(10) - if NPCTargetTowableZone ~= nil and not NPCHasSpawnedTowable then + if NPCTargetTowableZone ~= nil and not NPCHasSpawnedTowable then + local coords = GetEntityCoords(PlayerPedId()) + local zone = Config.Zones[NPCTargetTowableZone] - local coords = GetEntityCoords(GetPlayerPed(-1)) - local zone = Config.Zones[NPCTargetTowableZone] + if GetDistanceBetweenCoords(coords, zone.Pos.x, zone.Pos.y, zone.Pos.z, true) < Config.NPCSpawnDistance then + local model = Config.Vehicles[GetRandomIntInRange(1, #Config.Vehicles)] - if GetDistanceBetweenCoords(coords, zone.Pos.x, zone.Pos.y, zone.Pos.z, true) < Config.NPCSpawnDistance then + ESX.Game.SpawnVehicle(model, zone.Pos, 0, function(vehicle) + NPCTargetTowable = vehicle + end) - local model = Config.Vehicles[GetRandomIntInRange(1, #Config.Vehicles)] + NPCHasSpawnedTowable = true + end + end - ESX.Game.SpawnVehicle(model, zone.Pos, 0, function(vehicle) - NPCTargetTowable = vehicle - end) + if NPCTargetTowableZone ~= nil and NPCHasSpawnedTowable and not NPCHasBeenNextToTowable then + local coords = GetEntityCoords(PlayerPedId()) + local zone = Config.Zones[NPCTargetTowableZone] - NPCHasSpawnedTowable = true + if GetDistanceBetweenCoords(coords, zone.Pos.x, zone.Pos.y, zone.Pos.z, true) < Config.NPCNextToDistance then + ESX.ShowNotification(_U('please_tow')) + NPCHasBeenNextToTowable = true + end + end - end - - end - - if NPCTargetTowableZone ~= nil and NPCHasSpawnedTowable and not NPCHasBeenNextToTowable then - - local coords = GetEntityCoords(GetPlayerPed(-1)) - local zone = Config.Zones[NPCTargetTowableZone] - - if(GetDistanceBetweenCoords(coords, zone.Pos.x, zone.Pos.y, zone.Pos.z, true) < Config.NPCNextToDistance) then - ESX.ShowNotification(_U('please_tow')) - NPCHasBeenNextToTowable = true - end - - end - - end + end end) -- Create Blips Citizen.CreateThread(function() - local blip = AddBlipForCoord(Config.Zones.MecanoActions.Pos.x, Config.Zones.MecanoActions.Pos.y, Config.Zones.MecanoActions.Pos.z) - SetBlipSprite (blip, 446) - SetBlipDisplay(blip, 4) - SetBlipScale (blip, 1.8) - SetBlipColour (blip, 5) - SetBlipAsShortRange(blip, true) - BeginTextCommandSetBlipName("STRING") - AddTextComponentString(_U('mechanic')) - EndTextCommandSetBlipName(blip) + local blip = AddBlipForCoord(Config.Zones.MecanoActions.Pos.x, Config.Zones.MecanoActions.Pos.y, Config.Zones.MecanoActions.Pos.z) + + SetBlipSprite (blip, 446) + SetBlipDisplay(blip, 4) + SetBlipScale (blip, 1.8) + SetBlipColour (blip, 5) + SetBlipAsShortRange(blip, true) + + BeginTextCommandSetBlipName("STRING") + AddTextComponentString(_U('mechanic')) + EndTextCommandSetBlipName(blip) end) -- Display markers Citizen.CreateThread(function() - while true do - Wait(0) - if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + while true do + Citizen.Wait(0) + if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + local coords = GetEntityCoords(PlayerPedId()) - local coords = GetEntityCoords(GetPlayerPed(-1)) - - for k,v in pairs(Config.Zones) do - if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 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, false, true, 2, false, false, false, false) - end - end - end - end + for k,v in pairs(Config.Zones) do + if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then + DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 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, false, true, 2, false, false, false, false) + end + end + end + end end) -- Enter / Exit marker events Citizen.CreateThread(function() - while true do - Wait(0) - if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - local coords = GetEntityCoords(GetPlayerPed(-1)) - local isInMarker = false - local currentZone = nil - for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then - isInMarker = true - currentZone = k - end - end - if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then - HasAlreadyEnteredMarker = true - LastZone = currentZone - TriggerEvent('esx_mecanojob:hasEnteredMarker', currentZone) - end - if not isInMarker and HasAlreadyEnteredMarker then - HasAlreadyEnteredMarker = false - TriggerEvent('esx_mecanojob:hasExitedMarker', LastZone) - end - end - end + while true do + Citizen.Wait(10) + + if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + + local coords = GetEntityCoords(PlayerPedId()) + local isInMarker = false + local currentZone = nil + + for k,v in pairs(Config.Zones) do + if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then + isInMarker = true + currentZone = k + end + end + + if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then + HasAlreadyEnteredMarker = true + LastZone = currentZone + TriggerEvent('esx_mecanojob:hasEnteredMarker', currentZone) + end + + if not isInMarker and HasAlreadyEnteredMarker then + HasAlreadyEnteredMarker = false + TriggerEvent('esx_mecanojob:hasExitedMarker', LastZone) + end + + end + end end) Citizen.CreateThread(function() @@ -1080,18 +965,18 @@ Citizen.CreateThread(function() while true do Citizen.Wait(500) - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) local closestDistance = -1 local closestEntity = nil for i=1, #trackedEntities, 1 do - local object = GetClosestObjectOfType(coords.x, coords.y, coords.z, 3.0, GetHashKey(trackedEntities[i]), false, false, false) + local object = GetClosestObjectOfType(coords.x, coords.y, coords.z, 3.0, GetHashKey(trackedEntities[i]), false, false, false) if DoesEntityExist(object) then local objCoords = GetEntityCoords(object) - local distance = GetDistanceBetweenCoords(coords.x, coords.y, coords.z, objCoords.x, objCoords.y, objCoords.z, true) + local distance = GetDistanceBetweenCoords(coords.x, coords.y, coords.z, objCoords.x, objCoords.y, objCoords.z, true) if closestDistance == -1 or closestDistance > distance then closestDistance = distance @@ -1116,89 +1001,79 @@ end) -- Key Controls Citizen.CreateThread(function() - while true do - Citizen.Wait(0) + while true do + Citizen.Wait(10) - if CurrentAction ~= nil then + if CurrentAction ~= nil then + ESX.ShowHelpNotification(CurrentActionMsg) - SetTextComponentFormat('STRING') - AddTextComponentString(CurrentActionMsg) - DisplayHelpTextFromStringLabel(0, 0, 1, -1) + if IsControlJustReleased(0, Keys['E']) 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() + elseif CurrentAction == 'mecano_harvest_menu' then + OpenMecanoHarvestMenu() + elseif CurrentAction == 'mecano_craft_menu' then + OpenMecanoCraftMenu() + elseif CurrentAction == 'delete_vehicle' then - if CurrentAction == 'mecano_actions_menu' then - OpenMecanoActionsMenu() - end + if Config.EnableSocietyOwnedVehicles then - if CurrentAction == 'mecano_harvest_menu' then - OpenMecanoHarvestMenu() - end + local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) + TriggerServerEvent('esx_society:putVehicleInGarage', 'mecano', vehicleProps) - if CurrentAction == 'mecano_craft_menu' then - OpenMecanoCraftMenu() - end + else - if CurrentAction == 'delete_vehicle' then + if + GetEntityModel(vehicle) == GetHashKey('flatbed') or + GetEntityModel(vehicle) == GetHashKey('towtruck2') or + GetEntityModel(vehicle) == GetHashKey('slamvan3') + then + TriggerServerEvent('esx_service:disableService', 'mecano') + end - if Config.EnableSocietyOwnedVehicles then + end - local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) - TriggerServerEvent('esx_society:putVehicleInGarage', 'mecano', vehicleProps) + ESX.Game.DeleteVehicle(CurrentActionData.vehicle) + end - else + elseif CurrentAction == 'remove_entity' then + DeleteEntity(CurrentActionData.entity) + end - if - GetEntityModel(vehicle) == GetHashKey('flatbed') or - GetEntityModel(vehicle) == GetHashKey('towtruck2') or - GetEntityModel(vehicle) == GetHashKey('slamvan3') - then - TriggerServerEvent('esx_service:disableService', 'mecano') - end + CurrentAction = nil + end - end + if IsControlJustReleased(0, Keys['F6']) and not IsDead and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + OpenMobileMecanoActionsMenu() + end - ESX.Game.DeleteVehicle(CurrentActionData.vehicle) - end + if IsControlJustReleased(0, Keys['DELETE']) and not IsDead and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - if CurrentAction == 'remove_entity' then - DeleteEntity(CurrentActionData.entity) - end + if NPCOnJob then - CurrentAction = nil - end - end + if GetGameTimer() - NPCLastCancel > 5 * 60000 then + StopNPCJob(true) + NPCLastCancel = GetGameTimer() + else + ESX.ShowNotification(_U('wait_five')) + end - if IsControlJustReleased(0, Keys['F6']) and not IsDead and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - OpenMobileMecanoActionsMenu() - end + else - if IsControlJustReleased(0, Keys['DELETE']) and not IsDead and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + local playerPed = PlayerPedId() - if NPCOnJob then + if IsPedInAnyVehicle(playerPed, false) and IsVehicleModel(GetVehiclePedIsIn(playerPed, false), GetHashKey("flatbed")) then + StartNPCJob() + else + ESX.ShowNotification(_U('must_in_flatbed')) + end - if GetGameTimer() - NPCLastCancel > 5 * 60000 then - StopNPCJob(true) - NPCLastCancel = GetGameTimer() - else - ESX.ShowNotification(_U('wait_five')) - end + end - else + end - local playerPed = GetPlayerPed(-1) - - if IsPedInAnyVehicle(playerPed, false) and IsVehicleModel(GetVehiclePedIsIn(playerPed, false), GetHashKey("flatbed")) then - StartNPCJob() - else - ESX.ShowNotification(_U('must_in_flatbed')) - end - - end - - end - - end + end end) AddEventHandler('esx:onPlayerDeath', function() @@ -1207,4 +1082,4 @@ end) AddEventHandler('playerSpawned', function(spawn) IsDead = false -end) \ No newline at end of file +end) diff --git a/config.lua b/config.lua index f9932363..1a580b14 100644 --- a/config.lua +++ b/config.lua @@ -8,105 +8,107 @@ Config.NPCNextToDistance = 25.0 Config.NPCJobEarnings = { min = 15, max = 40 } Config.Locale = 'fr' +Config.Vehicles = { + 'adder', + 'asea', + 'asterope', + 'banshee', + 'buffalo' +} + Config.Zones = { - MecanoActions = { - 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, - }, - Garage = { - Pos = { x = -97.5797576904297, y = 6496.11376953125, z = 30.4909038543701 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, - Color = { r = 204, g = 204, b = 0 }, - Type = 1, - }, + MecanoActions = { + 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, + }, - Craft = { - Pos = { x = -323.140, y = -129.882, z = 37.999 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, - Color = { r = 204, g = 204, b = 0 }, - Type = 1, - }, + Garage = { + Pos = { x = -97.5797576904297, y = 6496.11376953125, z = 30.4909038543701 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Color = { r = 204, g = 204, b = 0 }, + Type = 1, + }, - VehicleSpawnPoint = { - Pos = { x = -366.354, y = -110.766, z = 37.696 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, - Type = -1, - }, + Craft = { + Pos = { x = -323.140, y = -129.882, z = 37.999 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Color = { r = 204, g = 204, b = 0 }, + Type = 1, + }, - VehicleDeleter = { - Pos = { x = -386.899, y = -105.675, z = 37.683 }, - Size = { x = 3.0, y = 3.0, z = 1.0 }, - Color = { r = 204, g = 204, b = 0 }, - Type = 1, - }, + VehicleSpawnPoint = { + Pos = { x = -366.354, y = -110.766, z = 37.696 }, + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Type = -1, + }, + + VehicleDeleter = { + Pos = { x = -386.899, y = -105.675, z = 37.683 }, + Size = { x = 3.0, y = 3.0, z = 1.0 }, + Color = { r = 204, g = 204, b = 0 }, + Type = 1, + }, + + VehicleDelivery = { + Pos = { x = -382.925, y = -133.748, z = 37.685 }, + Size = { x = 20.0, y = 20.0, z = 3.0 }, + Color = { r = 204, g = 204, b = 0 }, + Type = -1, + } - VehicleDelivery = { - Pos = { x = -382.925, y = -133.748, z = 37.685 }, - Size = { x = 20.0, y = 20.0, z = 3.0 }, - Color = { r = 204, g = 204, b = 0 }, - Type = -1, - }, } Config.Towables = { - { ['x'] = -2480.8720703125, ['y'] = -211.96409606934, ['z'] = 17.397672653198 }, - { ['x'] = -2723.392578125, ['y'] = 13.207388877869, ['z'] = 15.12806892395 }, - { ['x'] = -3169.6235351563, ['y'] = 976.18127441406, ['z'] = 15.038360595703 }, - { ['x'] = -3139.7568359375, ['y'] = 1078.7182617188, ['z'] = 20.189767837524 }, - { ['x'] = -1656.9357910156, ['y'] = -246.16479492188, ['z'] = 54.510955810547 }, - { ['x'] = -1586.6560058594, ['y'] = -647.56115722656, ['z'] = 29.441320419312 }, - { ['x'] = -1036.1470947266, ['y'] = -491.05856323242, ['z'] = 36.214912414551 }, - { ['x'] = -1029.1884765625, ['y'] = -475.53167724609, ['z'] = 36.416831970215 }, - { ['x'] = 75.212287902832, ['y'] = 164.8522644043, ['z'] = 104.69123077393 }, - { ['x'] = -534.60491943359, ['y'] = -756.71801757813, ['z'] = 31.599143981934 }, - { ['x'] = 487.24212646484, ['y'] = -30.827201843262, ['z'] = 88.856712341309 }, - { ['x'] = -772.20111083984, ['y'] = -1281.8114013672, ['z'] = 4.5642876625061 }, - { ['x'] = -663.84173583984, ['y'] = -1206.9936523438, ['z'] = 10.171216011047 }, - { ['x'] = 719.12451171875, ['y'] = -767.77545166016, ['z'] = 24.892364501953 }, - { ['x'] = -970.95465087891, ['y'] = -2410.4453125, ['z'] = 13.344270706177 }, - { ['x'] = -1067.5234375, ['y'] = -2571.4064941406, ['z'] = 13.211874008179 }, - { ['x'] = -619.23968505859, ['y'] = -2207.2927246094, ['z'] = 5.5659561157227 }, - { ['x'] = 1192.0831298828, ['y'] = -1336.9086914063, ['z'] = 35.106426239014 }, - { ['x'] = -432.81033325195, ['y'] = -2166.0505371094, ['z'] = 9.8885231018066 }, - { ['x'] = -451.82403564453, ['y'] = -2269.34765625, ['z'] = 7.1719741821289 }, - { ['x'] = 939.26702880859, ['y'] = -2197.5390625, ['z'] = 30.546691894531 }, - { ['x'] = -556.11486816406, ['y'] = -1794.7312011719, ['z'] = 22.043060302734 }, - { ['x'] = 591.73504638672, ['y'] = -2628.2197265625, ['z'] = 5.5735430717468 }, - { ['x'] = 1654.515625, ['y'] = -2535.8325195313, ['z'] = 74.491394042969 }, - { ['x'] = 1642.6146240234, ['y'] = -2413.3159179688, ['z'] = 93.139915466309 }, - { ['x'] = 1371.3223876953, ['y'] = -2549.525390625, ['z'] = 47.575256347656 }, - { ['x'] = 383.83779907227, ['y'] = -1652.8695068359, ['z'] = 37.278503417969 }, - { ['x'] = 27.219129562378, ['y'] = -1030.8818359375, ['z'] = 29.414621353149 }, - { ['x'] = 229.26435852051, ['y'] = -365.91101074219, ['z'] = 43.750762939453 }, - { ['x'] = -85.809432983398, ['y'] = -51.665500640869, ['z'] = 61.10591506958 }, - { ['x'] = -4.5967531204224, ['y'] = -670.27124023438, ['z'] = 31.85863494873 }, - { ['x'] = -111.89884185791, ['y'] = 91.96940612793, ['z'] = 71.080169677734 }, - { ['x'] = -314.26129150391, ['y'] = -698.23309326172, ['z'] = 32.545776367188 }, - { ['x'] = -366.90979003906, ['y'] = 115.53963470459, ['z'] = 65.575706481934 }, - { ['x'] = -592.06726074219, ['y'] = 138.20733642578, ['z'] = 60.074813842773 }, - { ['x'] = -1613.8572998047, ['y'] = 18.759860992432, ['z'] = 61.799819946289 }, - { ['x'] = -1709.7995605469, ['y'] = 55.105819702148, ['z'] = 65.706237792969 }, - { ['x'] = -521.88830566406, ['y'] = -266.7805480957, ['z'] = 34.940990447998 }, - { ['x'] = -451.08666992188, ['y'] = -333.52026367188, ['z'] = 34.021533966064 }, - { ['x'] = 322.36480712891, ['y'] = -1900.4990234375, ['z'] = 25.773607254028 }, + { ['x'] = -2480.8720703125, ['y'] = -211.96409606934, ['z'] = 17.397672653198 }, + { ['x'] = -2723.392578125, ['y'] = 13.207388877869, ['z'] = 15.12806892395 }, + { ['x'] = -3169.6235351563, ['y'] = 976.18127441406, ['z'] = 15.038360595703 }, + { ['x'] = -3139.7568359375, ['y'] = 1078.7182617188, ['z'] = 20.189767837524 }, + { ['x'] = -1656.9357910156, ['y'] = -246.16479492188, ['z'] = 54.510955810547 }, + { ['x'] = -1586.6560058594, ['y'] = -647.56115722656, ['z'] = 29.441320419312 }, + { ['x'] = -1036.1470947266, ['y'] = -491.05856323242, ['z'] = 36.214912414551 }, + { ['x'] = -1029.1884765625, ['y'] = -475.53167724609, ['z'] = 36.416831970215 }, + { ['x'] = 75.212287902832, ['y'] = 164.8522644043, ['z'] = 104.69123077393 }, + { ['x'] = -534.60491943359, ['y'] = -756.71801757813, ['z'] = 31.599143981934 }, + { ['x'] = 487.24212646484, ['y'] = -30.827201843262, ['z'] = 88.856712341309 }, + { ['x'] = -772.20111083984, ['y'] = -1281.8114013672, ['z'] = 4.5642876625061 }, + { ['x'] = -663.84173583984, ['y'] = -1206.9936523438, ['z'] = 10.171216011047 }, + { ['x'] = 719.12451171875, ['y'] = -767.77545166016, ['z'] = 24.892364501953 }, + { ['x'] = -970.95465087891, ['y'] = -2410.4453125, ['z'] = 13.344270706177 }, + { ['x'] = -1067.5234375, ['y'] = -2571.4064941406, ['z'] = 13.211874008179 }, + { ['x'] = -619.23968505859, ['y'] = -2207.2927246094, ['z'] = 5.5659561157227 }, + { ['x'] = 1192.0831298828, ['y'] = -1336.9086914063, ['z'] = 35.106426239014 }, + { ['x'] = -432.81033325195, ['y'] = -2166.0505371094, ['z'] = 9.8885231018066 }, + { ['x'] = -451.82403564453, ['y'] = -2269.34765625, ['z'] = 7.1719741821289 }, + { ['x'] = 939.26702880859, ['y'] = -2197.5390625, ['z'] = 30.546691894531 }, + { ['x'] = -556.11486816406, ['y'] = -1794.7312011719, ['z'] = 22.043060302734 }, + { ['x'] = 591.73504638672, ['y'] = -2628.2197265625, ['z'] = 5.5735430717468 }, + { ['x'] = 1654.515625, ['y'] = -2535.8325195313, ['z'] = 74.491394042969 }, + { ['x'] = 1642.6146240234, ['y'] = -2413.3159179688, ['z'] = 93.139915466309 }, + { ['x'] = 1371.3223876953, ['y'] = -2549.525390625, ['z'] = 47.575256347656 }, + { ['x'] = 383.83779907227, ['y'] = -1652.8695068359, ['z'] = 37.278503417969 }, + { ['x'] = 27.219129562378, ['y'] = -1030.8818359375, ['z'] = 29.414621353149 }, + { ['x'] = 229.26435852051, ['y'] = -365.91101074219, ['z'] = 43.750762939453 }, + { ['x'] = -85.809432983398, ['y'] = -51.665500640869, ['z'] = 61.10591506958 }, + { ['x'] = -4.5967531204224, ['y'] = -670.27124023438, ['z'] = 31.85863494873 }, + { ['x'] = -111.89884185791, ['y'] = 91.96940612793, ['z'] = 71.080169677734 }, + { ['x'] = -314.26129150391, ['y'] = -698.23309326172, ['z'] = 32.545776367188 }, + { ['x'] = -366.90979003906, ['y'] = 115.53963470459, ['z'] = 65.575706481934 }, + { ['x'] = -592.06726074219, ['y'] = 138.20733642578, ['z'] = 60.074813842773 }, + { ['x'] = -1613.8572998047, ['y'] = 18.759860992432, ['z'] = 61.799819946289 }, + { ['x'] = -1709.7995605469, ['y'] = 55.105819702148, ['z'] = 65.706237792969 }, + { ['x'] = -521.88830566406, ['y'] = -266.7805480957, ['z'] = 34.940990447998 }, + { ['x'] = -451.08666992188, ['y'] = -333.52026367188, ['z'] = 34.021533966064 }, + { ['x'] = 322.36480712891, ['y'] = -1900.4990234375, ['z'] = 25.773607254028 } } for i=1, #Config.Towables, 1 do - Config.Zones['Towable' .. i] = { - Pos = Config.Towables[i], - Size = { x = 1.5, y = 1.5, z = 1.0 }, - Color = { r = 204, g = 204, b = 0 }, - Type = -1 - } + Config.Zones['Towable' .. i] = { + Pos = Config.Towables[i], + Size = { x = 1.5, y = 1.5, z = 1.0 }, + Color = { r = 204, g = 204, b = 0 }, + Type = -1 + } end - -Config.Vehicles = { - 'adder', - 'asea', - 'asterope', - 'banshee', - 'buffalo' -} diff --git a/server/main.lua b/server/main.lua index 890bdd75..ce4baf68 100644 --- a/server/main.lua +++ b/server/main.lua @@ -9,262 +9,251 @@ PlayersCrafting3 = {} TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) if Config.MaxInService ~= -1 then - TriggerEvent('esx_service:activateService', 'mecano', Config.MaxInService) + TriggerEvent('esx_service:activateService', 'mecano', Config.MaxInService) end TriggerEvent('esx_phone:registerNumber', 'mecano', _U('mechanic_customer'), true, true) TriggerEvent('esx_society:registerSociety', 'mecano', 'Mecano', 'society_mecano', 'society_mecano', 'society_mecano', {type = 'private'}) local function Harvest(source) + SetTimeout(4000, function() - SetTimeout(4000, function() + if PlayersHarvesting[source] == true then + local xPlayer = ESX.GetPlayerFromId(source) + local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count - if PlayersHarvesting[source] == true then + if GazBottleQuantity >= 5 then + TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) + else + xPlayer.addInventoryItem('gazbottle', 1) + Harvest(source) + end + end - local xPlayer = ESX.GetPlayerFromId(source) - local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count - - if GazBottleQuantity >= 5 then - TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) - else - xPlayer.addInventoryItem('gazbottle', 1) - Harvest(source) - end - end - end) + end) end RegisterServerEvent('esx_mecanojob:startHarvest') AddEventHandler('esx_mecanojob:startHarvest', function() - local _source = source - PlayersHarvesting[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('recovery_gas_can')) - Harvest(source) + local _source = source + PlayersHarvesting[_source] = true + TriggerClientEvent('esx:showNotification', _source, _U('recovery_gas_can')) + Harvest(source) end) RegisterServerEvent('esx_mecanojob:stopHarvest') AddEventHandler('esx_mecanojob:stopHarvest', function() - local _source = source - PlayersHarvesting[_source] = false + local _source = source + PlayersHarvesting[_source] = false end) local function Harvest2(source) + SetTimeout(4000, function() - SetTimeout(4000, function() + if PlayersHarvesting2[source] == true then + local xPlayer = ESX.GetPlayerFromId(source) + local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count - if PlayersHarvesting2[source] == true then + if FixToolQuantity >= 5 then + TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) + else + xPlayer.addInventoryItem('fixtool', 1) + Harvest2(source) + end + end - local xPlayer = ESX.GetPlayerFromId(source) - local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count - if FixToolQuantity >= 5 then - TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) - else - xPlayer.addInventoryItem('fixtool', 1) - Harvest2(source) - end - end - end) + end) end RegisterServerEvent('esx_mecanojob:startHarvest2') AddEventHandler('esx_mecanojob:startHarvest2', function() - local _source = source - PlayersHarvesting2[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('recovery_repair_tools')) - Harvest2(_source) + local _source = source + PlayersHarvesting2[_source] = true + TriggerClientEvent('esx:showNotification', _source, _U('recovery_repair_tools')) + Harvest2(_source) end) RegisterServerEvent('esx_mecanojob:stopHarvest2') AddEventHandler('esx_mecanojob:stopHarvest2', function() - local _source = source - PlayersHarvesting2[_source] = false + local _source = source + PlayersHarvesting2[_source] = false end) local function Harvest3(source) + SetTimeout(4000, function() - 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, _U('you_do_not_room')) + else + xPlayer.addInventoryItem('carotool', 1) + Harvest3(source) + end + end - if PlayersHarvesting3[source] == true then - - local xPlayer = ESX.GetPlayerFromId(source) - local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count - if CaroToolQuantity >= 5 then - TriggerClientEvent('esx:showNotification', source, _U('you_do_not_room')) - else - xPlayer.addInventoryItem('carotool', 1) - Harvest3(source) - end - end - end) + end) end RegisterServerEvent('esx_mecanojob:startHarvest3') AddEventHandler('esx_mecanojob:startHarvest3', function() - local _source = source - PlayersHarvesting3[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('recovery_body_tools')) - Harvest3(_source) + local _source = source + PlayersHarvesting3[_source] = true + TriggerClientEvent('esx:showNotification', _source, _U('recovery_body_tools')) + Harvest3(_source) end) RegisterServerEvent('esx_mecanojob:stopHarvest3') AddEventHandler('esx_mecanojob:stopHarvest3', function() - local _source = source - PlayersHarvesting3[_source] = false + local _source = source + PlayersHarvesting3[_source] = false end) local function Craft(source) + SetTimeout(4000, function() - SetTimeout(4000, function() + if PlayersCrafting[source] == true then + local xPlayer = ESX.GetPlayerFromId(source) + local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count - if PlayersCrafting[source] == true then + if GazBottleQuantity <= 0 then + TriggerClientEvent('esx:showNotification', source, _U('not_enough_gas_can')) + else + xPlayer.removeInventoryItem('gazbottle', 1) + xPlayer.addInventoryItem('blowpipe', 1) + Craft(source) + end + end - local xPlayer = ESX.GetPlayerFromId(source) - local GazBottleQuantity = xPlayer.getInventoryItem('gazbottle').count - - if GazBottleQuantity <= 0 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_gas_can')) - else - xPlayer.removeInventoryItem('gazbottle', 1) - xPlayer.addInventoryItem('blowpipe', 1) - Craft(source) - end - end - end) + end) end RegisterServerEvent('esx_mecanojob:startCraft') AddEventHandler('esx_mecanojob:startCraft', function() - local _source = source - PlayersCrafting[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('assembling_blowtorch')) - Craft(_source) + local _source = source + PlayersCrafting[_source] = true + TriggerClientEvent('esx:showNotification', _source, _U('assembling_blowtorch')) + Craft(_source) end) RegisterServerEvent('esx_mecanojob:stopCraft') AddEventHandler('esx_mecanojob:stopCraft', function() - local _source = source - PlayersCrafting[_source] = false + local _source = source + PlayersCrafting[_source] = false end) local function Craft2(source) + SetTimeout(4000, function() - SetTimeout(4000, function() + if PlayersCrafting2[source] == true then + local xPlayer = ESX.GetPlayerFromId(source) + local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count - if PlayersCrafting2[source] == true then + if FixToolQuantity <= 0 then + TriggerClientEvent('esx:showNotification', source, _U('not_enough_repair_tools')) + else + xPlayer.removeInventoryItem('fixtool', 1) + xPlayer.addInventoryItem('fixkit', 1) + Craft2(source) + end + end - local xPlayer = ESX.GetPlayerFromId(source) - local FixToolQuantity = xPlayer.getInventoryItem('fixtool').count - if FixToolQuantity <= 0 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_repair_tools')) - else - xPlayer.removeInventoryItem('fixtool', 1) - xPlayer.addInventoryItem('fixkit', 1) - Craft2(source) - end - end - end) + end) end RegisterServerEvent('esx_mecanojob:startCraft2') AddEventHandler('esx_mecanojob:startCraft2', function() - local _source = source - PlayersCrafting2[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('assembling_repair_kit')) - Craft2(_source) + local _source = source + PlayersCrafting2[_source] = true + TriggerClientEvent('esx:showNotification', _source, _U('assembling_repair_kit')) + Craft2(_source) end) RegisterServerEvent('esx_mecanojob:stopCraft2') AddEventHandler('esx_mecanojob:stopCraft2', function() - local _source = source - PlayersCrafting2[_source] = false + local _source = source + PlayersCrafting2[_source] = false end) local function Craft3(source) + SetTimeout(4000, function() - SetTimeout(4000, function() + if PlayersCrafting3[source] == true then + local xPlayer = ESX.GetPlayerFromId(source) + local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count - if PlayersCrafting3[source] == true then + if CaroToolQuantity <= 0 then + TriggerClientEvent('esx:showNotification', source, _U('not_enough_body_tools')) + else + xPlayer.removeInventoryItem('carotool', 1) + xPlayer.addInventoryItem('carokit', 1) + Craft3(source) + end + end - local xPlayer = ESX.GetPlayerFromId(source) - local CaroToolQuantity = xPlayer.getInventoryItem('carotool').count - if CaroToolQuantity <= 0 then - TriggerClientEvent('esx:showNotification', source, _U('not_enough_body_tools')) - else - xPlayer.removeInventoryItem('carotool', 1) - xPlayer.addInventoryItem('carokit', 1) - Craft3(source) - end - end - end) + end) end RegisterServerEvent('esx_mecanojob:startCraft3') AddEventHandler('esx_mecanojob:startCraft3', function() - local _source = source - PlayersCrafting3[_source] = true - TriggerClientEvent('esx:showNotification', _source, _U('assembling_body_kit')) - Craft3(_source) + local _source = source + PlayersCrafting3[_source] = true + TriggerClientEvent('esx:showNotification', _source, _U('assembling_body_kit')) + Craft3(_source) end) RegisterServerEvent('esx_mecanojob:stopCraft3') AddEventHandler('esx_mecanojob:stopCraft3', function() - local _source = source - PlayersCrafting3[_source] = false + local _source = source + PlayersCrafting3[_source] = false end) RegisterServerEvent('esx_mecanojob:onNPCJobMissionCompleted') AddEventHandler('esx_mecanojob:onNPCJobMissionCompleted', function() + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) + local total = math.random(Config.NPCJobEarnings.min, Config.NPCJobEarnings.max); - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - local total = math.random(Config.NPCJobEarnings.min, Config.NPCJobEarnings.max); + if xPlayer.job.grade >= 3 then + total = total * 2 + end - if xPlayer.job.grade >= 3 then - total = total * 2 - end - - TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mecano', function(account) - account.addMoney(total) - end) - - TriggerClientEvent("esx:showNotification", _source, _U('your_comp_earned').. total) + TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mecano', function(account) + account.addMoney(total) + end) + TriggerClientEvent("esx:showNotification", _source, _U('your_comp_earned').. total) end) ESX.RegisterUsableItem('blowpipe', function(source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.removeInventoryItem('blowpipe', 1) - - TriggerClientEvent('esx_mecanojob:onHijack', _source) - TriggerClientEvent('esx:showNotification', _source, _U('you_used_blowtorch')) + xPlayer.removeInventoryItem('blowpipe', 1) + TriggerClientEvent('esx_mecanojob:onHijack', _source) + TriggerClientEvent('esx:showNotification', _source, _U('you_used_blowtorch')) end) ESX.RegisterUsableItem('fixkit', function(source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.removeInventoryItem('fixkit', 1) - - TriggerClientEvent('esx_mecanojob:onFixkit', _source) - TriggerClientEvent('esx:showNotification', _source, _U('you_used_repair_kit')) + xPlayer.removeInventoryItem('fixkit', 1) + TriggerClientEvent('esx_mecanojob:onFixkit', _source) + TriggerClientEvent('esx:showNotification', _source, _U('you_used_repair_kit')) end) ESX.RegisterUsableItem('carokit', function(source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) - local _source = source - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.removeInventoryItem('carokit', 1) - - TriggerClientEvent('esx_mecanojob:onCarokit', _source) - TriggerClientEvent('esx:showNotification', _source, _U('you_used_body_kit')) + xPlayer.removeInventoryItem('carokit', 1) + TriggerClientEvent('esx_mecanojob:onCarokit', _source) + TriggerClientEvent('esx:showNotification', _source, _U('you_used_body_kit')) end) RegisterServerEvent('esx_mecanojob:getStockItem') @@ -274,10 +263,10 @@ AddEventHandler('esx_mecanojob:getStockItem', function(itemName, count) TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) local item = inventory.getItem(itemName) local sourceItem = xPlayer.getInventoryItem(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 sourceItem.limit ~= -1 and (sourceItem.count + count) > sourceItem.limit then TriggerClientEvent('esx:showNotification', xPlayer.source, _U('player_cannot_hold')) @@ -293,43 +282,33 @@ AddEventHandler('esx_mecanojob:getStockItem', function(itemName, count) end) ESX.RegisterServerCallback('esx_mecanojob:getStockItems', function(source, cb) - - TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) - cb(inventory.items) - end) - + TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) + cb(inventory.items) + end) end) RegisterServerEvent('esx_mecanojob:putStockItems') AddEventHandler('esx_mecanojob:putStockItems', function(itemName, count) + local xPlayer = ESX.GetPlayerFromId(source) - local xPlayer = ESX.GetPlayerFromId(source) + TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) + local item = inventory.getItem(itemName) + local playerItemCount = xPlayer.getInventoryItem(itemName).count - TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory) - - local item = inventory.getItem(itemName) - local playerItemCount = xPlayer.getInventoryItem(itemName).count - - if item.count >= 0 and count <= playerItemCount then - xPlayer.removeInventoryItem(itemName, count) - inventory.addItem(itemName, count) - else - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity')) - end - - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_deposited', count, item.label)) - - end) + if item.count >= 0 and count <= playerItemCount then + xPlayer.removeInventoryItem(itemName, count) + inventory.addItem(itemName, count) + else + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity')) + end + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_deposited', count, item.label)) + end) end) ESX.RegisterServerCallback('esx_mecanojob:getPlayerInventory', function(source, cb) + local xPlayer = ESX.GetPlayerFromId(source) + local items = xPlayer.inventory - local xPlayer = ESX.GetPlayerFromId(source) - local items = xPlayer.inventory - - cb({ - items = items - }) - + cb({items = items}) end) From c760b6734973efcd46ce96d894b39d9926f7ffc9 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 25 Nov 2018 18:42:49 +0100 Subject: [PATCH 47/66] Removed useless checks --- client/main.lua | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/client/main.lua b/client/main.lua index b3e58a14..2a5b1952 100644 --- a/client/main.lua +++ b/client/main.lua @@ -433,29 +433,25 @@ function OpenMobileMecanoActionsMenu() elseif data.current.value == 'del_vehicle' then - local ped = PlayerPedId() + local playerPed = PlayerPedId() - if DoesEntityExist(ped) and not IsEntityDead(ped) then - local pos = GetEntityCoords( ped ) + if IsPedSittingInAnyVehicle(playerPed) then + local vehicle = GetVehiclePedIsIn(playerPed, false) - if IsPedSittingInAnyVehicle(ped) then - local vehicle = GetVehiclePedIsIn( ped, false ) - - if GetPedInVehicleSeat(vehicle, -1) == ped then - ESX.ShowNotification(_U('vehicle_impounded')) - ESX.Game.DeleteVehicle(vehicle) - else - ESX.ShowNotification(_U('must_seat_driver')) - end + if GetPedInVehicleSeat(vehicle, -1) == playerPed then + ESX.ShowNotification(_U('vehicle_impounded')) + ESX.Game.DeleteVehicle(vehicle) else - local vehicle = ESX.Game.GetVehicleInDirection() + ESX.ShowNotification(_U('must_seat_driver')) + end + else + local vehicle = ESX.Game.GetVehicleInDirection() - if DoesEntityExist(vehicle) then - ESX.ShowNotification(_U('vehicle_impounded')) - ESX.Game.DeleteVehicle(vehicle) - else - ESX.ShowNotification(_U('must_near')) - end + if DoesEntityExist(vehicle) then + ESX.ShowNotification(_U('vehicle_impounded')) + ESX.Game.DeleteVehicle(vehicle) + else + ESX.ShowNotification(_U('must_near')) end end From e30207e4677a4247b8170d73c0a06f2ee5972e4d Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Thu, 29 Nov 2018 15:18:31 +0100 Subject: [PATCH 48/66] Fixed mistake, resolves #35, closes #36 --- client/main.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/client/main.lua b/client/main.lua index 2a5b1952..91dc3fc2 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1018,27 +1018,27 @@ Citizen.CreateThread(function() local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) TriggerServerEvent('esx_society:putVehicleInGarage', 'mecano', vehicleProps) - else - - if - GetEntityModel(vehicle) == GetHashKey('flatbed') or - GetEntityModel(vehicle) == GetHashKey('towtruck2') or - GetEntityModel(vehicle) == GetHashKey('slamvan3') - then - TriggerServerEvent('esx_service:disableService', 'mecano') - end + else + if + GetEntityModel(vehicle) == GetHashKey('flatbed') or + GetEntityModel(vehicle) == GetHashKey('towtruck2') or + GetEntityModel(vehicle) == GetHashKey('slamvan3') + then + TriggerServerEvent('esx_service:disableService', 'mecano') end - ESX.Game.DeleteVehicle(CurrentActionData.vehicle) end + ESX.Game.DeleteVehicle(CurrentActionData.vehicle) + elseif CurrentAction == 'remove_entity' then DeleteEntity(CurrentActionData.entity) end CurrentAction = nil end + end if IsControlJustReleased(0, Keys['F6']) and not IsDead and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then OpenMobileMecanoActionsMenu() From bdc9e88535fcc46c7e9de8eb68bffce532fca986 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 30 Dec 2018 21:32:06 +0100 Subject: [PATCH 49/66] Check IsControlJustReleased() every frame --- client/main.lua | 4 ++-- locales/br.lua | 2 +- locales/en.lua | 2 +- locales/fi.lua | 2 +- locales/fr.lua | 2 +- locales/pl.lua | 2 +- locales/sv.lua | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/main.lua b/client/main.lua index 91dc3fc2..0165fa6d 100644 --- a/client/main.lua +++ b/client/main.lua @@ -998,7 +998,7 @@ end) -- Key Controls Citizen.CreateThread(function() while true do - Citizen.Wait(10) + Citizen.Wait(0) if CurrentAction ~= nil then ESX.ShowHelpNotification(CurrentActionMsg) @@ -1072,7 +1072,7 @@ Citizen.CreateThread(function() end end) -AddEventHandler('esx:onPlayerDeath', function() +AddEventHandler('esx:onPlayerDeath', function(data) IsDead = true end) diff --git a/locales/br.lua b/locales/br.lua index 037aac1e..426ae171 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -81,5 +81,5 @@ Locales['br'] = { ['you_used_body_kit'] = 'Você usou um ~b~Kit de corpo', ['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!', + ['player_cannot_hold'] = 'you do ~r~not~s~ have enough ~y~free space~s~ in your inventory!', } diff --git a/locales/en.lua b/locales/en.lua index 67cd091d..45a04246 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -81,5 +81,5 @@ Locales['en'] = { ['you_used_body_kit'] = 'you used a ~b~Body Kit', ['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!', + ['player_cannot_hold'] = 'you do ~r~not~s~ have enough ~y~free space~s~ in your inventory!', } diff --git a/locales/fi.lua b/locales/fi.lua index 390c60d2..eea8bb02 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -81,5 +81,5 @@ Locales['fi'] = { ['you_used_body_kit'] = 'sinä käytit yhden ~b~Korikitin', ['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!', + ['player_cannot_hold'] = 'sinulla ~r~ei ole~s~ tarpeeksi ~y~vapaata tilaa~s~ repussasi!', } diff --git a/locales/fr.lua b/locales/fr.lua index 61ef8e02..c4dcbf34 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -82,5 +82,5 @@ Locales['fr'] = { ['you_used_body_kit'] = 'Vous avez utilisé un ~b~Kit de carosserie', ['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!', + ['player_cannot_hold'] = 'you do ~r~not~s~ have enough ~y~free space~s~ in your inventory!', } diff --git a/locales/pl.lua b/locales/pl.lua index 2454b9cc..689d8057 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -81,5 +81,5 @@ Locales['pl'] = { ['you_used_body_kit'] = 'użyłeś ~b~częsci blacharskich', ['have_withdrawn'] = 'wyciągnąłeś ~y~x%s~s~ ~b~%s~s~', ['have_deposited'] = 'zdeponowałeś ~y~x%s~s~ ~b~%s~s~', - ['player_cannot_hold'] = '~r~nie masz~w~ wystarczająco ~y~wolnego~w~ miejsca w ekwipunku!', + ['player_cannot_hold'] = '~r~nie masz~s~ wystarczająco ~y~wolnego~s~ miejsca w ekwipunku!', } diff --git a/locales/sv.lua b/locales/sv.lua index 8dc6132e..04403c98 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -81,5 +81,5 @@ Locales['sv'] = { ['you_used_body_kit'] = 'du har använt en ~b~karossverktyg~s~', ['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!', + ['player_cannot_hold'] = 'du har ~r~inte~s~ tillräckligt med ~y~utrymme~s~ för att hålla det!', } \ No newline at end of file From 4c614059e99dd40e3f3abc599b0126eabf641752 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 18 Jan 2019 11:06:14 +0100 Subject: [PATCH 50/66] Rename job to mechanicjob, closes #14 --- LICENSE | 2 +- README.md | 16 +- __resource.lua | 2 +- client/main.lua | 300 +++++++++++------------ config.lua | 8 +- esx_mecanojob.sql => esx_mechanicjob.sql | 16 +- localization/en_esx_mecanojob.sql | 16 +- localization/fi_esx_mecanojob.sql | 16 +- localization/pl_esx_mecanojob.sql | 16 +- localization/sv_esx_mecanojob.sql | 16 +- server/main.lua | 84 +++---- 11 files changed, 240 insertions(+), 252 deletions(-) rename esx_mecanojob.sql => esx_mechanicjob.sql (61%) diff --git a/LICENSE b/LICENSE index 8f58e359..0dcf1e8c 100644 --- a/LICENSE +++ b/LICENSE @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - fxserver-esx_mecanojob Copyright (C) 2015 Jérémie N'gadi + esx_mechanicjob Copyright (C) 2015-2019 Jérémie N'gadi This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/README.md b/README.md index ca7a1d38..0a90b8a0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# esx_mecanojob +# esx_mechanicjob ## Requirements @@ -13,33 +13,33 @@ ### Using [fvm](https://github.com/qlaffont/fvm-installer) ``` -fvm install --save --folder=esx esx-org/esx_mecanojob +fvm install --save --folder=esx esx-org/esx_mechanicjob ``` ### Using Git ``` cd resources -git clone https://github.com/ESX-Org/esx_mecanojob [esx]/esx_mecanojob +git clone https://github.com/ESX-Org/esx_mechanicjob [esx]/esx_mechanicjob ``` ### Manually -- Download https://github.com/ESX-Org/esx_mecanojob/archive/master.zip +- Download https://github.com/ESX-Org/esx_mechanicjob/archive/master.zip - Put it in the `[esx]` directory ## Installation -- Import `esx_mecanojob.sql` in your database +- Import `esx_mechanicjob.sql` in your database - If you want player management you have to set `Config.EnablePlayerManagement` to `true` in `config.lua` - Add this to your `server.cfg`: ``` -start esx_mecanojob +start esx_mechanicjob ``` # Legal ### License -esx_mecanojob - mechanic job for ESX +esx_mechanicjob - mechanic job for ESX -Copyright (C) 2015-2018 Jérémie N'gadi +Copyright (C) 2015-2019 Jérémie N'gadi This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version. diff --git a/__resource.lua b/__resource.lua index 4e772a80..0739b5a9 100644 --- a/__resource.lua +++ b/__resource.lua @@ -1,6 +1,6 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' -description 'ESX Mecano Job' +description 'ESX Mechanic Job' version '1.1.0' diff --git a/client/main.lua b/client/main.lua index 0165fa6d..46092090 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,34 +1,22 @@ local Keys = { - ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, - ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, - ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18, - ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182, - ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81, - ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, - ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178, - ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173, - ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 + ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, + ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, + ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18, + ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182, + ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81, + ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, + ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178, + ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173, + ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 } -local PlayerData = {} -local HasAlreadyEnteredMarker = false -local LastZone = nil -local CurrentAction = nil -local CurrentActionMsg = '' -local CurrentActionData = {} -local CurrentlyTowedVehicle = nil -local Blips = {} -local NPCOnJob = false -local NPCTargetTowable = nil -local NPCTargetTowableZone = nil -local NPCHasSpawnedTowable = false -local NPCLastCancel = GetGameTimer() - 5 * 60000 -local NPCHasBeenNextToTowable = false -local NPCTargetDeleterZone = false -local IsDead = false -local IsBusy = false +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 -ESX = nil +ESX = nil Citizen.CreateThread(function() while ESX == nil do @@ -36,8 +24,11 @@ Citizen.CreateThread(function() Citizen.Wait(0) end - Citizen.Wait(5000) - PlayerData = ESX.GetPlayerData() + while ESX.GetPlayerData().job == nil do + Citizen.Wait(10) + end + + ESX.PlayerData = ESX.GetPlayerData() end) function SelectRandomTowable() @@ -63,12 +54,12 @@ function StartNPCJob() end function StopNPCJob(cancel) - if Blips['NPCTargetTowableZone'] ~= nil then + if Blips['NPCTargetTowableZone'] then RemoveBlip(Blips['NPCTargetTowableZone']) Blips['NPCTargetTowableZone'] = nil end - if Blips['NPCDelivery'] ~= nil then + if Blips['NPCDelivery'] then RemoveBlip(Blips['NPCDelivery']) Blips['NPCDelivery'] = nil end @@ -84,11 +75,11 @@ function StopNPCJob(cancel) if cancel then ESX.ShowNotification(_U('mission_canceled')) else - --TriggerServerEvent('esx_mecanojob:onNPCJobCompleted') + --TriggerServerEvent('esx_mechanic:onNPCJobCompleted') end end -function OpenMecanoActionsMenu() +function OpenMechanicActionsMenu() local elements = { {label = _U('vehicle_list'), value = 'vehicle_list'}, @@ -98,13 +89,13 @@ function OpenMecanoActionsMenu() {label = _U('withdraw_stock'), value = 'get_stock'} } - if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name == 'boss' then + if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name == 'boss' then table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'}) end ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mecano_actions', { + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mechanic_actions', { title = _U('mechanic'), align = 'top-left', elements = elements @@ -137,11 +128,11 @@ function OpenMecanoActionsMenu() TaskWarpPedIntoVehicle(playerPed, vehicle, -1) end) - TriggerServerEvent('esx_society:removeVehicleFromGarage', 'mecano', vehicleProps) + TriggerServerEvent('esx_society:removeVehicleFromGarage', 'mechanic', vehicleProps) end, function(data, menu) menu.close() end) - end, 'mecano') + end, 'mechanic') else @@ -150,7 +141,7 @@ function OpenMecanoActionsMenu() {label = _U('tow_truck'), value = 'towtruck2'} } - if Config.EnablePlayerManagement and PlayerData.job ~= nil and (PlayerData.job.grade_name == 'boss' or PlayerData.job.grade_name == 'chef' or PlayerData.job.grade_name == 'experimente') then + if Config.EnablePlayerManagement and ESX.PlayerData.job and (ESX.PlayerData.job.grade_name == 'boss' or ESX.PlayerData.job.grade_name == 'chef' or ESX.PlayerData.job.grade_name == 'experimente') then table.insert(elements, {label = 'SlamVan', value = 'slamvan3'}) end @@ -176,13 +167,13 @@ function OpenMecanoActionsMenu() else ESX.ShowNotification(_U('service_full') .. inServiceCount .. '/' .. maxInService) end - end, 'mecano') + end, 'mechanic') end menu.close() end, function(data, menu) menu.close() - OpenMecanoActionsMenu() + OpenMechanicActionsMenu() end) end @@ -210,7 +201,7 @@ function OpenMecanoActionsMenu() elseif data.current.value == 'get_stock' then OpenGetStocksMenu() elseif data.current.value == 'boss_actions' then - TriggerEvent('esx_society:openBossMenu', 'mecano', function(data, menu) + TriggerEvent('esx_society:openBossMenu', 'mechanic', function(data, menu) menu.close() end) end @@ -218,15 +209,15 @@ function OpenMecanoActionsMenu() end, function(data, menu) menu.close() - CurrentAction = 'mecano_actions_menu' + CurrentAction = 'mechanic_actions_menu' CurrentActionMsg = _U('open_actions') CurrentActionData = {} end) end -function OpenMecanoHarvestMenu() +function OpenMechanicHarvestMenu() - if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then + if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name ~= 'recrue' then local elements = { {label = _U('gas_can'), value = 'gaz_bottle'}, @@ -236,26 +227,23 @@ function OpenMecanoHarvestMenu() ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mecano_harvest', { + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mechanic_harvest', { title = _U('harvest'), align = 'top-left', elements = elements }, function(data, menu) + menu.close() if data.current.value == 'gaz_bottle' then - menu.close() - TriggerServerEvent('esx_mecanojob:startHarvest') + TriggerServerEvent('esx_mechanic:startHarvest') elseif data.current.value == 'fix_tool' then - menu.close() - TriggerServerEvent('esx_mecanojob:startHarvest2') + TriggerServerEvent('esx_mechanic:startHarvest2') elseif data.current.value == 'caro_tool' then - menu.close() - TriggerServerEvent('esx_mecanojob:startHarvest3') + TriggerServerEvent('esx_mechanic:startHarvest3') end - end, function(data, menu) menu.close() - CurrentAction = 'mecano_harvest_menu' + CurrentAction = 'mechanic_harvest_menu' CurrentActionMsg = _U('harvest_menu') CurrentActionData = {} end) @@ -265,8 +253,8 @@ function OpenMecanoHarvestMenu() end end -function OpenMecanoCraftMenu() - if Config.EnablePlayerManagement and PlayerData.job ~= nil and PlayerData.job.grade_name ~= 'recrue' then +function OpenMechanicCraftMenu() + if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name ~= 'recrue' then local elements = { {label = _U('blowtorch'), value = 'blow_pipe'}, @@ -276,26 +264,24 @@ function OpenMecanoCraftMenu() ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mecano_craft', { + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mechanic_craft', { title = _U('craft'), align = 'top-left', elements = elements }, function(data, menu) - if data.current.value == 'blow_pipe' then - menu.close() - TriggerServerEvent('esx_mecanojob:startCraft') - elseif data.current.value == 'fix_kit' then - menu.close() - TriggerServerEvent('esx_mecanojob:startCraft2') - elseif data.current.value == 'caro_kit' then - menu.close() - TriggerServerEvent('esx_mecanojob:startCraft3') - end + menu.close() + if data.current.value == 'blow_pipe' then + TriggerServerEvent('esx_mechanic:startCraft') + elseif data.current.value == 'fix_kit' then + TriggerServerEvent('esx_mechanic:startCraft2') + elseif data.current.value == 'caro_kit' then + TriggerServerEvent('esx_mechanic:startCraft3') + end end, function(data, menu) menu.close() - CurrentAction = 'mecano_craft_menu' + CurrentAction = 'mechanic_craft_menu' CurrentActionMsg = _U('craft_menu') CurrentActionData = {} end) @@ -305,11 +291,11 @@ function OpenMecanoCraftMenu() end end -function OpenMobileMecanoActionsMenu() +function OpenMobileMechanicActionsMenu() ESX.UI.Menu.CloseAll() - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_mecano_actions', { + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_mechanic_actions', { title = _U('mechanic'), align = 'top-left', elements = { @@ -322,7 +308,7 @@ function OpenMobileMecanoActionsMenu() {label = _U('place_objects'), value = 'object_spawner'} } }, function(data, menu) - if IsBusy then return end + if isBusy then return end if data.current.value == 'billing' then @@ -339,7 +325,7 @@ function OpenMobileMecanoActionsMenu() ESX.ShowNotification(_U('no_players_nearby')) else menu.close() - TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mecano', _U('mechanic'), amount) + TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mechanic', _U('mechanic'), amount) end end end, function(data, menu) @@ -358,8 +344,8 @@ function OpenMobileMecanoActionsMenu() end if DoesEntityExist(vehicle) then - IsBusy = true - TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_WELDING", 0, true) + isBusy = true + TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_WELDING', 0, true) Citizen.CreateThread(function() Citizen.Wait(10000) @@ -368,7 +354,7 @@ function OpenMobileMecanoActionsMenu() ClearPedTasksImmediately(playerPed) ESX.ShowNotification(_U('vehicle_unlocked')) - IsBusy = false + isBusy = false end) else ESX.ShowNotification(_U('no_vehicle_nearby')) @@ -386,8 +372,8 @@ function OpenMobileMecanoActionsMenu() end if DoesEntityExist(vehicle) then - IsBusy = true - TaskStartScenarioInPlace(playerPed, "PROP_HUMAN_BUM_BIN", 0, true) + isBusy = true + TaskStartScenarioInPlace(playerPed, 'PROP_HUMAN_BUM_BIN', 0, true) Citizen.CreateThread(function() Citizen.Wait(20000) @@ -398,7 +384,7 @@ function OpenMobileMecanoActionsMenu() ClearPedTasksImmediately(playerPed) ESX.ShowNotification(_U('vehicle_repaired')) - IsBusy = false + isBusy = false end) else ESX.ShowNotification(_U('no_vehicle_nearby')) @@ -416,8 +402,8 @@ function OpenMobileMecanoActionsMenu() end if DoesEntityExist(vehicle) then - IsBusy = true - TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_MAID_CLEAN", 0, true) + isBusy = true + TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_MAID_CLEAN', 0, true) Citizen.CreateThread(function() Citizen.Wait(10000) @@ -425,7 +411,7 @@ function OpenMobileMecanoActionsMenu() ClearPedTasksImmediately(playerPed) ESX.ShowNotification(_U('vehicle_cleaned')) - IsBusy = false + isBusy = false end) else ESX.ShowNotification(_U('no_vehicle_nearby')) @@ -479,7 +465,7 @@ function OpenMobileMecanoActionsMenu() ESX.ShowNotification(_U('please_drop_off')) Config.Zones.VehicleDelivery.Type = 1 - if Blips['NPCTargetTowableZone'] ~= nil then + if Blips['NPCTargetTowableZone'] then RemoveBlip(Blips['NPCTargetTowableZone']) Blips['NPCTargetTowableZone'] = nil end @@ -505,7 +491,7 @@ function OpenMobileMecanoActionsMenu() if CurrentlyTowedVehicle == NPCTargetTowable then ESX.Game.DeleteVehicle(NPCTargetTowable) - TriggerServerEvent('esx_mecanojob:onNPCJobMissionCompleted') + TriggerServerEvent('esx_mechanic:onNPCJobMissionCompleted') StopNPCJob() NPCTargetDeleterZone = false else @@ -534,7 +520,7 @@ function OpenMobileMecanoActionsMenu() return end - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_mecano_actions_spawn', { + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_mechanic_actions_spawn', { title = _U('objects'), align = 'top-left', elements = { @@ -574,7 +560,7 @@ function OpenMobileMecanoActionsMenu() end function OpenGetStocksMenu() - ESX.TriggerServerCallback('esx_mecanojob:getStockItems', function(items) + ESX.TriggerServerCallback('esx_mechanic:getStockItems', function(items) local elements = {} @@ -604,7 +590,7 @@ function OpenGetStocksMenu() else menu2.close() menu.close() - TriggerServerEvent('esx_mecanojob:getStockItem', itemName, count) + TriggerServerEvent('esx_mechanic:getStockItem', itemName, count) Citizen.Wait(1000) OpenGetStocksMenu() @@ -623,7 +609,7 @@ end function OpenPutStocksMenu() - ESX.TriggerServerCallback('esx_mecanojob:getPlayerInventory', function(inventory) + ESX.TriggerServerCallback('esx_mechanic:getPlayerInventory', function(inventory) local elements = {} for i=1, #inventory.items, 1 do @@ -656,7 +642,7 @@ function OpenPutStocksMenu() else menu2.close() menu.close() - TriggerServerEvent('esx_mecanojob:putStockItems', itemName, count) + TriggerServerEvent('esx_mechanic:putStockItems', itemName, count) Citizen.Wait(1000) OpenPutStocksMenu() @@ -673,8 +659,8 @@ function OpenPutStocksMenu() end -RegisterNetEvent('esx_mecanojob:onHijack') -AddEventHandler('esx_mecanojob:onHijack', function() +RegisterNetEvent('esx_mechanic:onHijack') +AddEventHandler('esx_mechanic:onHijack', function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) @@ -696,7 +682,7 @@ AddEventHandler('esx_mecanojob:onHijack', function() StartVehicleAlarm(vehicle) end - TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_WELDING", 0, true) + TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_WELDING', 0, true) Citizen.CreateThread(function() Citizen.Wait(10000) @@ -715,8 +701,8 @@ AddEventHandler('esx_mecanojob:onHijack', function() end end) -RegisterNetEvent('esx_mecanojob:onCarokit') -AddEventHandler('esx_mecanojob:onCarokit', function() +RegisterNetEvent('esx_mechanic:onCarokit') +AddEventHandler('esx_mechanic:onCarokit', function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) @@ -730,7 +716,7 @@ AddEventHandler('esx_mecanojob:onCarokit', function() end if DoesEntityExist(vehicle) then - TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_HAMMERING", 0, true) + TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_HAMMERING', 0, true) Citizen.CreateThread(function() Citizen.Wait(10000) SetVehicleFixed(vehicle) @@ -742,8 +728,8 @@ AddEventHandler('esx_mecanojob:onCarokit', function() end end) -RegisterNetEvent('esx_mecanojob:onFixkit') -AddEventHandler('esx_mecanojob:onFixkit', function() +RegisterNetEvent('esx_mechanic:onFixkit') +AddEventHandler('esx_mechanic:onFixkit', function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) @@ -757,7 +743,7 @@ AddEventHandler('esx_mecanojob:onFixkit', function() end if DoesEntityExist(vehicle) then - TaskStartScenarioInPlace(playerPed, "PROP_HUMAN_BUM_BIN", 0, true) + TaskStartScenarioInPlace(playerPed, 'PROP_HUMAN_BUM_BIN', 0, true) Citizen.CreateThread(function() Citizen.Wait(20000) SetVehicleFixed(vehicle) @@ -772,29 +758,29 @@ end) RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer) - PlayerData = xPlayer + ESX.PlayerData = xPlayer end) RegisterNetEvent('esx:setJob') AddEventHandler('esx:setJob', function(job) - PlayerData.job = job + ESX.PlayerData.job = job end) -AddEventHandler('esx_mecanojob:hasEnteredMarker', function(zone) +AddEventHandler('esx_mechanic:hasEnteredMarker', function(zone) if zone == NPCJobTargetTowable then elseif zone =='VehicleDelivery' then NPCTargetDeleterZone = true - elseif zone == 'MecanoActions' then - CurrentAction = 'mecano_actions_menu' + elseif zone == 'MechanicActions' then + CurrentAction = 'mechanic_actions_menu' CurrentActionMsg = _U('open_actions') CurrentActionData = {} elseif zone == 'Garage' then - CurrentAction = 'mecano_harvest_menu' + CurrentAction = 'mechanic_harvest_menu' CurrentActionMsg = _U('harvest_menu') CurrentActionData = {} elseif zone == 'Craft' then - CurrentAction = 'mecano_craft_menu' + CurrentAction = 'mechanic_craft_menu' CurrentActionMsg = _U('craft_menu') CurrentActionData = {} elseif zone == 'VehicleDeleter' then @@ -810,34 +796,34 @@ AddEventHandler('esx_mecanojob:hasEnteredMarker', function(zone) end end) -AddEventHandler('esx_mecanojob:hasExitedMarker', function(zone) +AddEventHandler('esx_mechanic:hasExitedMarker', function(zone) if zone =='VehicleDelivery' then NPCTargetDeleterZone = false elseif zone == 'Craft' then - TriggerServerEvent('esx_mecanojob:stopCraft') - TriggerServerEvent('esx_mecanojob:stopCraft2') - TriggerServerEvent('esx_mecanojob:stopCraft3') + TriggerServerEvent('esx_mechanic:stopCraft') + TriggerServerEvent('esx_mechanic:stopCraft2') + TriggerServerEvent('esx_mechanic:stopCraft3') elseif zone == 'Garage' then - TriggerServerEvent('esx_mecanojob:stopHarvest') - TriggerServerEvent('esx_mecanojob:stopHarvest2') - TriggerServerEvent('esx_mecanojob:stopHarvest3') + TriggerServerEvent('esx_mechanic:stopHarvest') + TriggerServerEvent('esx_mechanic:stopHarvest2') + TriggerServerEvent('esx_mechanic:stopHarvest3') end CurrentAction = nil ESX.UI.Menu.CloseAll() end) -AddEventHandler('esx_mecanojob:hasEnteredEntityZone', function(entity) +AddEventHandler('esx_mechanic:hasEnteredEntityZone', function(entity) local playerPed = PlayerPedId() - if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' and not IsPedInAnyVehicle(playerPed, false) then + if ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' and not IsPedInAnyVehicle(playerPed, false) then CurrentAction = 'remove_entity' CurrentActionMsg = _U('press_remove_obj') CurrentActionData = {entity = entity} end end) -AddEventHandler('esx_mecanojob:hasExitedEntityZone', function(entity) +AddEventHandler('esx_mechanic:hasExitedEntityZone', function(entity) if CurrentAction == 'remove_entity' then CurrentAction = nil end @@ -847,7 +833,7 @@ RegisterNetEvent('esx_phone:loaded') AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) local specialContact = { name = _U('mechanic'), - number = 'mecano', + 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' } @@ -857,10 +843,9 @@ end) -- Pop NPC mission vehicle when inside area Citizen.CreateThread(function() while true do - Citizen.Wait(10) - if NPCTargetTowableZone ~= nil and not NPCHasSpawnedTowable then + if NPCTargetTowableZone and not NPCHasSpawnedTowable then local coords = GetEntityCoords(PlayerPedId()) local zone = Config.Zones[NPCTargetTowableZone] @@ -875,7 +860,7 @@ Citizen.CreateThread(function() end end - if NPCTargetTowableZone ~= nil and NPCHasSpawnedTowable and not NPCHasBeenNextToTowable then + if NPCTargetTowableZone and NPCHasSpawnedTowable and not NPCHasBeenNextToTowable then local coords = GetEntityCoords(PlayerPedId()) local zone = Config.Zones[NPCTargetTowableZone] @@ -884,13 +869,12 @@ Citizen.CreateThread(function() NPCHasBeenNextToTowable = true end end - end end) -- Create Blips Citizen.CreateThread(function() - local blip = AddBlipForCoord(Config.Zones.MecanoActions.Pos.x, Config.Zones.MecanoActions.Pos.y, Config.Zones.MecanoActions.Pos.z) + local blip = AddBlipForCoord(Config.Zones.MechanicActions.Pos.x, Config.Zones.MechanicActions.Pos.y, Config.Zones.MechanicActions.Pos.z) SetBlipSprite (blip, 446) SetBlipDisplay(blip, 4) @@ -898,8 +882,8 @@ Citizen.CreateThread(function() SetBlipColour (blip, 5) SetBlipAsShortRange(blip, true) - BeginTextCommandSetBlipName("STRING") - AddTextComponentString(_U('mechanic')) + BeginTextCommandSetBlipName('STRING') + AddTextComponentSubstringPlayerName(_U('mechanic')) EndTextCommandSetBlipName(blip) end) @@ -907,14 +891,22 @@ end) Citizen.CreateThread(function() while true do Citizen.Wait(0) - if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - local coords = GetEntityCoords(PlayerPedId()) + + if ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then + local coords, letSleep = GetEntityCoords(PlayerPedId()), true for k,v in pairs(Config.Zones) do - if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 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, false, true, 2, false, false, false, false) + if v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance then + 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, false, true, 2, false, nil, nil, false) + letSleep = false end end + + if letSleep then + Citizen.Wait(500) + end + else + Citizen.Wait(500) end end end) @@ -924,7 +916,7 @@ Citizen.CreateThread(function() while true do Citizen.Wait(10) - if PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + if ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then local coords = GetEntityCoords(PlayerPedId()) local isInMarker = false @@ -932,20 +924,20 @@ Citizen.CreateThread(function() for k,v in pairs(Config.Zones) do if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then - isInMarker = true - currentZone = k + isInMarker = true + currentZone = k end end if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then HasAlreadyEnteredMarker = true LastZone = currentZone - TriggerEvent('esx_mecanojob:hasEnteredMarker', currentZone) + TriggerEvent('esx_mechanic:hasEnteredMarker', currentZone) end if not isInMarker and HasAlreadyEnteredMarker then HasAlreadyEnteredMarker = false - TriggerEvent('esx_mecanojob:hasExitedMarker', LastZone) + TriggerEvent('esx_mechanic:hasExitedMarker', LastZone) end end @@ -968,11 +960,11 @@ Citizen.CreateThread(function() local closestEntity = nil for i=1, #trackedEntities, 1 do - local object = GetClosestObjectOfType(coords.x, coords.y, coords.z, 3.0, GetHashKey(trackedEntities[i]), false, false, false) + local object = GetClosestObjectOfType(coords, 3.0, GetHashKey(trackedEntities[i]), false, false, false) if DoesEntityExist(object) then local objCoords = GetEntityCoords(object) - local distance = GetDistanceBetweenCoords(coords.x, coords.y, coords.z, objCoords.x, objCoords.y, objCoords.z, true) + local distance = GetDistanceBetweenCoords(coords, objCoords, true) if closestDistance == -1 or closestDistance > distance then closestDistance = distance @@ -983,12 +975,12 @@ Citizen.CreateThread(function() if closestDistance ~= -1 and closestDistance <= 3.0 then if LastEntity ~= closestEntity then - TriggerEvent('esx_mecanojob:hasEnteredEntityZone', closestEntity) + TriggerEvent('esx_mechanic:hasEnteredEntityZone', closestEntity) LastEntity = closestEntity end else - if LastEntity ~= nil then - TriggerEvent('esx_mecanojob:hasExitedEntityZone', LastEntity) + if LastEntity then + TriggerEvent('esx_mechanic:hasExitedEntityZone', LastEntity) LastEntity = nil end end @@ -1000,23 +992,23 @@ Citizen.CreateThread(function() while true do Citizen.Wait(0) - if CurrentAction ~= nil then + if CurrentAction then ESX.ShowHelpNotification(CurrentActionMsg) - if IsControlJustReleased(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then + if IsControlJustReleased(0, Keys['E']) and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then - if CurrentAction == 'mecano_actions_menu' then - OpenMecanoActionsMenu() - elseif CurrentAction == 'mecano_harvest_menu' then - OpenMecanoHarvestMenu() - elseif CurrentAction == 'mecano_craft_menu' then - OpenMecanoCraftMenu() + 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) - TriggerServerEvent('esx_society:putVehicleInGarage', 'mecano', vehicleProps) + TriggerServerEvent('esx_society:putVehicleInGarage', 'mechanic', vehicleProps) else @@ -1025,7 +1017,7 @@ Citizen.CreateThread(function() GetEntityModel(vehicle) == GetHashKey('towtruck2') or GetEntityModel(vehicle) == GetHashKey('slamvan3') then - TriggerServerEvent('esx_service:disableService', 'mecano') + TriggerServerEvent('esx_service:disableService', 'mechanic') end end @@ -1040,42 +1032,36 @@ Citizen.CreateThread(function() end end - if IsControlJustReleased(0, Keys['F6']) and not IsDead and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - OpenMobileMecanoActionsMenu() + if IsControlJustReleased(0, Keys['F6']) and not isDead and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then + OpenMobileMechanicActionsMenu() end - if IsControlJustReleased(0, Keys['DELETE']) and not IsDead and PlayerData.job ~= nil and PlayerData.job.name == 'mecano' then - + if IsControlJustReleased(0, Keys['DELETE']) and not isDead and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then if NPCOnJob then - if GetGameTimer() - NPCLastCancel > 5 * 60000 then StopNPCJob(true) NPCLastCancel = GetGameTimer() else ESX.ShowNotification(_U('wait_five')) end - else - local playerPed = PlayerPedId() - if IsPedInAnyVehicle(playerPed, false) and IsVehicleModel(GetVehiclePedIsIn(playerPed, false), GetHashKey("flatbed")) then + if IsPedInAnyVehicle(playerPed, false) and IsVehicleModel(GetVehiclePedIsIn(playerPed, false), GetHashKey('flatbed')) then StartNPCJob() else ESX.ShowNotification(_U('must_in_flatbed')) end - end - end end end) AddEventHandler('esx:onPlayerDeath', function(data) - IsDead = true + isDead = true end) AddEventHandler('playerSpawned', function(spawn) - IsDead = false + isDead = false end) diff --git a/config.lua b/config.lua index 1a580b14..da6efb2c 100644 --- a/config.lua +++ b/config.lua @@ -1,12 +1,14 @@ Config = {} +Config.Locale = 'fr' + Config.DrawDistance = 100.0 Config.MaxInService = -1 Config.EnablePlayerManagement = false Config.EnableSocietyOwnedVehicles = false + Config.NPCSpawnDistance = 500.0 Config.NPCNextToDistance = 25.0 Config.NPCJobEarnings = { min = 15, max = 40 } -Config.Locale = 'fr' Config.Vehicles = { 'adder', @@ -18,7 +20,7 @@ Config.Vehicles = { Config.Zones = { - MecanoActions = { + MechanicActions = { 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 }, @@ -26,7 +28,7 @@ Config.Zones = { }, Garage = { - Pos = { x = -97.5797576904297, y = 6496.11376953125, z = 30.4909038543701 }, + Pos = { x = -97.5, y = 6496.1, z = 30.4 }, Size = { x = 1.5, y = 1.5, z = 1.0 }, Color = { r = 204, g = 204, b = 0 }, Type = 1, diff --git a/esx_mecanojob.sql b/esx_mechanicjob.sql similarity index 61% rename from esx_mecanojob.sql rename to esx_mechanicjob.sql index 03b45f44..fc98ce84 100644 --- a/esx_mecanojob.sql +++ b/esx_mechanicjob.sql @@ -1,23 +1,23 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_mecano', 'Mécano', 1) + ('society_mechanic', 'Mécano', 1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_mecano', 'Mécano', 1) + ('society_mechanic', 'Mécano', 1) ; INSERT INTO `jobs` (name, label) VALUES - ('mecano', 'Mécano') + ('mechanic', 'Mécano') ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('mecano',0,'recrue','Recrue',12,'{}','{}'), - ('mecano',1,'novice','Novice',24,'{}','{}'), - ('mecano',2,'experimente','Experimente',36,'{}','{}'), - ('mecano',3,'chief',"Chef d\'équipe",48,'{}','{}'), - ('mecano',4,'boss','Patron',0,'{}','{}') + ('mechanic',0,'recrue','Recrue',12,'{}','{}'), + ('mechanic',1,'novice','Novice',24,'{}','{}'), + ('mechanic',2,'experimente','Experimente',36,'{}','{}'), + ('mechanic',3,'chief',"Chef d\'équipe",48,'{}','{}'), + ('mechanic',4,'boss','Patron',0,'{}','{}') ; INSERT INTO `items` (name, label, `limit`) VALUES diff --git a/localization/en_esx_mecanojob.sql b/localization/en_esx_mecanojob.sql index 8fda8b83..524338fc 100644 --- a/localization/en_esx_mecanojob.sql +++ b/localization/en_esx_mecanojob.sql @@ -1,23 +1,23 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_mecano', 'Mechanic', 1) + ('society_mechanic', 'Mechanic', 1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_mecano', 'Mechanic', 1) + ('society_mechanic', 'Mechanic', 1) ; INSERT INTO `jobs` (name, label) VALUES - ('mecano', 'Mechanic') + ('mechanic', 'Mechanic') ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('mecano',0,'recrue','Recruit',12,'{}','{}'), - ('mecano',1,'novice','Novice',24,'{}','{}'), - ('mecano',2,'experimente','Experienced',36,'{}','{}'), - ('mecano',3,'chief','Leader',48,'{}','{}'), - ('mecano',4,'boss','Boss',0,'{}','{}') + ('mechanic',0,'recrue','Recruit',12,'{}','{}'), + ('mechanic',1,'novice','Novice',24,'{}','{}'), + ('mechanic',2,'experimente','Experienced',36,'{}','{}'), + ('mechanic',3,'chief','Leader',48,'{}','{}'), + ('mechanic',4,'boss','Boss',0,'{}','{}') ; INSERT INTO `items` (name, label, `limit`) VALUES diff --git a/localization/fi_esx_mecanojob.sql b/localization/fi_esx_mecanojob.sql index 2d9b9b83..66e013f3 100644 --- a/localization/fi_esx_mecanojob.sql +++ b/localization/fi_esx_mecanojob.sql @@ -1,23 +1,23 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_mecano', 'Mekaanikko', 1) + ('society_mechanic', 'Mekaanikko', 1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_mecano', 'Mekaanikko', 1) + ('society_mechanic', 'Mekaanikko', 1) ; INSERT INTO `jobs` (name, label) VALUES - ('mecano', 'Mekaanikko') + ('mechanic', 'Mekaanikko') ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('mecano',0,'recrue','Harjottelija',12,'{}','{}'), - ('mecano',1,'novice','Aloittelija',24,'{}','{}'), - ('mecano',2,'experimente','Kokenut',36,'{}','{}'), - ('mecano',3,'chief','Johtaja',48,'{}','{}'), - ('mecano',4,'boss','Pomo',0,'{}','{}') + ('mechanic',0,'recrue','Harjottelija',12,'{}','{}'), + ('mechanic',1,'novice','Aloittelija',24,'{}','{}'), + ('mechanic',2,'experimente','Kokenut',36,'{}','{}'), + ('mechanic',3,'chief','Johtaja',48,'{}','{}'), + ('mechanic',4,'boss','Pomo',0,'{}','{}') ; INSERT INTO `items` (name, label, `limit`) VALUES diff --git a/localization/pl_esx_mecanojob.sql b/localization/pl_esx_mecanojob.sql index b8c9f819..a58b4bbf 100644 --- a/localization/pl_esx_mecanojob.sql +++ b/localization/pl_esx_mecanojob.sql @@ -1,23 +1,23 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_mecano', 'Mechanik', 1) + ('society_mechanic', 'Mechanik', 1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_mecano', 'Mechanik', 1) + ('society_mechanic', 'Mechanik', 1) ; INSERT INTO `jobs` (name, label) VALUES - ('mecano', 'Mechanik') + ('mechanic', 'Mechanik') ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('mecano',0,'recrue','Praktykant',12,'{}','{}'), - ('mecano',1,'novice','Nowicjusz',24,'{}','{}'), - ('mecano',2,'experimente','Doświadczony',36,'{}','{}'), - ('mecano',3,'chief','Kierownik',48,'{}','{}'), - ('mecano',4,'boss','Szef',0,'{}','{}') + ('mechanic',0,'recrue','Praktykant',12,'{}','{}'), + ('mechanic',1,'novice','Nowicjusz',24,'{}','{}'), + ('mechanic',2,'experimente','Doświadczony',36,'{}','{}'), + ('mechanic',3,'chief','Kierownik',48,'{}','{}'), + ('mechanic',4,'boss','Szef',0,'{}','{}') ; INSERT INTO `items` (name, label, `limit`) VALUES diff --git a/localization/sv_esx_mecanojob.sql b/localization/sv_esx_mecanojob.sql index a6bd08f8..a4d3bd69 100644 --- a/localization/sv_esx_mecanojob.sql +++ b/localization/sv_esx_mecanojob.sql @@ -1,23 +1,23 @@ USE `essentialmode`; INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_mecano', 'Mekaniker', 1) + ('society_mechanic', 'Mekaniker', 1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_mecano', 'Mekaniker', 1) + ('society_mechanic', 'Mekaniker', 1) ; INSERT INTO `jobs` (name, label) VALUES - ('mecano', 'Mekaniker') + ('mechanic', 'Mekaniker') ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('mecano',0,'recrue','Rekryt',12,'{}','{}'), - ('mecano',1,'novice','Nyanställd',24,'{}','{}'), - ('mecano',2,'experimente','Erfaren',36,'{}','{}'), - ('mecano',3,'chief','Chef',48,'{}','{}'), - ('mecano',4,'boss','Ägare',0,'{}','{}') + ('mechanic',0,'recrue','Rekryt',12,'{}','{}'), + ('mechanic',1,'novice','Nyanställd',24,'{}','{}'), + ('mechanic',2,'experimente','Erfaren',36,'{}','{}'), + ('mechanic',3,'chief','Chef',48,'{}','{}'), + ('mechanic',4,'boss','Ägare',0,'{}','{}') ; INSERT INTO `items` (name, label, `limit`) VALUES diff --git a/server/main.lua b/server/main.lua index ce4baf68..5c18d441 100644 --- a/server/main.lua +++ b/server/main.lua @@ -9,11 +9,11 @@ PlayersCrafting3 = {} TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) if Config.MaxInService ~= -1 then - TriggerEvent('esx_service:activateService', 'mecano', Config.MaxInService) + TriggerEvent('esx_service:activateService', 'mechanic', Config.MaxInService) end -TriggerEvent('esx_phone:registerNumber', 'mecano', _U('mechanic_customer'), true, true) -TriggerEvent('esx_society:registerSociety', 'mecano', 'Mecano', 'society_mecano', 'society_mecano', 'society_mecano', {type = 'private'}) +TriggerEvent('esx_phone:registerNumber', 'mechanic', _U('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() @@ -33,16 +33,16 @@ local function Harvest(source) end) end -RegisterServerEvent('esx_mecanojob:startHarvest') -AddEventHandler('esx_mecanojob:startHarvest', function() +RegisterServerEvent('esx_mechanicjob:startHarvest') +AddEventHandler('esx_mechanicjob:startHarvest', function() local _source = source PlayersHarvesting[_source] = true TriggerClientEvent('esx:showNotification', _source, _U('recovery_gas_can')) Harvest(source) end) -RegisterServerEvent('esx_mecanojob:stopHarvest') -AddEventHandler('esx_mecanojob:stopHarvest', function() +RegisterServerEvent('esx_mechanicjob:stopHarvest') +AddEventHandler('esx_mechanicjob:stopHarvest', function() local _source = source PlayersHarvesting[_source] = false end) @@ -65,16 +65,16 @@ local function Harvest2(source) end) end -RegisterServerEvent('esx_mecanojob:startHarvest2') -AddEventHandler('esx_mecanojob:startHarvest2', function() +RegisterServerEvent('esx_mechanicjob:startHarvest2') +AddEventHandler('esx_mechanicjob:startHarvest2', function() local _source = source PlayersHarvesting2[_source] = true TriggerClientEvent('esx:showNotification', _source, _U('recovery_repair_tools')) Harvest2(_source) end) -RegisterServerEvent('esx_mecanojob:stopHarvest2') -AddEventHandler('esx_mecanojob:stopHarvest2', function() +RegisterServerEvent('esx_mechanicjob:stopHarvest2') +AddEventHandler('esx_mechanicjob:stopHarvest2', function() local _source = source PlayersHarvesting2[_source] = false end) @@ -96,16 +96,16 @@ local function Harvest3(source) end) end -RegisterServerEvent('esx_mecanojob:startHarvest3') -AddEventHandler('esx_mecanojob:startHarvest3', function() +RegisterServerEvent('esx_mechanicjob:startHarvest3') +AddEventHandler('esx_mechanicjob:startHarvest3', function() local _source = source PlayersHarvesting3[_source] = true TriggerClientEvent('esx:showNotification', _source, _U('recovery_body_tools')) Harvest3(_source) end) -RegisterServerEvent('esx_mecanojob:stopHarvest3') -AddEventHandler('esx_mecanojob:stopHarvest3', function() +RegisterServerEvent('esx_mechanicjob:stopHarvest3') +AddEventHandler('esx_mechanicjob:stopHarvest3', function() local _source = source PlayersHarvesting3[_source] = false end) @@ -129,16 +129,16 @@ local function Craft(source) end) end -RegisterServerEvent('esx_mecanojob:startCraft') -AddEventHandler('esx_mecanojob:startCraft', function() +RegisterServerEvent('esx_mechanicjob:startCraft') +AddEventHandler('esx_mechanicjob:startCraft', function() local _source = source PlayersCrafting[_source] = true TriggerClientEvent('esx:showNotification', _source, _U('assembling_blowtorch')) Craft(_source) end) -RegisterServerEvent('esx_mecanojob:stopCraft') -AddEventHandler('esx_mecanojob:stopCraft', function() +RegisterServerEvent('esx_mechanicjob:stopCraft') +AddEventHandler('esx_mechanicjob:stopCraft', function() local _source = source PlayersCrafting[_source] = false end) @@ -162,16 +162,16 @@ local function Craft2(source) end) end -RegisterServerEvent('esx_mecanojob:startCraft2') -AddEventHandler('esx_mecanojob:startCraft2', function() +RegisterServerEvent('esx_mechanicjob:startCraft2') +AddEventHandler('esx_mechanicjob:startCraft2', function() local _source = source PlayersCrafting2[_source] = true TriggerClientEvent('esx:showNotification', _source, _U('assembling_repair_kit')) Craft2(_source) end) -RegisterServerEvent('esx_mecanojob:stopCraft2') -AddEventHandler('esx_mecanojob:stopCraft2', function() +RegisterServerEvent('esx_mechanicjob:stopCraft2') +AddEventHandler('esx_mechanicjob:stopCraft2', function() local _source = source PlayersCrafting2[_source] = false end) @@ -195,22 +195,22 @@ local function Craft3(source) end) end -RegisterServerEvent('esx_mecanojob:startCraft3') -AddEventHandler('esx_mecanojob:startCraft3', function() +RegisterServerEvent('esx_mechanicjob:startCraft3') +AddEventHandler('esx_mechanicjob:startCraft3', function() local _source = source PlayersCrafting3[_source] = true TriggerClientEvent('esx:showNotification', _source, _U('assembling_body_kit')) Craft3(_source) end) -RegisterServerEvent('esx_mecanojob:stopCraft3') -AddEventHandler('esx_mecanojob:stopCraft3', function() +RegisterServerEvent('esx_mechanicjob:stopCraft3') +AddEventHandler('esx_mechanicjob:stopCraft3', function() local _source = source PlayersCrafting3[_source] = false end) -RegisterServerEvent('esx_mecanojob:onNPCJobMissionCompleted') -AddEventHandler('esx_mecanojob: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); @@ -219,7 +219,7 @@ AddEventHandler('esx_mecanojob:onNPCJobMissionCompleted', function() total = total * 2 end - TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mecano', function(account) + TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account) account.addMoney(total) end) @@ -232,7 +232,7 @@ ESX.RegisterUsableItem('blowpipe', function(source) xPlayer.removeInventoryItem('blowpipe', 1) - TriggerClientEvent('esx_mecanojob:onHijack', _source) + TriggerClientEvent('esx_mechanicjob:onHijack', _source) TriggerClientEvent('esx:showNotification', _source, _U('you_used_blowtorch')) end) @@ -242,7 +242,7 @@ ESX.RegisterUsableItem('fixkit', function(source) xPlayer.removeInventoryItem('fixkit', 1) - TriggerClientEvent('esx_mecanojob:onFixkit', _source) + TriggerClientEvent('esx_mechanicjob:onFixkit', _source) TriggerClientEvent('esx:showNotification', _source, _U('you_used_repair_kit')) end) @@ -252,15 +252,15 @@ ESX.RegisterUsableItem('carokit', function(source) xPlayer.removeInventoryItem('carokit', 1) - TriggerClientEvent('esx_mecanojob:onCarokit', _source) + TriggerClientEvent('esx_mechanicjob:onCarokit', _source) TriggerClientEvent('esx:showNotification', _source, _U('you_used_body_kit')) end) -RegisterServerEvent('esx_mecanojob:getStockItem') -AddEventHandler('esx_mecanojob: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_mecano', function(inventory) + TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mechanic', function(inventory) local item = inventory.getItem(itemName) local sourceItem = xPlayer.getInventoryItem(itemName) @@ -281,17 +281,17 @@ AddEventHandler('esx_mecanojob:getStockItem', function(itemName, count) end) end) -ESX.RegisterServerCallback('esx_mecanojob:getStockItems', function(source, cb) - TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', 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_mecanojob:putStockItems') -AddEventHandler('esx_mecanojob: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_mecano', function(inventory) + TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mechanic', function(inventory) local item = inventory.getItem(itemName) local playerItemCount = xPlayer.getInventoryItem(itemName).count @@ -306,7 +306,7 @@ AddEventHandler('esx_mecanojob:putStockItems', function(itemName, count) end) end) -ESX.RegisterServerCallback('esx_mecanojob:getPlayerInventory', function(source, cb) +ESX.RegisterServerCallback('esx_mechanicjob:getPlayerInventory', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) local items = xPlayer.inventory From 4c1df35482edd0dccc9e8384e265b771a667d803 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sat, 19 Jan 2019 20:07:29 +0100 Subject: [PATCH 51/66] Proper event namespace fixes --- client/main.lua | 64 ++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/client/main.lua b/client/main.lua index 46092090..c56fb164 100644 --- a/client/main.lua +++ b/client/main.lua @@ -75,7 +75,7 @@ function StopNPCJob(cancel) if cancel then ESX.ShowNotification(_U('mission_canceled')) else - --TriggerServerEvent('esx_mechanic:onNPCJobCompleted') + --TriggerServerEvent('esx_mechanicjob:onNPCJobCompleted') end end @@ -235,11 +235,11 @@ function OpenMechanicHarvestMenu() menu.close() if data.current.value == 'gaz_bottle' then - TriggerServerEvent('esx_mechanic:startHarvest') + TriggerServerEvent('esx_mechanicjob:startHarvest') elseif data.current.value == 'fix_tool' then - TriggerServerEvent('esx_mechanic:startHarvest2') + TriggerServerEvent('esx_mechanicjob:startHarvest2') elseif data.current.value == 'caro_tool' then - TriggerServerEvent('esx_mechanic:startHarvest3') + TriggerServerEvent('esx_mechanicjob:startHarvest3') end end, function(data, menu) menu.close() @@ -272,11 +272,11 @@ function OpenMechanicCraftMenu() menu.close() if data.current.value == 'blow_pipe' then - TriggerServerEvent('esx_mechanic:startCraft') + TriggerServerEvent('esx_mechanicjob:startCraft') elseif data.current.value == 'fix_kit' then - TriggerServerEvent('esx_mechanic:startCraft2') + TriggerServerEvent('esx_mechanicjob:startCraft2') elseif data.current.value == 'caro_kit' then - TriggerServerEvent('esx_mechanic:startCraft3') + TriggerServerEvent('esx_mechanicjob:startCraft3') end end, function(data, menu) menu.close() @@ -491,7 +491,7 @@ function OpenMobileMechanicActionsMenu() if CurrentlyTowedVehicle == NPCTargetTowable then ESX.Game.DeleteVehicle(NPCTargetTowable) - TriggerServerEvent('esx_mechanic:onNPCJobMissionCompleted') + TriggerServerEvent('esx_mechanicjob:onNPCJobMissionCompleted') StopNPCJob() NPCTargetDeleterZone = false else @@ -560,7 +560,7 @@ function OpenMobileMechanicActionsMenu() end function OpenGetStocksMenu() - ESX.TriggerServerCallback('esx_mechanic:getStockItems', function(items) + ESX.TriggerServerCallback('esx_mechanicjob:getStockItems', function(items) local elements = {} @@ -590,7 +590,7 @@ function OpenGetStocksMenu() else menu2.close() menu.close() - TriggerServerEvent('esx_mechanic:getStockItem', itemName, count) + TriggerServerEvent('esx_mechanicjob:getStockItem', itemName, count) Citizen.Wait(1000) OpenGetStocksMenu() @@ -609,7 +609,7 @@ end function OpenPutStocksMenu() - ESX.TriggerServerCallback('esx_mechanic:getPlayerInventory', function(inventory) + ESX.TriggerServerCallback('esx_mechanicjob:getPlayerInventory', function(inventory) local elements = {} for i=1, #inventory.items, 1 do @@ -642,7 +642,7 @@ function OpenPutStocksMenu() else menu2.close() menu.close() - TriggerServerEvent('esx_mechanic:putStockItems', itemName, count) + TriggerServerEvent('esx_mechanicjob:putStockItems', itemName, count) Citizen.Wait(1000) OpenPutStocksMenu() @@ -659,8 +659,8 @@ function OpenPutStocksMenu() end -RegisterNetEvent('esx_mechanic:onHijack') -AddEventHandler('esx_mechanic:onHijack', function() +RegisterNetEvent('esx_mechanicjob:onHijack') +AddEventHandler('esx_mechanicjob:onHijack', function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) @@ -701,8 +701,8 @@ AddEventHandler('esx_mechanic:onHijack', function() end end) -RegisterNetEvent('esx_mechanic:onCarokit') -AddEventHandler('esx_mechanic:onCarokit', function() +RegisterNetEvent('esx_mechanicjob:onCarokit') +AddEventHandler('esx_mechanicjob:onCarokit', function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) @@ -728,8 +728,8 @@ AddEventHandler('esx_mechanic:onCarokit', function() end end) -RegisterNetEvent('esx_mechanic:onFixkit') -AddEventHandler('esx_mechanic:onFixkit', function() +RegisterNetEvent('esx_mechanicjob:onFixkit') +AddEventHandler('esx_mechanicjob:onFixkit', function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) @@ -766,7 +766,7 @@ AddEventHandler('esx:setJob', function(job) ESX.PlayerData.job = job end) -AddEventHandler('esx_mechanic:hasEnteredMarker', function(zone) +AddEventHandler('esx_mechanicjob:hasEnteredMarker', function(zone) if zone == NPCJobTargetTowable then elseif zone =='VehicleDelivery' then @@ -796,24 +796,24 @@ AddEventHandler('esx_mechanic:hasEnteredMarker', function(zone) end end) -AddEventHandler('esx_mechanic:hasExitedMarker', function(zone) +AddEventHandler('esx_mechanicjob:hasExitedMarker', function(zone) if zone =='VehicleDelivery' then NPCTargetDeleterZone = false elseif zone == 'Craft' then - TriggerServerEvent('esx_mechanic:stopCraft') - TriggerServerEvent('esx_mechanic:stopCraft2') - TriggerServerEvent('esx_mechanic:stopCraft3') + TriggerServerEvent('esx_mechanicjob:stopCraft') + TriggerServerEvent('esx_mechanicjob:stopCraft2') + TriggerServerEvent('esx_mechanicjob:stopCraft3') elseif zone == 'Garage' then - TriggerServerEvent('esx_mechanic:stopHarvest') - TriggerServerEvent('esx_mechanic:stopHarvest2') - TriggerServerEvent('esx_mechanic:stopHarvest3') + TriggerServerEvent('esx_mechanicjob:stopHarvest') + TriggerServerEvent('esx_mechanicjob:stopHarvest2') + TriggerServerEvent('esx_mechanicjob:stopHarvest3') end CurrentAction = nil ESX.UI.Menu.CloseAll() end) -AddEventHandler('esx_mechanic:hasEnteredEntityZone', function(entity) +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 @@ -823,7 +823,7 @@ AddEventHandler('esx_mechanic:hasEnteredEntityZone', function(entity) end end) -AddEventHandler('esx_mechanic:hasExitedEntityZone', function(entity) +AddEventHandler('esx_mechanicjob:hasExitedEntityZone', function(entity) if CurrentAction == 'remove_entity' then CurrentAction = nil end @@ -932,12 +932,12 @@ Citizen.CreateThread(function() if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then HasAlreadyEnteredMarker = true LastZone = currentZone - TriggerEvent('esx_mechanic:hasEnteredMarker', currentZone) + TriggerEvent('esx_mechanicjob:hasEnteredMarker', currentZone) end if not isInMarker and HasAlreadyEnteredMarker then HasAlreadyEnteredMarker = false - TriggerEvent('esx_mechanic:hasExitedMarker', LastZone) + TriggerEvent('esx_mechanicjob:hasExitedMarker', LastZone) end end @@ -975,12 +975,12 @@ Citizen.CreateThread(function() if closestDistance ~= -1 and closestDistance <= 3.0 then if LastEntity ~= closestEntity then - TriggerEvent('esx_mechanic:hasEnteredEntityZone', closestEntity) + TriggerEvent('esx_mechanicjob:hasEnteredEntityZone', closestEntity) LastEntity = closestEntity end else if LastEntity then - TriggerEvent('esx_mechanic:hasExitedEntityZone', LastEntity) + TriggerEvent('esx_mechanicjob:hasExitedEntityZone', LastEntity) LastEntity = nil end end From cddeba024160164d85f0d37cb9c9c247bd4376f1 Mon Sep 17 00:00:00 2001 From: Jafool <5405476+Jafool@users.noreply.github.com> Date: Mon, 1 Apr 2019 15:09:51 +0200 Subject: [PATCH 52/66] Fixed faulty job grade name --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index c56fb164..c295072c 100644 --- a/client/main.lua +++ b/client/main.lua @@ -141,7 +141,7 @@ function OpenMechanicActionsMenu() {label = _U('tow_truck'), value = 'towtruck2'} } - if Config.EnablePlayerManagement and ESX.PlayerData.job and (ESX.PlayerData.job.grade_name == 'boss' or ESX.PlayerData.job.grade_name == 'chef' or ESX.PlayerData.job.grade_name == 'experimente') then + 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 table.insert(elements, {label = 'SlamVan', value = 'slamvan3'}) end From 9f600e3787e3ecb5e455650dc530acd3becd5804 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 31 May 2019 12:53:53 +0200 Subject: [PATCH 53/66] Minor cleanup --- client/main.lua | 426 +++++++++++++++++++++--------------------------- config.lua | 99 ++++++----- 2 files changed, 231 insertions(+), 294 deletions(-) diff --git a/client/main.lua b/client/main.lua index c295072c..08c482ba 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,15 +1,3 @@ -local Keys = { - ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, - ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, - ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18, - ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182, - ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81, - ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, - ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178, - ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173, - ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 -} - local HasAlreadyEnteredMarker, LastZone = false, nil local CurrentAction, CurrentActionMsg, CurrentActionData = nil, '', {} local CurrentlyTowedVehicle, Blips, NPCOnJob, NPCTargetTowable, NPCTargetTowableZone = nil, {}, false, nil, nil @@ -80,7 +68,6 @@ function StopNPCJob(cancel) end function OpenMechanicActionsMenu() - local elements = { {label = _U('vehicle_list'), value = 'vehicle_list'}, {label = _U('work_wear'), value = 'cloakroom'}, @@ -101,7 +88,6 @@ function OpenMechanicActionsMenu() elements = elements }, function(data, menu) if data.current.value == 'vehicle_list' then - if Config.EnableSocietyOwnedVehicles then local elements = {} @@ -177,9 +163,7 @@ function OpenMechanicActionsMenu() end) end - elseif data.current.value == 'cloakroom' then - menu.close() ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) if skin.sex == 0 then @@ -188,14 +172,11 @@ function OpenMechanicActionsMenu() TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female) end end) - elseif data.current.value == 'cloakroom2' then - menu.close() ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin) TriggerEvent('skinchanger:loadSkin', skin) end) - elseif data.current.value == 'put_stock' then OpenPutStocksMenu() elseif data.current.value == 'get_stock' then @@ -205,7 +186,6 @@ function OpenMechanicActionsMenu() menu.close() end) end - end, function(data, menu) menu.close() @@ -216,9 +196,7 @@ function OpenMechanicActionsMenu() end function OpenMechanicHarvestMenu() - if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name ~= 'recrue' then - local elements = { {label = _U('gas_can'), value = 'gaz_bottle'}, {label = _U('repair_tools'), value = 'fix_tool'}, @@ -247,7 +225,6 @@ function OpenMechanicHarvestMenu() CurrentActionMsg = _U('harvest_menu') CurrentActionData = {} end) - else ESX.ShowNotification(_U('not_experienced_enough')) end @@ -255,7 +232,6 @@ end function OpenMechanicCraftMenu() if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name ~= 'recrue' then - local elements = { {label = _U('blowtorch'), value = 'blow_pipe'}, {label = _U('repair_kit'), value = 'fix_kit'}, @@ -285,14 +261,12 @@ function OpenMechanicCraftMenu() CurrentActionMsg = _U('craft_menu') CurrentActionData = {} end) - else ESX.ShowNotification(_U('not_experienced_enough')) end end function OpenMobileMechanicActionsMenu() - ESX.UI.Menu.CloseAll() ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_mechanic_actions', { @@ -306,12 +280,10 @@ function OpenMobileMechanicActionsMenu() {label = _U('imp_veh'), value = 'del_vehicle'}, {label = _U('flat_bed'), value = 'dep_vehicle'}, {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', { title = _U('invoice_amount') }, function(data, menu) @@ -331,229 +303,207 @@ function OpenMobileMechanicActionsMenu() end, function(data, menu) menu.close() end) - elseif data.current.value == 'hijack_vehicle' then + local playerPed = PlayerPedId() + local vehicle = ESX.Game.GetVehicleInDirection() + local coords = GetEntityCoords(playerPed) - local playerPed = PlayerPedId() - local vehicle = ESX.Game.GetVehicleInDirection() - local coords = GetEntityCoords(playerPed) - - if IsPedSittingInAnyVehicle(playerPed) then - ESX.ShowNotification(_U('inside_vehicle')) - return - end - - if DoesEntityExist(vehicle) then - isBusy = true - 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')) - isBusy = false - end) - else - ESX.ShowNotification(_U('no_vehicle_nearby')) - end - - elseif data.current.value == 'fix_vehicle' then - - local playerPed = PlayerPedId() - local vehicle = ESX.Game.GetVehicleInDirection() - local coords = GetEntityCoords(playerPed) - - if IsPedSittingInAnyVehicle(playerPed) then - ESX.ShowNotification(_U('inside_vehicle')) - return - end - - if DoesEntityExist(vehicle) then - isBusy = true - 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')) - isBusy = false - end) - else - ESX.ShowNotification(_U('no_vehicle_nearby')) - end - - elseif data.current.value == 'clean_vehicle' then - - local playerPed = PlayerPedId() - local vehicle = ESX.Game.GetVehicleInDirection() - local coords = GetEntityCoords(playerPed) - - if IsPedSittingInAnyVehicle(playerPed) then - ESX.ShowNotification(_U('inside_vehicle')) - return - end - - if DoesEntityExist(vehicle) then - isBusy = true - TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_MAID_CLEAN', 0, true) - Citizen.CreateThread(function() - Citizen.Wait(10000) - - SetVehicleDirtLevel(vehicle, 0) - ClearPedTasksImmediately(playerPed) - - ESX.ShowNotification(_U('vehicle_cleaned')) - isBusy = false - end) - else - ESX.ShowNotification(_U('no_vehicle_nearby')) - end - - elseif data.current.value == 'del_vehicle' then - - local playerPed = PlayerPedId() - - if IsPedSittingInAnyVehicle(playerPed) then - local vehicle = GetVehiclePedIsIn(playerPed, false) - - if GetPedInVehicleSeat(vehicle, -1) == playerPed then - ESX.ShowNotification(_U('vehicle_impounded')) - ESX.Game.DeleteVehicle(vehicle) - else - ESX.ShowNotification(_U('must_seat_driver')) + if IsPedSittingInAnyVehicle(playerPed) then + ESX.ShowNotification(_U('inside_vehicle')) + return end - else - local vehicle = ESX.Game.GetVehicleInDirection() if DoesEntityExist(vehicle) then - ESX.ShowNotification(_U('vehicle_impounded')) - ESX.Game.DeleteVehicle(vehicle) + isBusy = true + 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')) + isBusy = false + end) else - ESX.ShowNotification(_U('must_near')) + ESX.ShowNotification(_U('no_vehicle_nearby')) end - end + elseif data.current.value == 'fix_vehicle' then + local playerPed = PlayerPedId() + local vehicle = ESX.Game.GetVehicleInDirection() + local coords = GetEntityCoords(playerPed) - elseif data.current.value == 'dep_vehicle' then + if IsPedSittingInAnyVehicle(playerPed) then + ESX.ShowNotification(_U('inside_vehicle')) + return + end - local playerPed = PlayerPedId() - local vehicle = GetVehiclePedIsIn(playerPed, true) + if DoesEntityExist(vehicle) then + isBusy = true + TaskStartScenarioInPlace(playerPed, 'PROP_HUMAN_BUM_BIN', 0, true) + Citizen.CreateThread(function() + Citizen.Wait(20000) - local towmodel = GetHashKey('flatbed') - local isVehicleTow = IsVehicleModel(vehicle, towmodel) + SetVehicleFixed(vehicle) + SetVehicleDeformationFixed(vehicle) + SetVehicleUndriveable(vehicle, false) + SetVehicleEngineOn(vehicle, true, true) + ClearPedTasksImmediately(playerPed) - if isVehicleTow then - local targetVehicle = ESX.Game.GetVehicleInDirection() + ESX.ShowNotification(_U('vehicle_repaired')) + isBusy = false + end) + else + ESX.ShowNotification(_U('no_vehicle_nearby')) + end + elseif data.current.value == 'clean_vehicle' then + local playerPed = PlayerPedId() + local vehicle = ESX.Game.GetVehicleInDirection() + local coords = GetEntityCoords(playerPed) - if CurrentlyTowedVehicle == nil then - if targetVehicle ~= 0 then - if not IsPedInAnyVehicle(playerPed, true) then - if vehicle ~= targetVehicle then - AttachEntityToEntity(targetVehicle, vehicle, 20, -0.5, -5.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) - CurrentlyTowedVehicle = targetVehicle - ESX.ShowNotification(_U('vehicle_success_attached')) + if IsPedSittingInAnyVehicle(playerPed) then + ESX.ShowNotification(_U('inside_vehicle')) + return + end - if NPCOnJob then - if NPCTargetTowable == targetVehicle then - ESX.ShowNotification(_U('please_drop_off')) - Config.Zones.VehicleDelivery.Type = 1 + if DoesEntityExist(vehicle) then + isBusy = true + TaskStartScenarioInPlace(playerPed, 'WORLD_HUMAN_MAID_CLEAN', 0, true) + Citizen.CreateThread(function() + Citizen.Wait(10000) - if Blips['NPCTargetTowableZone'] then - RemoveBlip(Blips['NPCTargetTowableZone']) - Blips['NPCTargetTowableZone'] = nil + SetVehicleDirtLevel(vehicle, 0) + ClearPedTasksImmediately(playerPed) + + ESX.ShowNotification(_U('vehicle_cleaned')) + isBusy = false + end) + else + ESX.ShowNotification(_U('no_vehicle_nearby')) + end + elseif data.current.value == 'del_vehicle' then + local playerPed = PlayerPedId() + + if IsPedSittingInAnyVehicle(playerPed) then + local vehicle = GetVehiclePedIsIn(playerPed, false) + + if GetPedInVehicleSeat(vehicle, -1) == playerPed then + ESX.ShowNotification(_U('vehicle_impounded')) + ESX.Game.DeleteVehicle(vehicle) + else + ESX.ShowNotification(_U('must_seat_driver')) + end + else + local vehicle = ESX.Game.GetVehicleInDirection() + + if DoesEntityExist(vehicle) then + ESX.ShowNotification(_U('vehicle_impounded')) + ESX.Game.DeleteVehicle(vehicle) + else + ESX.ShowNotification(_U('must_near')) + end + end + elseif data.current.value == 'dep_vehicle' then + local playerPed = PlayerPedId() + local vehicle = GetVehiclePedIsIn(playerPed, true) + + local towmodel = GetHashKey('flatbed') + local isVehicleTow = IsVehicleModel(vehicle, towmodel) + + if isVehicleTow then + local targetVehicle = ESX.Game.GetVehicleInDirection() + + if CurrentlyTowedVehicle == nil then + if targetVehicle ~= 0 then + if not IsPedInAnyVehicle(playerPed, true) then + if vehicle ~= targetVehicle then + AttachEntityToEntity(targetVehicle, vehicle, 20, -0.5, -5.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) + CurrentlyTowedVehicle = targetVehicle + ESX.ShowNotification(_U('vehicle_success_attached')) + + if NPCOnJob then + if NPCTargetTowable == targetVehicle then + ESX.ShowNotification(_U('please_drop_off')) + Config.Zones.VehicleDelivery.Type = 1 + + if Blips['NPCTargetTowableZone'] then + RemoveBlip(Blips['NPCTargetTowableZone']) + Blips['NPCTargetTowableZone'] = nil + end + + Blips['NPCDelivery'] = AddBlipForCoord(Config.Zones.VehicleDelivery.Pos.x, Config.Zones.VehicleDelivery.Pos.y, Config.Zones.VehicleDelivery.Pos.z) + SetBlipRoute(Blips['NPCDelivery'], true) end - - Blips['NPCDelivery'] = AddBlipForCoord(Config.Zones.VehicleDelivery.Pos.x, Config.Zones.VehicleDelivery.Pos.y, Config.Zones.VehicleDelivery.Pos.z) - SetBlipRoute(Blips['NPCDelivery'], true) end + else + ESX.ShowNotification(_U('cant_attach_own_tt')) end - else - ESX.ShowNotification(_U('cant_attach_own_tt')) end + else + ESX.ShowNotification(_U('no_veh_att')) end else - ESX.ShowNotification(_U('no_veh_att')) + AttachEntityToEntity(CurrentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) + DetachEntity(CurrentlyTowedVehicle, true, true) + + if NPCOnJob then + if NPCTargetDeleterZone then + + if CurrentlyTowedVehicle == NPCTargetTowable then + ESX.Game.DeleteVehicle(NPCTargetTowable) + TriggerServerEvent('esx_mechanicjob:onNPCJobMissionCompleted') + StopNPCJob() + NPCTargetDeleterZone = false + else + ESX.ShowNotification(_U('not_right_veh')) + end + + else + ESX.ShowNotification(_U('not_right_place')) + end + end + + CurrentlyTowedVehicle = nil + ESX.ShowNotification(_U('veh_det_succ')) end else + ESX.ShowNotification(_U('imp_flatbed')) + end + elseif data.current.value == 'object_spawner' then + local playerPed = PlayerPedId() - AttachEntityToEntity(CurrentlyTowedVehicle, vehicle, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true) - DetachEntity(CurrentlyTowedVehicle, true, true) + if IsPedSittingInAnyVehicle(playerPed) then + ESX.ShowNotification(_U('inside_vehicle')) + return + end - if NPCOnJob then - if NPCTargetDeleterZone then + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_mechanic_actions_spawn', { + title = _U('objects'), + align = 'top-left', + elements = { + {label = _U('roadcone'), value = 'prop_roadcone02a'}, + {label = _U('toolbox'), value = 'prop_toolchest_01'} + }}, function(data2, menu2) + local model = data2.current.value + local coords = GetEntityCoords(playerPed) + local forward = GetEntityForwardVector(playerPed) + local x, y, z = table.unpack(coords + forward * 1.0) - if CurrentlyTowedVehicle == NPCTargetTowable then - ESX.Game.DeleteVehicle(NPCTargetTowable) - TriggerServerEvent('esx_mechanicjob:onNPCJobMissionCompleted') - StopNPCJob() - NPCTargetDeleterZone = false - else - ESX.ShowNotification(_U('not_right_veh')) - end - - else - ESX.ShowNotification(_U('not_right_place')) - end + if model == 'prop_roadcone02a' then + z = z - 2.0 + elseif model == 'prop_toolchest_01' then + z = z - 2.0 end - CurrentlyTowedVehicle = nil - ESX.ShowNotification(_U('veh_det_succ')) - - end - else - ESX.ShowNotification(_U('imp_flatbed')) - end - - elseif data.current.value == 'object_spawner' then - - local playerPed = PlayerPedId() - - if IsPedSittingInAnyVehicle(playerPed) then - ESX.ShowNotification(_U('inside_vehicle')) - return - end - - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_mechanic_actions_spawn', { - title = _U('objects'), - align = 'top-left', - elements = { - {label = _U('roadcone'), value = 'prop_roadcone02a'}, - {label = _U('toolbox'), value = 'prop_toolchest_01'} - } - }, function(data2, menu2) - local model = data2.current.value - local coords = GetEntityCoords(playerPed) - local forward = GetEntityForwardVector(playerPed) - local x, y, z = table.unpack(coords + forward * 1.0) - - if model == 'prop_roadcone02a' then - z = z - 2.0 - elseif model == 'prop_toolchest_01' then - z = z - 2.0 - end - - ESX.Game.SpawnObject(model, { - x = x, - y = y, - z = z - }, function(obj) - SetEntityHeading(obj, GetEntityHeading(playerPed)) - PlaceObjectOnGroundProperly(obj) + ESX.Game.SpawnObject(model, {x = x, y = y, z = z}, function(obj) + SetEntityHeading(obj, GetEntityHeading(playerPed)) + PlaceObjectOnGroundProperly(obj) + end) + end, function(data2, menu2) + menu2.close() end) - - end, function(data2, menu2) - menu2.close() - end) - - end - + end end, function(data, menu) menu.close() end) @@ -561,7 +511,6 @@ end function OpenGetStocksMenu() ESX.TriggerServerCallback('esx_mechanicjob:getStockItems', function(items) - local elements = {} for i=1, #items, 1 do @@ -571,13 +520,11 @@ function OpenGetStocksMenu() }) end - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'stocks_menu', - { + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'stocks_menu', { title = _U('mechanic_stock'), align = 'top-left', elements = elements }, function(data, menu) - local itemName = data.current.value ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'stocks_menu_get_item_count', { @@ -598,17 +545,13 @@ function OpenGetStocksMenu() end, function(data2, menu2) menu2.close() end) - end, function(data, menu) menu.close() end) - end) - end function OpenPutStocksMenu() - ESX.TriggerServerCallback('esx_mechanicjob:getPlayerInventory', function(inventory) local elements = {} @@ -629,7 +572,6 @@ function OpenPutStocksMenu() align = 'top-left', elements = elements }, function(data, menu) - local itemName = data.current.value ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'stocks_menu_put_item_count', { @@ -653,19 +595,16 @@ function OpenPutStocksMenu() end, function(data, menu) menu.close() end) - end) - end - RegisterNetEvent('esx_mechanicjob:onHijack') AddEventHandler('esx_mechanicjob:onHijack', function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - local vehicle = nil + local vehicle if IsPedInAnyVehicle(playerPed, false) then vehicle = GetVehiclePedIsIn(playerPed, false) @@ -696,7 +635,6 @@ AddEventHandler('esx_mechanicjob:onHijack', function() ClearPedTasksImmediately(playerPed) end end) - end end end) @@ -707,7 +645,7 @@ AddEventHandler('esx_mechanicjob:onCarokit', function() local coords = GetEntityCoords(playerPed) if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - local vehicle = nil + local vehicle if IsPedInAnyVehicle(playerPed, false) then vehicle = GetVehiclePedIsIn(playerPed, false) @@ -734,7 +672,7 @@ AddEventHandler('esx_mechanicjob:onFixkit', function() local coords = GetEntityCoords(playerPed) if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - local vehicle = nil + local vehicle if IsPedInAnyVehicle(playerPed, false) then vehicle = GetVehiclePedIsIn(playerPed, false) @@ -767,7 +705,7 @@ AddEventHandler('esx:setJob', function(job) end) AddEventHandler('esx_mechanicjob:hasEnteredMarker', function(zone) - if zone == NPCJobTargetTowable then + if zone == 'NPCJobTargetTowable' then elseif zone =='VehicleDelivery' then NPCTargetDeleterZone = true @@ -995,7 +933,7 @@ Citizen.CreateThread(function() if CurrentAction then ESX.ShowHelpNotification(CurrentActionMsg) - if IsControlJustReleased(0, Keys['E']) and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then + if IsControlJustReleased(0, 38) and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then if CurrentAction == 'mechanic_actions_menu' then OpenMechanicActionsMenu() @@ -1032,11 +970,11 @@ Citizen.CreateThread(function() end end - if IsControlJustReleased(0, Keys['F6']) and not isDead and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then + if IsControlJustReleased(0, 167) and not isDead and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then OpenMobileMechanicActionsMenu() end - if IsControlJustReleased(0, Keys['DELETE']) and not isDead and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then + if IsControlJustReleased(0, 178) and not isDead and ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then if NPCOnJob then if GetGameTimer() - NPCLastCancel > 5 * 60000 then StopNPCJob(true) diff --git a/config.lua b/config.lua index da6efb2c..d048056c 100644 --- a/config.lua +++ b/config.lua @@ -24,91 +24,90 @@ Config.Zones = { 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, + Type = 1 }, Garage = { Pos = { x = -97.5, y = 6496.1, z = 30.4 }, Size = { x = 1.5, y = 1.5, z = 1.0 }, Color = { r = 204, g = 204, b = 0 }, - Type = 1, + Type = 1 }, Craft = { Pos = { x = -323.140, y = -129.882, z = 37.999 }, Size = { x = 1.5, y = 1.5, z = 1.0 }, Color = { r = 204, g = 204, b = 0 }, - Type = 1, + Type = 1 }, VehicleSpawnPoint = { Pos = { x = -366.354, y = -110.766, z = 37.696 }, Size = { x = 1.5, y = 1.5, z = 1.0 }, - Type = -1, + Type = -1 }, VehicleDeleter = { Pos = { x = -386.899, y = -105.675, z = 37.683 }, Size = { x = 3.0, y = 3.0, z = 1.0 }, Color = { r = 204, g = 204, b = 0 }, - Type = 1, + Type = 1 }, VehicleDelivery = { Pos = { x = -382.925, y = -133.748, z = 37.685 }, Size = { x = 20.0, y = 20.0, z = 3.0 }, Color = { r = 204, g = 204, b = 0 }, - Type = -1, + Type = -1 } - } Config.Towables = { - { ['x'] = -2480.8720703125, ['y'] = -211.96409606934, ['z'] = 17.397672653198 }, - { ['x'] = -2723.392578125, ['y'] = 13.207388877869, ['z'] = 15.12806892395 }, - { ['x'] = -3169.6235351563, ['y'] = 976.18127441406, ['z'] = 15.038360595703 }, - { ['x'] = -3139.7568359375, ['y'] = 1078.7182617188, ['z'] = 20.189767837524 }, - { ['x'] = -1656.9357910156, ['y'] = -246.16479492188, ['z'] = 54.510955810547 }, - { ['x'] = -1586.6560058594, ['y'] = -647.56115722656, ['z'] = 29.441320419312 }, - { ['x'] = -1036.1470947266, ['y'] = -491.05856323242, ['z'] = 36.214912414551 }, - { ['x'] = -1029.1884765625, ['y'] = -475.53167724609, ['z'] = 36.416831970215 }, - { ['x'] = 75.212287902832, ['y'] = 164.8522644043, ['z'] = 104.69123077393 }, - { ['x'] = -534.60491943359, ['y'] = -756.71801757813, ['z'] = 31.599143981934 }, - { ['x'] = 487.24212646484, ['y'] = -30.827201843262, ['z'] = 88.856712341309 }, - { ['x'] = -772.20111083984, ['y'] = -1281.8114013672, ['z'] = 4.5642876625061 }, - { ['x'] = -663.84173583984, ['y'] = -1206.9936523438, ['z'] = 10.171216011047 }, - { ['x'] = 719.12451171875, ['y'] = -767.77545166016, ['z'] = 24.892364501953 }, - { ['x'] = -970.95465087891, ['y'] = -2410.4453125, ['z'] = 13.344270706177 }, - { ['x'] = -1067.5234375, ['y'] = -2571.4064941406, ['z'] = 13.211874008179 }, - { ['x'] = -619.23968505859, ['y'] = -2207.2927246094, ['z'] = 5.5659561157227 }, - { ['x'] = 1192.0831298828, ['y'] = -1336.9086914063, ['z'] = 35.106426239014 }, - { ['x'] = -432.81033325195, ['y'] = -2166.0505371094, ['z'] = 9.8885231018066 }, - { ['x'] = -451.82403564453, ['y'] = -2269.34765625, ['z'] = 7.1719741821289 }, - { ['x'] = 939.26702880859, ['y'] = -2197.5390625, ['z'] = 30.546691894531 }, - { ['x'] = -556.11486816406, ['y'] = -1794.7312011719, ['z'] = 22.043060302734 }, - { ['x'] = 591.73504638672, ['y'] = -2628.2197265625, ['z'] = 5.5735430717468 }, - { ['x'] = 1654.515625, ['y'] = -2535.8325195313, ['z'] = 74.491394042969 }, - { ['x'] = 1642.6146240234, ['y'] = -2413.3159179688, ['z'] = 93.139915466309 }, - { ['x'] = 1371.3223876953, ['y'] = -2549.525390625, ['z'] = 47.575256347656 }, - { ['x'] = 383.83779907227, ['y'] = -1652.8695068359, ['z'] = 37.278503417969 }, - { ['x'] = 27.219129562378, ['y'] = -1030.8818359375, ['z'] = 29.414621353149 }, - { ['x'] = 229.26435852051, ['y'] = -365.91101074219, ['z'] = 43.750762939453 }, - { ['x'] = -85.809432983398, ['y'] = -51.665500640869, ['z'] = 61.10591506958 }, - { ['x'] = -4.5967531204224, ['y'] = -670.27124023438, ['z'] = 31.85863494873 }, - { ['x'] = -111.89884185791, ['y'] = 91.96940612793, ['z'] = 71.080169677734 }, - { ['x'] = -314.26129150391, ['y'] = -698.23309326172, ['z'] = 32.545776367188 }, - { ['x'] = -366.90979003906, ['y'] = 115.53963470459, ['z'] = 65.575706481934 }, - { ['x'] = -592.06726074219, ['y'] = 138.20733642578, ['z'] = 60.074813842773 }, - { ['x'] = -1613.8572998047, ['y'] = 18.759860992432, ['z'] = 61.799819946289 }, - { ['x'] = -1709.7995605469, ['y'] = 55.105819702148, ['z'] = 65.706237792969 }, - { ['x'] = -521.88830566406, ['y'] = -266.7805480957, ['z'] = 34.940990447998 }, - { ['x'] = -451.08666992188, ['y'] = -333.52026367188, ['z'] = 34.021533966064 }, - { ['x'] = 322.36480712891, ['y'] = -1900.4990234375, ['z'] = 25.773607254028 } + vector3(-2480.9, -212.0, 17.4), + vector3(-2723.4, 13.2, 15.1), + vector3(-3169.6, 976.2, 15.0), + vector3(-3139.8, 1078.7, 20.2), + vector3(-1656.9, -246.2, 54.5), + vector3(-1586.7, -647.6, 29.4), + vector3(-1036.1, -491.1, 36.2), + vector3(-1029.2, -475.5, 36.4), + vector3(75.2, 164.9, 104.7), + vector3(-534.6, -756.7, 31.6), + vector3(487.2, -30.8, 88.9), + vector3(-772.2, -1281.8, 4.6), + vector3(-663.8, -1207.0, 10.2), + vector3(719.1, -767.8, 24.9), + vector3(-971.0, -2410.4, 13.3), + vector3(-1067.5, -2571.4, 13.2), + vector3(-619.2, -2207.3, 5.6), + vector3(1192.1, -1336.9, 35.1), + vector3(-432.8, -2166.1, 9.9), + vector3(-451.8, -2269.3, 7.2), + vector3(939.3, -2197.5, 30.5), + vector3(-556.1, -1794.7, 22.0), + vector3(591.7, -2628.2, 5.6), + vector3(1654.5, -2535.8, 74.5), + vector3(1642.6, -2413.3, 93.1), + vector3(1371.3, -2549.5, 47.6), + vector3(383.8, -1652.9, 37.3), + vector3(27.2, -1030.9, 29.4), + vector3(229.3, -365.9, 43.8), + vector3(-85.8, -51.7, 61.1), + vector3(-4.6, -670.3, 31.9), + vector3(-111.9, 92.0, 71.1), + vector3(-314.3, -698.2, 32.5), + vector3(-366.9, 115.5, 65.6), + vector3(-592.1, 138.2, 60.1), + vector3(-1613.9, 18.8, 61.8), + vector3(-1709.8, 55.1, 65.7), + vector3(-521.9, -266.8, 34.9), + vector3(-451.1, -333.5, 34.0), + vector3(322.4, -1900.5, 25.8) } -for i=1, #Config.Towables, 1 do - Config.Zones['Towable' .. i] = { - Pos = Config.Towables[i], +for k,v in ipairs(Config.Towables) do + Config.Zones['Towable' .. k] = { + Pos = v, Size = { x = 1.5, y = 1.5, z = 1.0 }, Color = { r = 204, g = 204, b = 0 }, Type = -1 From 8be80eda4ec4ae535d6bb1539c06982011a5f501 Mon Sep 17 00:00:00 2001 From: KandaSoranyan <32266067+KandaSoranyan@users.noreply.github.com> Date: Fri, 31 May 2019 13:16:41 +0200 Subject: [PATCH 54/66] missing translation --- locales/fr.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locales/fr.lua b/locales/fr.lua index c4dcbf34..72206bac 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -22,7 +22,7 @@ Locales['fr'] = { ['blowtorch'] = 'chalumeaux', ['repair_kit'] = 'kit Réparation', ['body_kit'] = 'kit Carosserie', - ['craft'] = 'etabli', + ['craft'] = 'établi', ['craft_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder au menu établi.', ['billing'] = 'facturation', ['hijack'] = 'crocheter', @@ -33,8 +33,8 @@ Locales['fr'] = { ['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!', + ['no_vehicle_nearby'] = 'aucun véhicule à proximité', + ['inside_vehicle'] = 'vous ne pouvez pas effectuer cette action depuis un véhicule!', ['vehicle_unlocked'] = 'véhicule ~g~déverouillé', ['vehicle_repaired'] = 'véhicule ~g~réparé', ['vehicle_cleaned'] = 'véhicule ~g~néttoyé', @@ -51,7 +51,7 @@ Locales['fr'] = { ['objects'] = 'objets', ['roadcone'] = 'plot', ['toolbox'] = 'boîte à outils', - ['mechanic_stock'] = 'mecano Stock', + ['mechanic_stock'] = 'coffre de l\'entreprise', ['quantity'] = 'quantité', ['invalid_quantity'] = 'quantité invalide', ['inventory'] = 'inventaire', @@ -82,5 +82,5 @@ Locales['fr'] = { ['you_used_body_kit'] = 'Vous avez utilisé un ~b~Kit de carosserie', ['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~s~ have enough ~y~free space~s~ in your inventory!', + ['player_cannot_hold'] = 'vous n\'avez ~r~pas assez~s~ d\'~y~espace libre~s~ dans votre inventaire!', } From e8f98e03ebfc07319d3b677abc5fc6b7ff56389c Mon Sep 17 00:00:00 2001 From: Poggu <45881722+Poggicek@users.noreply.github.com> Date: Wed, 13 Nov 2019 21:46:48 +0100 Subject: [PATCH 55/66] Add support for new ESX weight system (#63) * Added weight support * Update main.lua * Removed unused variable --- config.lua | 2 +- esx_mechanicjob.sql | 12 ++++++------ localization/en_esx_mecanojob.sql | 12 ++++++------ localization/fi_esx_mecanojob.sql | 12 ++++++------ localization/pl_esx_mecanojob.sql | 12 ++++++------ localization/sv_esx_mecanojob.sql | 12 ++++++------ server/main.lua | 15 +++++++-------- 7 files changed, 38 insertions(+), 39 deletions(-) diff --git a/config.lua b/config.lua index d048056c..9e716a49 100644 --- a/config.lua +++ b/config.lua @@ -112,4 +112,4 @@ for k,v in ipairs(Config.Towables) do Color = { r = 204, g = 204, b = 0 }, Type = -1 } -end +end \ No newline at end of file diff --git a/esx_mechanicjob.sql b/esx_mechanicjob.sql index fc98ce84..651cab5e 100644 --- a/esx_mechanicjob.sql +++ b/esx_mechanicjob.sql @@ -20,11 +20,11 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ('mechanic',4,'boss','Patron',0,'{}','{}') ; -INSERT INTO `items` (name, label, `limit`) VALUES - ('gazbottle', 'bouteille de gaz', 11), - ('fixtool', 'outils réparation', 6), - ('carotool', 'outils carosserie', 4), - ('blowpipe', 'Chalumeaux', 10), - ('fixkit', 'Kit réparation', 5), +INSERT INTO `items` (name, label, weight) VALUES + ('gazbottle', 'bouteille de gaz', 2), + ('fixtool', 'outils réparation', 2), + ('carotool', 'outils carosserie', 2), + ('blowpipe', 'Chalumeaux', 2), + ('fixkit', 'Kit réparation', 3), ('carokit', 'Kit carosserie', 3) ; diff --git a/localization/en_esx_mecanojob.sql b/localization/en_esx_mecanojob.sql index 524338fc..038e2bf6 100644 --- a/localization/en_esx_mecanojob.sql +++ b/localization/en_esx_mecanojob.sql @@ -20,11 +20,11 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ('mechanic',4,'boss','Boss',0,'{}','{}') ; -INSERT INTO `items` (name, label, `limit`) VALUES - ('gazbottle', 'Gas Bottle', 11), - ('fixtool', 'Repair Tools', 6), - ('carotool', 'Tools', 4), - ('blowpipe', 'Blowtorch', 10), - ('fixkit', 'Repair Kit', 5), +INSERT INTO `items` (name, label, weight) VALUES + ('gazbottle', 'Gas Bottle', 2), + ('fixtool', 'Repair Tools', 2), + ('carotool', 'Tools', 2), + ('blowpipe', 'Blowtorch', 2), + ('fixkit', 'Repair Kit', 3), ('carokit', 'Body Kit', 3) ; diff --git a/localization/fi_esx_mecanojob.sql b/localization/fi_esx_mecanojob.sql index 66e013f3..c3dadaa5 100644 --- a/localization/fi_esx_mecanojob.sql +++ b/localization/fi_esx_mecanojob.sql @@ -20,11 +20,11 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ('mechanic',4,'boss','Pomo',0,'{}','{}') ; -INSERT INTO `items` (name, label, `limit`) VALUES - ('gazbottle', 'Kaasupullo', 11), - ('fixtool', 'Korjaustyökalut', 6), - ('carotool', 'Työkalut', 4), - ('blowpipe', 'Polttoleikkuri', 10), - ('fixkit', 'Korjauskitti', 5), +INSERT INTO `items` (name, label, weight) VALUES + ('gazbottle', 'Kaasupullo', 2), + ('fixtool', 'Korjaustyökalut', 2), + ('carotool', 'Työkalut', 2), + ('blowpipe', 'Polttoleikkuri', 2), + ('fixkit', 'Korjauskitti', 3), ('carokit', 'Korikitti', 3) ; diff --git a/localization/pl_esx_mecanojob.sql b/localization/pl_esx_mecanojob.sql index a58b4bbf..b741fb45 100644 --- a/localization/pl_esx_mecanojob.sql +++ b/localization/pl_esx_mecanojob.sql @@ -20,11 +20,11 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ('mechanic',4,'boss','Szef',0,'{}','{}') ; -INSERT INTO `items` (name, label, `limit`) VALUES - ('gazbottle', 'Butelka z gazem', 11), - ('fixtool', 'Zestaw do naprawy', 6), - ('carotool', 'Częsci naprawcze', 4), - ('blowpipe', 'Palnik', 10), - ('fixkit', 'Narzedzia naprawcze', 5), +INSERT INTO `items` (name, label, weight) VALUES + ('gazbottle', 'Butelka z gazem', 2), + ('fixtool', 'Zestaw do naprawy', 2), + ('carotool', 'Częsci naprawcze', 2), + ('blowpipe', 'Palnik', 2), + ('fixkit', 'Narzedzia naprawcze', 3), ('carokit', 'Części blacharskie', 3) ; diff --git a/localization/sv_esx_mecanojob.sql b/localization/sv_esx_mecanojob.sql index a4d3bd69..181d3ad7 100644 --- a/localization/sv_esx_mecanojob.sql +++ b/localization/sv_esx_mecanojob.sql @@ -20,11 +20,11 @@ INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_ ('mechanic',4,'boss','Ägare',0,'{}','{}') ; -INSERT INTO `items` (name, label, `limit`) VALUES - ('gazbottle', 'Gas Flaska', 11), - ('fixtool', 'Reparationsverktyg', 6), - ('carotool', 'Verktyg', 4), - ('blowpipe', 'Blåslampa', 10), - ('fixkit', 'Reparationssats', 5), +INSERT INTO `items` (name, label, weight) VALUES + ('gazbottle', 'Gas Flaska', 2), + ('fixtool', 'Reparationsverktyg', 2), + ('carotool', 'Verktyg', 2), + ('blowpipe', 'Blåslampa', 2), + ('fixkit', 'Reparationssats', 3), ('carokit', 'Karosskit', 3) ; diff --git a/server/main.lua b/server/main.lua index 5c18d441..604eb082 100644 --- a/server/main.lua +++ b/server/main.lua @@ -262,21 +262,20 @@ AddEventHandler('esx_mechanicjob:getStockItem', function(itemName, count) TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mechanic', function(inventory) local item = inventory.getItem(itemName) - local sourceItem = xPlayer.getInventoryItem(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 sourceItem.limit ~= -1 and (sourceItem.count + count) > sourceItem.limit then - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('player_cannot_hold')) - else + if xPlayer.canCarryItem(itemName, count) then inventory.removeItem(itemName, count) xPlayer.addInventoryItem(itemName, count) - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_withdrawn', count, item.label)) + xPlayer.showNotification(_U('have_withdrawn', count, item.label)) + else + xPlayer.showNotification(_U('player_cannot_hold')) end else - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity')) + xPlayer.showNotification(_U('invalid_quantity')) end end) end) @@ -299,10 +298,10 @@ AddEventHandler('esx_mechanicjob:putStockItems', function(itemName, count) xPlayer.removeInventoryItem(itemName, count) inventory.addItem(itemName, count) else - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('invalid_quantity')) + xPlayer.showNotification(_U('invalid_quantity')) end - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_deposited', count, item.label)) + xPlayer.showNotification(_U('have_deposited', count, item.label)) end) end) From 804bf06ce5b3eeccf4c21ba8b0cc1e9e9d878fee Mon Sep 17 00:00:00 2001 From: Willem Dekker <16556575+Willem-Dekker@users.noreply.github.com> Date: Sun, 19 Jan 2020 16:08:36 +0100 Subject: [PATCH 56/66] Added Dutch translations (#52) * translated EN -> NL * added the locale to the config * Update nl.lua Updated indenting to 2 spaces instead of 4 --- __resource.lua | 2 ++ locales/nl.lua | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 locales/nl.lua diff --git a/__resource.lua b/__resource.lua index 0739b5a9..b2829826 100644 --- a/__resource.lua +++ b/__resource.lua @@ -12,6 +12,7 @@ client_scripts { 'locales/br.lua', 'locales/sv.lua', 'locales/pl.lua', + 'locales/nl.lua', 'config.lua', 'client/main.lua' } @@ -24,6 +25,7 @@ server_scripts { 'locales/br.lua', 'locales/sv.lua', 'locales/pl.lua', + 'locales/nl.lua', 'config.lua', 'server/main.lua' } diff --git a/locales/nl.lua b/locales/nl.lua new file mode 100644 index 00000000..6ff38d7a --- /dev/null +++ b/locales/nl.lua @@ -0,0 +1,85 @@ +Locales['nl'] = { + ['mechanic'] = 'monteur', + ['drive_to_indicated'] = '~y~Rij~s~ naar de aangegeven locatie', + ['mission_canceled'] = 'opdracht ~r~Geannuleerd~s~', + ['vehicle_list'] = 'voertuigenlijst', + ['work_wear'] = 'werk kleding', + ['civ_wear'] = 'burger kleding', + ['deposit_stock'] = 'vooraad wegleggen', + ['withdraw_stock'] = 'vooraad opbergen', + ['boss_actions'] = 'baas acties', + ['service_vehicle'] = 'service voertuig', + ['flat_bed'] = 'oprijwagen', + ['tow_truck'] = 'sleep wagen', + ['service_full'] = 'dienst voledig: ', + ['open_actions'] = 'Druk op ~INPUT_CONTEXT~ om in het menu te komen.', + ['harvest'] = 'oogsten', + ['harvest_menu'] = 'druk op ~INPUT_CONTEXT~ om in het oogst menu te komen.', + ['not_experienced_enough'] = 'je hebt ~r~niet genoeg ervaring~s~ om dit te doen.', + ['gas_can'] = 'jerrycan', + ['repair_tools'] = 'reparatie gereedschap', + ['body_work_tools'] = 'plaatwerk gereedschap', + ['blowtorch'] = 'gasbrannder', + ['repair_kit'] = 'reparatie set', + ['body_kit'] = 'plaatwerk set', + ['craft'] = 'maaken', + ['craft_menu'] = 'druk op ~INPUT_CONTEXT~ om in het maak menu te komen.', + ['billing'] = 'facturen', + ['hijack'] = 'openbreken', + ['repair'] = 'repareer', + ['clean'] = 'maak schoon', + ['imp_veh'] = 'inbeslag nemen', + ['place_objects'] = 'plaats objecten', + ['invoice_amount'] = 'factuur bedrag', + ['amount_invalid'] = 'ongeldig aantal', + ['no_players_nearby'] = 'er is geen speler in de buurt', + ['no_vehicle_nearby'] = 'er is geen voertuig in de buurt', + ['inside_vehicle'] = 'je kan dit niet doen in een voertuig!', + ['vehicle_unlocked'] = 'het voortuig is ~g~opengebroken', + ['vehicle_repaired'] = 'het voortuig is ~g~gerepareerd', + ['vehicle_cleaned'] = 'het voortuig is ~g~schoongemaakt', + ['vehicle_impounded'] = 'het voortuig is ~r~in beslag genomen', + ['must_seat_driver'] = 'je moet in de bestuurders stoel zitten', + ['must_near'] = 'je moet ~r~dicht bij een voertuig zijn~s~ om hem in beslag te nemen.', + ['vehicle_success_attached'] = 'voertuig succesvol ~b~vastgemaakt~s~', + ['please_drop_off'] = 'graag voertuig naar de garage brengen', + ['cant_attach_own_tt'] = '~r~je kan niet~s~ je eigen wagen vast maken', + ['no_veh_att'] = 'er zijn geen ~r~voertuigen~s~ om vast te maken', + ['not_right_veh'] = 'dit is niet het juiste voertuig', + ['veh_det_succ'] = 'voertuig succesvol ~b~losgekoppeld~s~!', + ['imp_flatbed'] = '~r~Actie onmogelijk!~s~ je moet een ~b~oprijwagen~s~ nodig om deze te laden', + ['objects'] = 'objecten', + ['roadcone'] = 'pion', + ['toolbox'] = 'gereedschaps kist', + ['mechanic_stock'] = 'monteurs opslag', + ['quantity'] = 'hoeveelheid', + ['invalid_quantity'] = 'ongeldige hoeveelheid', + ['inventory'] = 'inventaris', + ['veh_unlocked'] = '~g~Voertuig opgengemaakt', + ['hijack_failed'] = '~r~Openbreken mislukt', + ['body_repaired'] = '~g~Plaatwerk gerepareerd', + ['veh_repaired'] = '~g~Voertuig gerepareerd', + ['veh_stored'] = 'Druk op ~INPUT_CONTEXT~ om voertuig op te slaan.', + ['press_remove_obj'] = 'Druk op ~INPUT_CONTEXT~ om object weg te halen', + ['please_tow'] = 'graag voertuig ~y~afslepen~s~', + ['wait_five'] = 'je moet 5 minuten ~r~wachten~s~', + ['must_in_flatbed'] = 'je bent een oprijwagen nodig voor deze klant', + ['mechanic_customer'] = 'klant van garage', + ['you_do_not_room'] = '~r~Je hebt geen ruimte', + ['recovery_gas_can'] = '~b~Jerrycan~s~ Ophalen...', + ['recovery_repair_tools'] = '~b~Reparatie gereedschap~s~ Ophalen...', + ['recovery_body_tools'] = '~b~Plaatwerk gereedschap~s~ Ophalen...', + ['not_enough_gas_can'] = 'je hebt ~r~niet genoeg~s~ jerrycans.', + ['assembling_blowtorch'] = 'In elkaar aan het zetten ~b~gasbrannder~s~...', + ['not_enough_repair_tools'] = 'je hebt ~r~niet genoeg~s~ reparatie gereedschap.', + ['assembling_repair_kit'] = 'In elkaar aan het zetten ~b~reparatie set~s~...', + ['not_enough_body_tools'] = 'je hebt ~r~niet genoeg~s~ plaatwerk gereedschap.', + ['assembling_body_kit'] = 'In elkaar aan het zetten ~b~plaatwerk set~s~...', + ['your_comp_earned'] = 'de garage heeft ~g~verdient~s~ ~g~€', + ['you_used_blowtorch'] = 'je gebruikte een ~b~gasbrannder', + ['you_used_repair_kit'] = 'je gebruikte een ~b~reparatie set', + ['you_used_body_kit'] = 'je gebruikte een ~b~plaatwerk set', + ['have_withdrawn'] = 'je hebt opgenomen ~y~x%s~s~ ~b~%s~s~', + ['have_deposited'] = 'je hebt gestort ~y~x%s~s~ ~b~%s~s~', + ['player_cannot_hold'] = 'je hebt ~r~niet~s~ genoeg ~y~vrije ruimte~s~ in je inventaris!', +} From 1f235378ef1991d6915a76889466a81c1819d3d3 Mon Sep 17 00:00:00 2001 From: NebelRebell <40825041+NebelRebell@users.noreply.github.com> Date: Sun, 19 Jan 2020 16:09:11 +0100 Subject: [PATCH 57/66] Update (#45) dependencies { 'es_extended', 'esx_society', 'esx_billing' } --- __resource.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/__resource.lua b/__resource.lua index b2829826..06605d69 100644 --- a/__resource.lua +++ b/__resource.lua @@ -29,3 +29,9 @@ server_scripts { 'config.lua', 'server/main.lua' } + +dependencies { + 'es_extended', + 'esx_society', + 'esx_billing' +} From cfcc2cc3d7529d000b0a4b4bad47f8dcab08deec Mon Sep 17 00:00:00 2001 From: rex2630 Date: Sun, 19 Jan 2020 16:56:22 +0100 Subject: [PATCH 58/66] Replace __resource.lua with fxmanifest.lua --- __resource.lua => fxmanifest.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) rename __resource.lua => fxmanifest.lua (89%) diff --git a/__resource.lua b/fxmanifest.lua similarity index 89% rename from __resource.lua rename to fxmanifest.lua index 06605d69..8267d7a1 100644 --- a/__resource.lua +++ b/fxmanifest.lua @@ -1,4 +1,6 @@ -resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' +fx_version 'adamant' + +game 'gta5' description 'ESX Mechanic Job' From 95db17d3db78393a09eaa574ecd70798314c0e96 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 14 Apr 2020 16:50:50 +0200 Subject: [PATCH 59/66] Latest ESX code --- LICENSE | 2 +- README.md | 2 +- client/main.lua | 2 +- esx_mechanicjob.sql | 2 +- localization/en_esx_mecanojob.sql | 2 +- localization/fi_esx_mecanojob.sql | 2 +- localization/pl_esx_mecanojob.sql | 2 +- localization/sv_esx_mecanojob.sql | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/LICENSE b/LICENSE index 0dcf1e8c..ae135391 100644 --- a/LICENSE +++ b/LICENSE @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - esx_mechanicjob Copyright (C) 2015-2019 Jérémie N'gadi + esx_mechanicjob Copyright (C) 2015-2020 Jérémie N'gadi This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/README.md b/README.md index 0a90b8a0..aedf558f 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ start esx_mechanicjob ### License esx_mechanicjob - mechanic job for ESX -Copyright (C) 2015-2019 Jérémie N'gadi +Copyright (C) 2015-2020 Jérémie N'gadi This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version. diff --git a/client/main.lua b/client/main.lua index 08c482ba..09969439 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1000,6 +1000,6 @@ AddEventHandler('esx:onPlayerDeath', function(data) isDead = true end) -AddEventHandler('playerSpawned', function(spawn) +AddEventHandler('esx:onPlayerSpawn', function(spawn) isDead = false end) diff --git a/esx_mechanicjob.sql b/esx_mechanicjob.sql index 651cab5e..851224e1 100644 --- a/esx_mechanicjob.sql +++ b/esx_mechanicjob.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `addon_account` (name, label, shared) VALUES ('society_mechanic', 'Mécano', 1) diff --git a/localization/en_esx_mecanojob.sql b/localization/en_esx_mecanojob.sql index 038e2bf6..f82afcc8 100644 --- a/localization/en_esx_mecanojob.sql +++ b/localization/en_esx_mecanojob.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `addon_account` (name, label, shared) VALUES ('society_mechanic', 'Mechanic', 1) diff --git a/localization/fi_esx_mecanojob.sql b/localization/fi_esx_mecanojob.sql index c3dadaa5..3b8182ed 100644 --- a/localization/fi_esx_mecanojob.sql +++ b/localization/fi_esx_mecanojob.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `addon_account` (name, label, shared) VALUES ('society_mechanic', 'Mekaanikko', 1) diff --git a/localization/pl_esx_mecanojob.sql b/localization/pl_esx_mecanojob.sql index b741fb45..879cb8cd 100644 --- a/localization/pl_esx_mecanojob.sql +++ b/localization/pl_esx_mecanojob.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `addon_account` (name, label, shared) VALUES ('society_mechanic', 'Mechanik', 1) diff --git a/localization/sv_esx_mecanojob.sql b/localization/sv_esx_mecanojob.sql index 181d3ad7..be05162d 100644 --- a/localization/sv_esx_mecanojob.sql +++ b/localization/sv_esx_mecanojob.sql @@ -1,4 +1,4 @@ -USE `essentialmode`; +USE `es_extended`; INSERT INTO `addon_account` (name, label, shared) VALUES ('society_mechanic', 'Mekaniker', 1) From 8f2a8719f165626330388996f1badc93a8a0f537 Mon Sep 17 00:00:00 2001 From: Oldarorn <36448848+Oldarorn@users.noreply.github.com> Date: Fri, 3 Jul 2020 18:46:39 +0200 Subject: [PATCH 60/66] Update fr.lua (#79) Merging, fixing typos all over the french locale. --- locales/fr.lua | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/locales/fr.lua b/locales/fr.lua index 72206bac..8ef7b414 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -2,15 +2,15 @@ Locales['fr'] = { ['mechanic'] = 'mecano', ['drive_to_indicated'] = '~y~Conduisez~s~ jusqu\'à l\'endroit indiqué', ['mission_canceled'] = 'Mission ~r~annulée~s~', - ['vehicle_list'] = 'sortir Véhicule', + ['vehicle_list'] = 'sortir véhicule', ['work_wear'] = 'tenue de travail', ['civ_wear'] = 'Tenue civile', ['deposit_stock'] = 'Déposer Stock', ['withdraw_stock'] = 'Prendre Stock', - ['boss_actions'] = 'action Patron', + ['boss_actions'] = 'action patron', ['service_vehicle'] = 'Véhicule de service', ['flat_bed'] = 'plateau', - ['tow_truck'] = 'dépaneuse', + ['tow_truck'] = 'dépanneuse', ['service_full'] = 'service complet : ', ['open_actions'] = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu.', ['harvest'] = 'récolte', @@ -18,10 +18,10 @@ Locales['fr'] = { ['not_experienced_enough'] = 'Vous n\'êtes ~r~pas assez expérimenté~s~ pour effectuer cette action.', ['gas_can'] = 'Bouteille de gaz', ['repair_tools'] = 'Outils réparation', - ['body_work_tools'] = 'Outils Carosserie', + ['body_work_tools'] = 'Outils carosserie', ['blowtorch'] = 'chalumeaux', - ['repair_kit'] = 'kit Réparation', - ['body_kit'] = 'kit Carosserie', + ['repair_kit'] = 'kit réparation', + ['body_kit'] = 'kit carosserie', ['craft'] = 'établi', ['craft_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder au menu établi.', ['billing'] = 'facturation', @@ -35,9 +35,9 @@ Locales['fr'] = { ['no_players_nearby'] = 'aucun joueur à proximité', ['no_vehicle_nearby'] = 'aucun véhicule à proximité', ['inside_vehicle'] = 'vous ne pouvez pas effectuer cette action depuis un véhicule!', - ['vehicle_unlocked'] = 'véhicule ~g~déverouillé', + ['vehicle_unlocked'] = 'véhicule ~g~déverrouillé', ['vehicle_repaired'] = 'véhicule ~g~réparé', - ['vehicle_cleaned'] = 'véhicule ~g~néttoyé', + ['vehicle_cleaned'] = 'véhicule ~g~nettoyé', ['vehicle_impounded'] = 'vehicule ~r~mis en fourrière', ['must_seat_driver'] = 'vous devez être assis du ~r~côté conducteur!', ['must_near'] = 'vous devez être ~r~près d\'un véhicule~s~ pour le mettre en fourrière', @@ -46,7 +46,7 @@ Locales['fr'] = { ['cant_attach_own_tt'] = '~r~Impossible~s~ d\'attacher votre propre dépanneuse', ['no_veh_att'] = 'il n\'y a ~r~pas de véhicule~s~ à attacher', ['not_right_veh'] = 'ce n\'est pas le bon véhicule', - ['veh_det_succ'] = 'vehicule ~b~détattaché~s~ avec succès!', + ['veh_det_succ'] = 'vehicule ~b~détaché~s~ avec succès!', ['imp_flatbed'] = '~r~Impossible! ~s~Vous devez avoir un ~b~Flatbed ~s~pour ça', ['objects'] = 'objets', ['roadcone'] = 'plot', @@ -60,7 +60,7 @@ Locales['fr'] = { ['body_repaired'] = '~g~Carosserie réparée', ['veh_repaired'] = '~g~Véhicule réparé', ['veh_stored'] = 'appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule.', - ['press_remove_obj'] = 'appuyez sur ~INPUT_CONTEXT~ pour enlever l\'object', + ['press_remove_obj'] = 'appuyez sur ~INPUT_CONTEXT~ pour enlever l\'objet', ['please_tow'] = 'veuillez ~y~remorquer~s~ le véhicule', ['wait_five'] = 'Vous devez ~r~attendre~s~ 5 minutes', ['must_in_flatbed'] = 'Vous devez être en flatbed pour commencer la mission', @@ -68,18 +68,18 @@ Locales['fr'] = { ['mechanic_customer'] = 'client mecano', ['you_do_not_room'] = '~r~Vous n\'avez plus de place', ['recovery_gas_can'] = 'Récupération de ~b~bouteille de gaz~s~...', - ['recovery_repair_tools'] = 'Récupération d\'~b~Outils réparation~s~...', - ['recovery_body_tools'] = 'Récupération d\'~b~Outils carosserie~s~...', + ['recovery_repair_tools'] = 'Récupération d\'~b~outils réparation~s~...', + ['recovery_body_tools'] = 'Récupération d\'~b~outils carosserie~s~...', ['not_enough_gas_can'] = 'Vous n\'avez ~r~pas assez~s~ de bouteille de gaz', - ['assembling_blowtorch'] = 'Assemblage de ~b~Chalumeaux~s~...', + ['assembling_blowtorch'] = 'Assemblage de ~b~chalumeaux~s~...', ['not_enough_repair_tools'] = 'Vous n\'avez ~r~pas assez~s~ d\'outils réparation', - ['assembling_blowtorch'] = 'Assemblage de ~b~Kit réparation~s~...', + ['assembling_blowtorch'] = 'Assemblage de ~b~kit réparation~s~...', ['not_enough_body_tools'] = 'Vous n\'avez ~r~pas assez~s~ d\'outils carosserie', ['assembling_body_kit'] = 'Assemblage de ~b~kit carosserie~s~...', ['your_comp_earned'] = 'Votre société a ~g~gagné~s~ ~g~$', - ['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_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', ['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'] = 'vous n\'avez ~r~pas assez~s~ d\'~y~espace libre~s~ dans votre inventaire!', From 661476f47eac380030fa6f714258eb3411ced137 Mon Sep 17 00:00:00 2001 From: Tinky <48660658+Tinky124@users.noreply.github.com> Date: Fri, 3 Jul 2020 18:49:41 +0200 Subject: [PATCH 61/66] Minor update (#77) Merging, cleaning code. --- client/main.lua | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/client/main.lua b/client/main.lua index 09969439..8440dd87 100644 --- a/client/main.lua +++ b/client/main.lua @@ -3,7 +3,6 @@ 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 - ESX = nil Citizen.CreateThread(function() @@ -33,7 +32,7 @@ function StartNPCJob() NPCOnJob = true NPCTargetTowableZone = SelectRandomTowable() - local zone = Config.Zones[NPCTargetTowableZone] + local zone = Config.Zones[NPCTargetTowableZone] Blips['NPCTargetTowableZone'] = AddBlipForCoord(zone.Pos.x, zone.Pos.y, zone.Pos.z) SetBlipRoute(Blips['NPCTargetTowableZone'], true) @@ -54,10 +53,10 @@ function StopNPCJob(cancel) Config.Zones.VehicleDelivery.Type = -1 - NPCOnJob = false - NPCTargetTowable = nil - NPCTargetTowableZone = nil - NPCHasSpawnedTowable = false + NPCOnJob = false + NPCTargetTowable = nil + NPCTargetTowableZone = nil + NPCHasSpawnedTowable = false NPCHasBeenNextToTowable = false if cancel then @@ -305,8 +304,8 @@ function OpenMobileMechanicActionsMenu() end) elseif data.current.value == 'hijack_vehicle' then local playerPed = PlayerPedId() - local vehicle = ESX.Game.GetVehicleInDirection() - local coords = GetEntityCoords(playerPed) + local vehicle = ESX.Game.GetVehicleInDirection() + local coords = GetEntityCoords(playerPed) if IsPedSittingInAnyVehicle(playerPed) then ESX.ShowNotification(_U('inside_vehicle')) @@ -601,7 +600,7 @@ end RegisterNetEvent('esx_mechanicjob:onHijack') AddEventHandler('esx_mechanicjob:onHijack', function() local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) + local coords = GetEntityCoords(playerPed) if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then local vehicle @@ -642,7 +641,7 @@ end) RegisterNetEvent('esx_mechanicjob:onCarokit') AddEventHandler('esx_mechanicjob:onCarokit', function() local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) + local coords = GetEntityCoords(playerPed) if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then local vehicle @@ -669,7 +668,7 @@ end) RegisterNetEvent('esx_mechanicjob:onFixkit') AddEventHandler('esx_mechanicjob:onFixkit', function() local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) + local coords = GetEntityCoords(playerPed) if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then local vehicle @@ -856,8 +855,8 @@ Citizen.CreateThread(function() if ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic' then - local coords = GetEntityCoords(PlayerPedId()) - local isInMarker = false + local coords = GetEntityCoords(PlayerPedId()) + local isInMarker = false local currentZone = nil for k,v in pairs(Config.Zones) do @@ -892,10 +891,10 @@ Citizen.CreateThread(function() Citizen.Wait(500) local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) + local coords = GetEntityCoords(playerPed) local closestDistance = -1 - local closestEntity = nil + local closestEntity = nil for i=1, #trackedEntities, 1 do local object = GetClosestObjectOfType(coords, 3.0, GetHashKey(trackedEntities[i]), false, false, false) @@ -996,10 +995,5 @@ Citizen.CreateThread(function() end end) -AddEventHandler('esx:onPlayerDeath', function(data) - isDead = true -end) - -AddEventHandler('esx:onPlayerSpawn', function(spawn) - isDead = false -end) +AddEventHandler('esx:onPlayerDeath', function(data) isDead = true end) +AddEventHandler('esx:onPlayerSpawn', function(spawn) isDead = false end) From ce401fef04bd6e233c4433feac0f9ba0c9a4c048 Mon Sep 17 00:00:00 2001 From: BrakingESX247 <67766145+BrakingESX247@users.noreply.github.com> Date: Mon, 20 Jul 2020 14:37:27 +0100 Subject: [PATCH 62/66] Adding datastore for society vehicles. Co-Authored-By: Berkeratay --- esx_mechanicjob.sql | 4 ++++ localization/en_esx_mecanojob.sql | 4 ++++ localization/fi_esx_mecanojob.sql | 4 ++++ localization/pl_esx_mecanojob.sql | 4 ++++ localization/sv_esx_mecanojob.sql | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/esx_mechanicjob.sql b/esx_mechanicjob.sql index 851224e1..b048dd78 100644 --- a/esx_mechanicjob.sql +++ b/esx_mechanicjob.sql @@ -8,6 +8,10 @@ INSERT INTO `addon_inventory` (name, label, shared) VALUES ('society_mechanic', 'Mécano', 1) ; +INSERT INTO `datastore` (name, label, shared) VALUES + ('society_mechanic', 'Mécano', 1) +; + INSERT INTO `jobs` (name, label) VALUES ('mechanic', 'Mécano') ; diff --git a/localization/en_esx_mecanojob.sql b/localization/en_esx_mecanojob.sql index f82afcc8..62012ac8 100644 --- a/localization/en_esx_mecanojob.sql +++ b/localization/en_esx_mecanojob.sql @@ -8,6 +8,10 @@ INSERT INTO `addon_inventory` (name, label, shared) VALUES ('society_mechanic', 'Mechanic', 1) ; +INSERT INTO `datastore` (name, label, shared) VALUES + ('society_mechanic', 'Mechanic', 1) +; + INSERT INTO `jobs` (name, label) VALUES ('mechanic', 'Mechanic') ; diff --git a/localization/fi_esx_mecanojob.sql b/localization/fi_esx_mecanojob.sql index 3b8182ed..0cbf0870 100644 --- a/localization/fi_esx_mecanojob.sql +++ b/localization/fi_esx_mecanojob.sql @@ -8,6 +8,10 @@ INSERT INTO `addon_inventory` (name, label, shared) VALUES ('society_mechanic', 'Mekaanikko', 1) ; +INSERT INTO `datastore` (name, label, shared) VALUES + ('society_mechanic', 'Mekaanikko', 1) +; + INSERT INTO `jobs` (name, label) VALUES ('mechanic', 'Mekaanikko') ; diff --git a/localization/pl_esx_mecanojob.sql b/localization/pl_esx_mecanojob.sql index 879cb8cd..532a5593 100644 --- a/localization/pl_esx_mecanojob.sql +++ b/localization/pl_esx_mecanojob.sql @@ -8,6 +8,10 @@ INSERT INTO `addon_inventory` (name, label, shared) VALUES ('society_mechanic', 'Mechanik', 1) ; +INSERT INTO `datastore` (name, label, shared) VALUES + ('society_mechanic', 'Mechanik', 1) +; + INSERT INTO `jobs` (name, label) VALUES ('mechanic', 'Mechanik') ; diff --git a/localization/sv_esx_mecanojob.sql b/localization/sv_esx_mecanojob.sql index be05162d..ea6554a9 100644 --- a/localization/sv_esx_mecanojob.sql +++ b/localization/sv_esx_mecanojob.sql @@ -8,6 +8,10 @@ INSERT INTO `addon_inventory` (name, label, shared) VALUES ('society_mechanic', 'Mekaniker', 1) ; +INSERT INTO `datastore` (name, label, shared) VALUES + ('society_mechanic', 'Mekaniker', 1) +; + INSERT INTO `jobs` (name, label) VALUES ('mechanic', 'Mekaniker') ; From d46866b40c8b092ca5e9c50f34aa0c0af1d42993 Mon Sep 17 00:00:00 2001 From: BrakingESX247 <67766145+BrakingESX247@users.noreply.github.com> Date: Mon, 20 Jul 2020 14:39:57 +0100 Subject: [PATCH 63/66] Updating config.lua User-friendlier configuration file. --- config.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/config.lua b/config.lua index 9e716a49..6664f5be 100644 --- a/config.lua +++ b/config.lua @@ -1,9 +1,9 @@ Config = {} -Config.Locale = 'fr' +Config.Locale = 'en' -Config.DrawDistance = 100.0 +Config.DrawDistance = 20.0 -- How close you need to be in order for the markers to be drawn (in GTA units). Config.MaxInService = -1 -Config.EnablePlayerManagement = false +Config.EnablePlayerManagement = true -- Enable society managing. Config.EnableSocietyOwnedVehicles = false Config.NPCSpawnDistance = 500.0 @@ -15,7 +15,9 @@ Config.Vehicles = { 'asea', 'asterope', 'banshee', - 'buffalo' + 'buffalo', + 'sultan', + 'baller3' } Config.Zones = { From 9d713689a217a726cd8f3b6a5612ed5b5996e8f7 Mon Sep 17 00:00:00 2001 From: ItsManueh <47420352+ItsManueh@users.noreply.github.com> Date: Mon, 2 Nov 2020 16:28:36 +0100 Subject: [PATCH 64/66] Add es.lua language --- locales/es.lua | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 locales/es.lua diff --git a/locales/es.lua b/locales/es.lua new file mode 100644 index 00000000..0660b01e --- /dev/null +++ b/locales/es.lua @@ -0,0 +1,87 @@ +-- Traducción by: https://github.com/ItsManueh + +Locales['es'] = { + ['mechanic'] = 'Mecánico', + ['drive_to_indicated'] = '~y~Conduce~s~ a la ubicación indicada.', + ['mission_canceled'] = 'Misión ~r~cancelada~s~', + ['vehicle_list'] = 'Lista de vehículos', + ['work_wear'] = 'Ropa de trabajo', + ['civ_wear'] = 'Ropa de civil', + ['deposit_stock'] = 'Depositar stock', + ['withdraw_stock'] = 'Retirar stock', + ['boss_actions'] = 'Acciones del jefe', + ['service_vehicle'] = 'Vehículo de servicio', + ['flat_bed'] = 'Cama plana', + ['tow_truck'] = 'Camión de remolque', + ['service_full'] = 'Servicio completo: ', + ['open_actions'] = 'Presiona ~INPUT_CONTEXT~ para acceder al menú.', + ['harvest'] = 'Cosecha', + ['harvest_menu'] = 'Presiona ~INPUT_CONTEXT~ para acceder al menú de cosecha.', + ['not_experienced_enough'] = 'Usted no ~r~está lo suficientemente experimentado~s~ para realizar esta acción.', + ['gas_can'] = 'Lata de gas', + ['repair_tools'] = 'Herramientas para reparar', + ['body_work_tools'] = 'Herramientas de carrocería', + ['blowtorch'] = 'Soplete', + ['repair_kit'] = 'kit de reparación', + ['body_kit'] = 'kit de carrocería', + ['craft'] = 'Craftear', + ['craft_menu'] = 'Presiona ~INPUT_CONTEXT~ para acceder al menú de crafteo.', + ['billing'] = 'Facturación', + ['hijack'] = 'Secuestrar', + ['repair'] = 'Reparar', + ['clean'] = 'Limpiar', + ['imp_veh'] = 'Confiscar', + ['place_objects'] = 'Colocar objetos', + ['invoice_amount'] = 'Cantidad de factura', + ['amount_invalid'] = 'Cantidad Inválida', + ['no_players_nearby'] = 'No hay un jugador/a cercano', + ['no_vehicle_nearby'] = 'No hay ningún vehículo cercano', + ['inside_vehicle'] = '¡No puedes hacer esto desde el interior del vehículo!', + ['vehicle_unlocked'] = 'El vehículo ha sido ~g~desbloqueado', + ['vehicle_repaired'] = 'El vehículo ha sido ~g~reparado', + ['vehicle_cleaned'] = 'El vehículo ha sido ~g~limpiado', + ['vehicle_impounded'] = 'El vehículo ha sido ~r~incautado', + ['must_seat_driver'] = '¡Debes estar en el asiento del conductor!', + ['must_near'] = 'Usted debe estar ~r~cerca de un vehículo~s~ incautarlo.', + ['vehicle_success_attached'] = 'Vehículo con éxito ~b~adjuntado~s~', + ['please_drop_off'] = 'Por favor, deje el vehículo en el garaje', + ['cant_attach_own_tt'] = '~r~No puedes~s~ adjuntar su propia grúa', + ['no_veh_att'] = 'No hay ~r~vehículo~s~ que se adjunte', + ['not_right_veh'] = 'Este no es el vehículo correcto', + ['veh_det_succ'] = 'Vehículo con éxito ~b~separado~s~!', + ['imp_flatbed'] = '~r~¡Acción imposible!~s~ Necesitas una ~b~Cama plana~s~ para cargar un vehículo', + ['objects'] = 'Objetos', + ['roadcone'] = 'Cono', + ['toolbox'] = 'Caja de herramientas', + ['mechanic_stock'] = 'Stock mecánico', + ['quantity'] = 'Cantidad', + ['invalid_quantity'] = 'Cantidad inválida', + ['inventory'] = 'Inventario', + ['veh_unlocked'] = '~g~Vehículo desbloqueado', + ['hijack_failed'] = '~r~Secuestro fallido', + ['body_repaired'] = '~g~Carrocería reparado', + ['veh_repaired'] = '~g~Vehículo reparado', + ['veh_stored'] = 'Presiona ~INPUT_CONTEXT~ para almacenar el vehículo.', + ['press_remove_obj'] = 'Presiona ~INPUT_CONTEXT~ para quitar el objeto', + ['please_tow'] = 'Por favor ~y~remolca~s~ el vehículo', + ['wait_five'] = 'Debes ~r~esperar~s~ 5 minutos', + ['must_in_flatbed'] = 'Debes estar en una plataforma para ser la misión', + ['mechanic_customer'] = 'Cliente mecánico', + ['you_do_not_room'] = '~r~No tienes mas espacio', + ['recovery_gas_can'] = '~b~Lata de gas~s~ Recuperando...', + ['recovery_repair_tools'] = '~b~Herramientas para reparar~s~ Recuperando...', + ['recovery_body_tools'] = '~b~Herramientas de carrocería~s~ Recuperando...', + ['not_enough_gas_can'] = 'No ~r~tienes suficiente~s~ latas de gas.', + ['assembling_blowtorch'] = 'Montando ~b~Soplete~s~...', + ['not_enough_repair_tools'] = 'No ~r~tienes suficiente~s~ herramientas para reparar.', + ['assembling_repair_kit'] = 'Montando ~b~Kit de reparación~s~...', + ['not_enough_body_tools'] = 'No ~r~tienes suficiente~s~ herramientas de carrocería.', + ['assembling_body_kit'] = 'Montando ~b~Kit de carrocería~s~...', + ['your_comp_earned'] = 'Tu empresa ha ~g~ganado~s~ ~g~$', + ['you_used_blowtorch'] = 'Usaste un ~b~soplete', + ['you_used_repair_kit'] = 'Usaste un ~b~Kit de reparación', + ['you_used_body_kit'] = 'Usaste un ~b~Kit de carrocería', + ['have_withdrawn'] = 'Has retirado ~y~x%s~s~ ~b~%s~s~', + ['have_deposited'] = 'Has depositado ~y~x%s~s~ ~b~%s~s~', + ['player_cannot_hold'] = 'Tu ~r~no~s~ tienes suficiente ~y~espacio suficiente~s~ en tu inventario!', +} From 3efe6744332817df207dfd12fc5ca0950feea009 Mon Sep 17 00:00:00 2001 From: ItsManueh <47420352+ItsManueh@users.noreply.github.com> Date: Mon, 2 Nov 2020 16:29:34 +0100 Subject: [PATCH 65/66] Update fxmanifest.lua add locale/es.lua --- fxmanifest.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fxmanifest.lua b/fxmanifest.lua index 8267d7a1..c391db12 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -9,6 +9,7 @@ version '1.1.0' client_scripts { '@es_extended/locale.lua', 'locales/en.lua', + 'locales/es.lua', 'locales/fi.lua', 'locales/fr.lua', 'locales/br.lua', @@ -22,6 +23,7 @@ client_scripts { server_scripts { '@es_extended/locale.lua', 'locales/en.lua', + 'locales/es.lua', 'locales/fi.lua', 'locales/fr.lua', 'locales/br.lua', From 0655c983938598193a595f1cac1327d6aa2005fd Mon Sep 17 00:00:00 2001 From: HypeLevels <61633775+HypeLevels@users.noreply.github.com> Date: Tue, 1 Dec 2020 18:01:34 +0000 Subject: [PATCH 66/66] Update main.lua Made the blip smaller, was way to big --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index 8440dd87..2e5a50fd 100644 --- a/client/main.lua +++ b/client/main.lua @@ -815,7 +815,7 @@ Citizen.CreateThread(function() SetBlipSprite (blip, 446) SetBlipDisplay(blip, 4) - SetBlipScale (blip, 1.8) + SetBlipScale (blip, 1.0) SetBlipColour (blip, 5) SetBlipAsShortRange(blip, true)