Fuel system - 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: Fuel system (
/showthread.php?tid=489255)
Fuel system -
denmark - 21.01.2014
Hello!
For my trucking server I got a fuel system, atm it uses a timer.
But.. I want it to do so for every, lets say 2 kilometer, driven it goes down by some %.
Any of you guys know how to do this?
Thanks.
Re: Fuel system -
Brandon_More - 21.01.2014
It's unrealistic. Fuel IRL goes down if the engine is on and not moving. I would recommend you keeping it the way it is.
Re: Fuel system -
denmark - 21.01.2014
Well thanks for the recommendation, but I would still like it to go down per km.
Re: Fuel system -
denmark - 22.01.2014
Any ideas guys?
Re: Fuel system -
Hansrutger - 22.01.2014
https://sampwiki.blast.hk/wiki/GetVehicleVelocity returns a vector in the third room. Use this combined with Pythagorus to calculate the length of the vector. If you have that, you know how long the player has been traveling. The velocity function however is very tricky and I hate the fact that I still cannot fully understand it but I never got the answers off it so therefore I cannot fully explain to you.
For instance I asked what it actually gives you but I never got any answers, it gives you a vector but in-between what interval? ^^
Re: Fuel system -
denmark - 23.01.2014
Thanks! I'll try to figure it out, and if i understand the velocity function, I'll get back to you and help you with it!