How to check is car moving?
#1

Hi,

HOw to check is car moving when there is no players? because with GetVehicleVelocity this is not working...
Reply
#2

Use GetVehiclePos in a repeating 1 second timer and compare the positions to check if the vehicle has moved or not.
Reply
#3

All i found was this
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;
}
It only checks if the vehicle is reversing. Perhaps you could change that code to see if the vehicle is moving forwards.
Reply
#4

nvm...
Reply
#5

I think you're referring to this: OnUnoccupiedVehicleUpdate
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)