14.03.2009, 22:32
hey guys, i got some problem with my speedometer code..
like, im driving a a car, and when i get to its max speed it goest back to 0
and starting again till its max speed and so on.
i wonder in you would be able to help me with this problem, here is my code anyway:
thanks for the helpers ![Smiley](images/smilies/smile.png)
yuval.
like, im driving a a car, and when i get to its max speed it goest back to 0
and starting again till its max speed and so on.
i wonder in you would be able to help me with this problem, here is my code anyway:
pawn Код:
// Speedometer
new Float:distance,value;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[playerid][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[playerid][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[playerid][LastZ])),2));
value = floatround(distance * 11000);
new Speed = floatround(value/2400);
SavePlayerPos[playerid][LastX] = x;
SavePlayerPos[playerid][LastY] = y;
SavePlayerPos[playerid][LastZ] = z;
![Smiley](images/smilies/smile.png)
yuval.