SA-MP Forums Archive
[HELP] My speedometer - 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: [HELP] My speedometer (/showthread.php?tid=68961)



[HELP] My speedometer - Yuval_Baruch - 14.03.2009

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:

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;
thanks for the helpers
yuval.


Re: [HELP] My speedometer - Yuval_Baruch - 15.03.2009

anyone?


Re: [HELP] My speedometer - Narimalla - 15.12.2011

remove the speedometer man and reinstall