Hi BLF, I've been trying to solve this issue and Search didn't help at all. I want to find out if the player is off the ground in their vehicle. The two ways that came to mind were to detect changes in the z axis position/velocity or to get the distance from the ground. I tried the z-axis method, but it gives false-positives if you're scaling a hill (i'm dumb).
function Player::StuntLoop(%player, %lastpos)
{
%car = %player.client.car; //%car is defined, don't worry
%pz = mFloor(getWord(%car.getPosition(), 2));
%z = mFloor(getWord(%lastPos, 2));
if(%pz != %z)
talk("Airborne!" SPC %pz SPC "!=" SPC %z);
// else
// talk("Not Airborne!" SPC %z SPC "==" SPC %pz);
%lastPos = %car.getPosition();
if(isObject(%player))
%player.schedule(500, stuntLoop, %lastpos);
}
I couldn't figure out how to go about the other method. Anyone care to help?
I feel like there is an extremely easy way to do this like it's a default function or something. Badspot did it somehow with the mid-air kill notification. I need to find an efficient way to do it because I'm tracking air-time on vehicles, and to do that I'd need to make it a loop.