[HELP]Problem speedo gears
#1

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?
Reply
#2

nobody?
Reply
#3

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
}
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)