SetVehicleVelocity question
#1

hey, is there any way that SetVehicleVelocity function will make the car go in straight line?
iv'e tested this function becouse i wanna use it in my script and when i use it the car is not exactly
going in straight line, its jumping to the sides and not going straight.

Here is my part of code that i use, if you got any idea how to make the car go in straight line i will thank you.

pawn Код:
if(newkeys == KEY_VEHICLE_ACCELERATE)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(PlayerSpeed[playerid] > 120)
            {
                new Float:x, Float:y, Float:z, Float:f, vid;

                vid = GetPlayerVehicleID(playerid);

                GetVehicleZAngle(vid,f);
                GetVehicleVelocity(vid,x, y, z);

                if (x >= 0.0) { x += 0.2; }
                else { x -= 0.2; }

                if (y >= 0.0) { y += 0.2; }
                else { y -= 0.2; }

                SetVehicleVelocity(vid, x, y, z);
                SetVehicleZAngle(vid,f);
            }
        }
    }
Reply
#2

....
Reply
#3

Multiply the velocities, don't add them. For an exact speed, use the formula found in GetXYInFrontOfPlayer
Reply
#4

thanks man it works perfectly now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)