From 08086be4f7b1dba70b91311abb4a4c1eb2540c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Wed, 16 Aug 2017 20:59:32 +0200 Subject: [PATCH] Fix delete vehicle issue + spawn a little upper --- client/main.lua | 15 +++++++++------ config.lua | 2 ++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/client/main.lua b/client/main.lua index 4a9b9e77..cb4e7f0a 100644 --- a/client/main.lua +++ b/client/main.lua @@ -29,7 +29,7 @@ AddEventHandler('esx_property:hasEnteredMarker', function(name, part, parking) local spawnCoords = { x = garage.InteriorSpawnPoint.Pos.x, y = garage.InteriorSpawnPoint.Pos.y, - z = garage.InteriorSpawnPoint.Pos.z + z = garage.InteriorSpawnPoint.Pos.z + Config.ZDiff } ESX.Game.DeleteVehicle(vehicle) @@ -217,10 +217,11 @@ AddEventHandler('esx_property:hasEnteredMarker', function(name, part, parking) if part == 'Parking' then - local playerPed = GetPlayerPed(-1) - local garage = Config.Garages[name] + local playerPed = GetPlayerPed(-1) + local garage = Config.Garages[name] + local parkingPos = garage.Parkings[parking].Pos - if IsPedInAnyVehicle(playerPed, false) then + if IsPedInAnyVehicle(playerPed, false) and not IsAnyVehicleNearPoint(parkingPos.x, parkingPos.y, parkingPos.z, 1.0) then local vehicle = GetVehiclePedIsIn(playerPed, false) local vehicleProps = ESX.Game.GetVehicleProperties(vehicle) @@ -237,9 +238,11 @@ AddEventHandler('esx_property:hasExitedMarker', function(name, part, parking) if part == 'Parking' then - local playerPed = GetPlayerPed(-1) + local playerPed = GetPlayerPed(-1) + local garage = Config.Garages[name] + local parkingPos = garage.Parkings[parking].Pos - if IsPedInAnyVehicle(playerPed, false) 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 diff --git a/config.lua b/config.lua index 6cfd1130..f53456ad 100644 --- a/config.lua +++ b/config.lua @@ -5,6 +5,8 @@ Config.MarkerSize = {x = 2.0, y = 2.0, z = 1.0} Config.MarkerColor = {r = 204, g = 204, b = 0} Config.ParkingMarkerSize = {x = 3.0, y = 3.0, z = 2.0} Config.ParkingMarkerColor = {r = 102, g = 102, b = 204} +Config.ZDiff = 0.5 + Config.Locale = 'fr' Config.Zones = {}