From c4d4a46ce0fa34032886bf19c13ed4d7d67309ee Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 29 Jul 2018 15:07:38 +0200 Subject: [PATCH] Minor changes --- client/main.lua | 48 +++++++++++++++++++++--------------------------- config.lua | 18 +++++++++--------- locales/br.lua | 7 +++---- locales/de.lua | 3 +-- locales/en.lua | 7 +++---- locales/fr.lua | 2 +- locales/sv.lua | 7 +++---- server/main.lua | 3 +-- 8 files changed, 42 insertions(+), 53 deletions(-) diff --git a/client/main.lua b/client/main.lua index 811f29ef..8905d391 100644 --- a/client/main.lua +++ b/client/main.lua @@ -14,18 +14,16 @@ TriggerEvent('instance:registerType', 'garage') RegisterNetEvent('instance:onCreate') AddEventHandler('instance:onCreate', function(instance) - if instance.type == 'garage' then TriggerEvent('instance:enter', instance) end - end) AddEventHandler('esx_property:hasEnteredMarker', function(name, part, parking) if part == 'ExteriorEntryPoint' then - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) local garage = Config.Garages[name] @@ -37,7 +35,7 @@ AddEventHandler('esx_property:hasEnteredMarker', function(name, part, parking) local healthPercent = (health / maxHealth) * 100 if healthPercent < Config.MinimumHealthPercent then - ESX.ShowNotification('Vous devez d\'abord réparer votre véhicule') + ESX.ShowNotification(_U('veh_health')) else if GetPedInVehicleSeat(vehicle, -1) == playerPed then @@ -199,7 +197,7 @@ AddEventHandler('esx_property:hasEnteredMarker', function(name, part, parking) if part == 'InteriorExitPoint' then - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) local garage = Config.Garages[name] @@ -221,7 +219,7 @@ AddEventHandler('esx_property:hasEnteredMarker', function(name, part, parking) TriggerEvent('instance:close') ESX.Game.SpawnVehicle(vehicleProps.model, spawnCoords, garage.ExteriorSpawnPoint.Heading, function(vehicle) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) ESX.Game.SetVehicleProperties(vehicle, vehicleProps) end) @@ -230,11 +228,7 @@ AddEventHandler('esx_property:hasEnteredMarker', function(name, part, parking) else - ESX.Game.Teleport(playerPed, { - x = garage.ExteriorSpawnPoint.Pos.x, - y = garage.ExteriorSpawnPoint.Pos.y, - z = garage.ExteriorSpawnPoint.Pos.z - }, function() + ESX.Game.Teleport(playerPed,garage.ExteriorSpawnPoint.Pos.x, function() TriggerEvent('instance:close') end) @@ -254,13 +248,13 @@ AddEventHandler('esx_property:hasEnteredMarker', function(name, part, parking) if part == 'Parking' then - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() local garage = Config.Garages[name] local parkingPos = garage.Parkings[parking].Pos if IsPedInAnyVehicle(playerPed, false) and not IsAnyVehicleNearPoint(parkingPos.x, parkingPos.y, parkingPos.z, 1.0) then - local vehicle = GetVehiclePedIsIn(playerPed, false) + local vehicle = GetVehiclePedIsIn(playerPed, false) local vehicleProps = ESX.Game.GetVehicleProperties(vehicle) TriggerServerEvent('esx_garage:setParking', name, parking, vehicleProps) @@ -279,11 +273,11 @@ AddEventHandler('esx_property:hasExitedMarker', function(name, part, parking) if part == 'Parking' then - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() local garage = Config.Garages[name] local parkingPos = garage.Parkings[parking].Pos - if IsPedInAnyVehicle(playerPed, false) and not IsAnyVehicleNearPoint(parkingPos.x, parkingPos.y, parkingPos.z, 1.0) then + if IsPedInAnyVehicle(playerPed, false) and not IsAnyVehicleNearPoint(parkingPos.x, parkingPos.y, parkingPos.z, 1.0) then TriggerServerEvent('esx_garage:setParking', name, parking, false) end @@ -300,15 +294,15 @@ Citizen.CreateThread(function() local blip = AddBlipForCoord(v.ExteriorEntryPoint.Pos.x, v.ExteriorEntryPoint.Pos.y, v.ExteriorEntryPoint.Pos.z) - SetBlipSprite (blip, 357) - SetBlipDisplay(blip, 4) - SetBlipScale (blip, 1.2) - SetBlipColour (blip, 3) - SetBlipAsShortRange(blip, true) - + SetBlipSprite (blip, 357) + SetBlipDisplay(blip, 4) + SetBlipScale (blip, 1.2) + SetBlipColour (blip, 3) + SetBlipAsShortRange(blip, true) + BeginTextCommandSetBlipName("STRING") - AddTextComponentString("Garage") - EndTextCommandSetBlipName(blip) + AddTextComponentString("Garage") + EndTextCommandSetBlipName(blip) end @@ -320,9 +314,9 @@ end) Citizen.CreateThread(function() while true do - Wait(0) + Citizen.Wait(0) - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) for k,v in pairs(Config.Garages) do @@ -339,7 +333,7 @@ Citizen.CreateThread(function() end - if IsPedInAnyVehicle(playerPed, false) then + if IsPedInAnyVehicle(playerPed, false) then for i=1, #v.Parkings, 1 do @@ -365,7 +359,7 @@ Citizen.CreateThread(function() Wait(0) - local playerPed = GetPlayerPed(-1) + local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) local isInMarker = false local currentGarage = nil diff --git a/config.lua b/config.lua index 15cb02a5..9758563f 100644 --- a/config.lua +++ b/config.lua @@ -42,39 +42,39 @@ Config.Garages = { Pos = {x = 224.500, y = -998.695, z = -100.000}, Heading = 225.0 }, - { + { Pos = {x = 224.500, y = -994.630, z = -100.000}, Heading = 225.0 }, - { + { Pos = {x = 224.500, y = -990.255, z = -100.000}, Heading = 225.0 }, - { + { Pos = {x = 224.500, y = -986.628, z = -100.000}, Heading = 225.0 }, - { + { Pos = {x = 224.500, y = -982.496, z = -100.000}, Heading = 225.0 }, - { + { Pos = {x = 232.500, y = -982.496, z = -100.000}, Heading = 135.0 }, - { + { Pos = {x = 232.500, y = -986.628, z = -100.000}, Heading = 135.0 }, - { + { Pos = {x = 232.500, y = -990.255, z = -100.000}, Heading = 135.0 }, - { + { Pos = {x = 232.500, y = -994.630, z = -100.000}, Heading = 135.0 }, - { + { Pos = {x = 232.500, y = -998.695, z = -100.000}, Heading = 135.0 }, diff --git a/locales/br.lua b/locales/br.lua index 3c7dccc4..a062da61 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -1,6 +1,5 @@ Locales['br'] = { - - ['veh_released'] = 'Veículo ~g~já está disponivel', - ['veh_stored'] = 'Veículo ~g~guardado', - + ['veh_released'] = 'veículo ~g~já está disponivel', + ['veh_stored'] = 'veículo ~g~guardado', + ['veh_health'] = 'you\'ll have to repair the vehicle before storing it.', } diff --git a/locales/de.lua b/locales/de.lua index 929d5eab..a0c3103e 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -1,6 +1,5 @@ Locales['de'] = { - ['veh_released'] = 'Fahrzeug ~g~genommen', ['veh_stored'] = 'vehicle ~g~geparkt', - + ['veh_health'] = 'you\'ll have to repair the vehicle before storing it.', } diff --git a/locales/en.lua b/locales/en.lua index 6c670be0..8e6fa877 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -1,6 +1,5 @@ Locales['en'] = { - - ['veh_released'] = 'vehicle ~g~released', - ['veh_stored'] = 'vehicle ~g~stored', - + ['veh_released'] = 'the vehicle has been ~g~released', + ['veh_stored'] = 'the vehicle has been ~g~stored', + ['veh_health'] = 'you\'ll have to repair the vehicle before storing it.', } diff --git a/locales/fr.lua b/locales/fr.lua index 576dfa41..359f5020 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -2,5 +2,5 @@ Locales['fr'] = { ['veh_released'] = 'véhicule ~g~sorti', ['veh_stored'] = 'véhicule ~g~rangé', - + ['veh_health'] = 'vous devez d\'abord réparer votre véhicule!', } diff --git a/locales/sv.lua b/locales/sv.lua index c2d6dfb4..c6e4955c 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -1,6 +1,5 @@ Locales['sv'] = { - - ['veh_released'] = 'fordon ~g~uthämtat', - ['veh_stored'] = 'fordon ~g~förvarats', - + ['veh_released'] = 'fordonet har ~y~släppts~s~ från ditt garage', + ['veh_stored'] = 'fordonet har ~g~lagrats~s~ i ditt garage', + ['veh_health'] = 'fordonet är i ett dåligt skick för att lämnas i garage.', } diff --git a/server/main.lua b/server/main.lua index 98106e6e..97453643 100644 --- a/server/main.lua +++ b/server/main.lua @@ -39,8 +39,7 @@ AddEventHandler('esx_garage:updateOwnedVehicle', function(vehicleProps) end) ESX.RegisterServerCallback('esx_vehicleshop:getVehiclesInGarage', function(source, cb, garage) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayer = ESX.GetPlayerFromId(source) MySQL.Async.fetchAll('SELECT * FROM `user_parkings` WHERE `identifier` = @identifier AND garage = @garage', {