[RE-RELEASE] esx_eden garage

garage
esx

#171

One of my players reported me a dupe bug I ll fix it on GitHub


#172

I managed to solve my mistakes, but thanks for this incredible script. Jager_Bom


#173

Can you help me ? i just try to spawn vehicule with the same health when we stock it i have wrote this code

server side :

RegisterServerEvent('eden_garage:gethealth')
AddEventHandler('eden_garage:gethealth', function(vehicleProps)
	local vehprop = json.encode(vehicleProps)
	local plate = vehicleProps.plate
	local vie2 = {}
	MySQL.Async.fetchAll("SELECT * FROM owned_vehicles WHERE plate=@plate",{['@plate'] = plate,}, function(data)
	for _,v in pairs(data) do
	vie2 = json.decode(v.health2)
	TriggerClientEvent('eden_garage:gethealthtutur',to_string(vie2))
	print(to_string(vie2))
	
	end
end)

end)

client side :

RegisterNetEvent("eden_garage:gethealthtutur")
AddEventHandler("eden_garage:gethealthtutur", function(vie)
	vie2 = vie
end)

i have the fonction who stock the health in the database in fiel health2 it work good but it seem that the server never trigger the client code gethealthtutur, serverside i can have print the health it work !)
could you try to help me ?

function SpawnVehicle(vehicle)
	
	ESX.Game.SpawnVehicle(vehicle.model,{
		x=this_Garage.SpawnPoint.Pos.x ,
		y=this_Garage.SpawnPoint.Pos.y,
		z=this_Garage.SpawnPoint.Pos.z + 1											
		},this_Garage.SpawnPoint.Heading, function(callback_vehicle)
		ESX.Game.SetVehicleProperties(callback_vehicle, vehicle)
		SetVehRadioStation(callback_vehicle, "OFF")
		TaskWarpPedIntoVehicle(GetPlayerPed(-1), callback_vehicle, -1)
		local playerPed = GetPlayerPed(-1)
		local vehiclespawnee = GetVehiclePedIsIn(playerPed, false)
		TriggerServerEvent('eden_garage:gethealth',vehicle)
		SetVehicleEngineHealth(vehiclespawnee, vie2)
		TriggerEvent('esx_key:getVehiclesKey',vehicle.plate)
		AddVehicleKeys(callback_vehicle, vehicle)
		end)
		

	TriggerServerEvent('eden_garage:modifystate', vehicle, false)

end

and i just try to spawn with this


#174

lol you are making youself the hard way to do it, look in es_extended client/functions.lua. over ther eyou will seeh vehicle properties. add get and set healt and nothing else to do :slight_smile:

here sample code

    bodyHealth      = GetVehicleBodyHealth(vehicle),
    engineHealth    = GetVehicleEngineHealth(vehicle),
    fuelLevel    	= GetVehicleFuelLevel(vehicle),

and do the same for setvehicle…


#175

my problem is that my server script dont run the part in the client script

RegisterNetEvent("eden_garage:gethealthtutur")
AddEventHandler("eden_garage:gethealthtutur", function(vie)
	vie2 = vie
end)

so i can’t set vie2 in the

SetVehicleEngineHealth(vehiclespawnee, vie2)

part


#176

did you read what i said ? you just need to put 6 lines in es_extended then all those lines in garage script


#177

Ho OK sorry , i didn’t undersand what you had say I will try it tomorow <3


#178

how to put it for the person by the car in the garage without tar inside the car, because if it is 2 inside the car of to dupar the vehicle


#179

don’t understand


#180

type if you have 2 players inside the vehicle when the person is going to save it to double


#181

If thé person enter the vehicle in garage the car dispawns…
So I still don’t understand your issue.
If you could make a case of it so I can clearly understand hat you did and what you want


#182



if I have another person as the driver of my car I keep the car but it will not disappear.


#183

show me your table owned vehicles ?


#184


#185

looks ok, did you get any errors on serversided ? clientsided ? do you use esx_jb_stopvehicledespawn?


#186

No, I’ll take a look now


#187

this happens when you have 2 players at the time of storing the vehicle and you do not be a driver


#189

this has been fixed in latest release


#190

I tested it yesterday and it’s still doubling when 2 people are in the vehicle at the same time and the owner of the vehicle is not driving


#191

how to put away the damaged vehicle