SA-MP Forums Archive
How does speedometers / Fuel meters work? - 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: How does speedometers / Fuel meters work? (/showthread.php?tid=303061)



How does speedometers / Fuel meters work? - Dokins - 11.12.2011

I've never understood how these things work can someone explain them?


Re: How does speedometers / Fuel meters work? - THE_KNOWN - 11.12.2011

its basically math. you calculate the root of addition of squares of the players curreny x and y velocity.

fuel is nothing but ur reducing the value of a var(fuel) by 1 every few seconds.
if that var is 0 then no fuel


Re: How does speedometers / Fuel meters work? - Dokins - 11.12.2011

Thank you, can you explain the velocity thing?


Re: How does speedometers / Fuel meters work? - §с†¶e®РµРe - 12.12.2011

velocity kinda checks your speed i think


Re: How does speedometers / Fuel meters work? - Rob_Maate - 12.12.2011

velocity is measured on a global x/y/z plane.

Imagine that the entire GTA-SA 3D worldspace was one large 3D grid.
Moving UP the grid (skyward) will increase your Z position, moving DOWN it will DECREASE your Z position.
Heading North via the minimap I'm pretty sure is +Y, South is -Y, east is +X, west is -X (please correct me if I am wrong.)

So Velocity is simply a value that indicates how many squares you move per player update (client) and in what direction.

GetPlayerVelocity will return 3 values, X, Y, Z.

if you are headed north along the road at 1 gridsquare per update, your velocity SHOULD be (again if I am right with my definition of relativity) X=0, Y=1, Z=0

Having two values as 1, say X=1 Y=1, Z=0 would indicate that you are heading North-East at a rate of 1 gridsquare per update.


Re: How does speedometers / Fuel meters work? - THE_KNOWN - 12.12.2011

its the number of X and Y coords your passing through every second with respect to the direction.