I need help
#1

How can I get that the car is on the ground.

There is a function in MTA (isVehicleOnGround), but I didn't find anything like that in SA-MP.

I hope you'll help me.
Reply
#2

Get the highest coordinate for the vehicle position by using MapAndreas, if the current vehicle position equals (maybe use like .5 offset if they're not the same) the MapAndreas Z value, it's on the ground.

pawn Code:
public OnGameModeInit()
{
    MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
}

forward IsVehicleOnGround(vehicleid);
public IsVehicleOnGround(vehicleid)
{
    new Float:vehpos[3];
    if(!GetVehiclePos(vehicleid, vehpos[0], vehpos[1], vehpos[2])) return 0;
    new Float:groundpos;
    MapAndreas_FindAverageZ(vehpos[0], vehpos[1], groundpos);
    if(vehpos[2] >= groundpos && vehpos[2] <= groundpos+0.2) return 1;
    return 1;
}
Reply
#3

Quote:
Originally Posted by SKAzini
View Post
Get the highest coordinate for the vehicle position by using MapAndreas, if the current vehicle position equals (maybe use like .5 offset if they're not the same) the MapAndreas Z value, it's on the ground.
[/pawn]
Thanks.
But is there another way to get it?
Reply
#4

up .
Reply
#5

up .
Reply
#6

If a car isn't on the ground it is falling. So in order to detect that falling movement, you use GetVehicleVelocity. The displacement over the z (up-down) axis, more specifically. For more accurate results you could also mix in GetVehicleRotationQuat. Convert it to Euler and then compare pitch and roll.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)