SA-MP Forums Archive
[HELP]Problem speedo gears - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]Problem speedo gears (/showthread.php?tid=132644)



[HELP]Problem speedo gears - sushihusi - 08.03.2010

Hi!!
I have created a speedo with gears,but i have promblems with gear R(reverse).
I have defined if the player's speed is more than 0 and he is pressing KEY_DOWN it writes R in gear.
But this is not correct,because if i driving and i start to brake it writes R because my speed is more than 0 and i am pressing KEY_DOWN.
I can maybe correct it with the angle of the car,no?
Can anybody help me?


Re: [HELP]Problem speedo gears - sushihusi - 09.03.2010

nobody?


Re: [HELP]Problem speedo gears - Miguel - 10.03.2010

pawn Код:
new
  key[3],
  Float:x,
  Float:y,
  Float:z;

GetPlayerKeys(playerid, key[0], key[1], key[2]);
GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z);
if(floatsqroot(x*x, y*y, z*z) < 0 && key[0] == KEY_DOWN)
{
  // reverse
}



Re: [HELP]Problem speedo gears - Joe Staff - 10.03.2010

Quote:
Originally Posted by SAWC™
pawn Код:
(floatsqroot(x*x, y*y, z*z)
That is complete fail, a negative number times itself = a positive number.

You'd have to use angle, try GetXYInFrontOfPlayer and convert that to determine which way the player is facing in comparison to his velocity.