[solved]
#1

Hi, like in the subject.. How can I do this?

I tried:
Код:
new
    Float: vX,
    Float: vY,
    Float: vZ
;
GetVehicleVelocity(GetPlayerVehicleID(playerid), vX, vY, vZ);
if(vY < 0) // vehicle is driving backwards
This worked for a part, only in a specified direction..

I don't get the san andreas world


Regards,
Reply
#2

I wanna know this as well.
Reply
#3

Check the angle of the vehicle with the velocity, im guessing if the angle was the opposite way round to the velocity's co-ordinates then it would be in reverse?

Just check using GetVehicleZAngle that the vehicle isn't facing the way it's going.
Reply
#4

pawn Код:
stock bool: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;
}
Not tested but basically it should work (if there isnt any mistake)
Reply
#5

just tested it and it work's man thanks this actually came in very useful to me thank you.
Reply
#6

Quote:
Originally Posted by ♣ Joker ♠
pawn Код:
stock bool: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;
}
Not tested but basically it should work (if there isnt any mistake)
Thanks Joker, it works =)
Reply


Forum Jump:


Users browsing this thread: