How to check if the vehicle is moving back
#1

Like title says but without key_down
Reply
#2

Check where the vehicle is going at (velocity) and compare it with the vehicle's facing angle.
Reply
#3

I dont understand velocity, can you give me example?
Reply
#4

pawn Код:
stock IsVehicleDrivingBackwards(vehicleid)
{
    new Float:Float[3];
    if(GetVehicleVelocity(vehicleid, Float[1], Float[2], Float[0]))
    {
        GetVehicleZAngle(vehicleid, Float[0]);
        if(Float[0] < 90)
        {
            if(Float[1] > 0 && Float[2] < 0) return true;
        }
        else if(Float[0] < 180)
        {
            if(Float[1] > 0 && Float[2] > 0) return true;
        }
        else if(Float[0] < 270)
        {
            if(Float[1] < 0 && Float[2] > 0) return true;
        }
        else if(Float[1] < 0 && Float[2] < 0) return true;
    }
    return false;
}
Credits to Joker
Reply
#5

Mokerr oh nice, thank you, I did not know that such a function exists
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)