You can detect a player's velocity or package the moveForward function, which looks like this:
function moveForward(%trueIfMovingForward)
That's client-side, I believe he wants server-side
Well here's a server-side ::isMovingForward
It works for vehicles, players, anything that moves I think
function ShapeBase::isMovingForward(%this)
{
%movingVector = %this.getVelocity(); //The direction we're moving
%movingX = getWord(%movingVector,0);
%movingY = getWord(%movingVector,1);
if(!%movingX && !%movingY) //We're not moving at all
return 0;
%forwardVector = %this.getForwardVector(); //The direction we're facing
%forwardX = getWord(%forwardVector,0);
%forwardY = getWord(%forwardVector,1);
%q1 = %movingX/%forwardX;
%q2 = %movingY/%forwardY;
if(mAbs(%q1-%q2) <= 0.01) //If %q1 and %q2 are within 0.01 of each other, to compensate for rounding
return 1;
else
return 0;
}
I was trying to make it so you could pass a perimeter, %angle, and you could move within that many degrees of where you're looking and it would still report true, but I couldn't figure that out.
This current function will report true only if you're moving in the same exact direction your facing
If you want this for that vehicle you made, just add '&& %obj.isMovingForward()' to the if that makes it fly if it passes, and if you want to to stop when you stop moving, I think add ' || !%obj.isMovingForward() ' to the other if