I managed to solve my mistakes, but thanks for this incredible script. Jager_Bom
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
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
here sample code
bodyHealth = GetVehicleBodyHealth(vehicle),
engineHealth = GetVehicleEngineHealth(vehicle),
fuelLevel = GetVehicleFuelLevel(vehicle),
and do the same for setvehicleâŠ
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
did you read what i said ? you just need to put 6 lines in es_extended then all those lines in garage script
Ho OK sorry , i didnât undersand what you had say I will try it tomorow <3
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
donât understand
type if you have 2 players inside the vehicle when the person is going to save it to double
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
show me your table owned vehicles ?
looks ok, did you get any errors on serversided ? clientsided ? do you use esx_jb_stopvehicledespawn?
No, Iâll take a look now
this happens when you have 2 players at the time of storing the vehicle and you do not be a driver
this has been fixed in latest release
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
how to put away the damaged vehicle
For me itâs automaticly with set vehicle properties because I did change es extended