SA-MP Forums Archive
Car Fuel - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Car Fuel (/showthread.php?tid=579844)



Car Fuel - Ugaustin - 30.06.2015

hi,can someone tell me how can I make so car fuel gets consumed,even when im out of car??


Re: Car Fuel - baba1234 - 30.06.2015

Show your fuel system here so we can se what we are dealing with. There are number of ways to do it.


Re: Car Fuel - Ugaustin - 30.06.2015

my fuel system is big..


Re: Car Fuel - Suicidal.Banana - 30.06.2015

You could make a function that
1] loops trough all cars every few seconds
2] finds the current fuel value of each car (which you should have in some sort of 'car fuel array' already)
3] substract's a bit of fuel from the car (or rather, substract a bit for the current car in the 'car fuel array')
and then your all set bscly.

Finally, just a bit of friendly advice that kinda goes without saying, and you do mention your fuel system is big so there's a fair chance your already doing this, but you should really be subtracting fuel based on distance-traveled & engine-running-time, and maybe even take lights and open doors (= interior light goes on) into account.


Re: Car Fuel - Lynn - 30.06.2015

Loop through the vehicles after X amount of time.
If the vehicle params for engine are ON
Subtract Y amount of fuel from vehicle Z.
if Params are OFF Skip the vehicle and move to the next.


Re: Car Fuel - Ugaustin - 30.06.2015

fixed!