19.11.2011, 13:49
how would i check in what direction the vehicle is moving ?
would this work ?
if not please show me a method
pawn Код:
new SaveVelTimer[MAX_PLAYERS];
new Float:VelS[3];
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
SaveVelTimer[playerid] = SetTimerEx("SaveVelocity",500, true, "i", playerid);
return 1;
}
forward SpeedUpdate();
public SpeedUpdate()
{
new Float:Velocity[3];
GetVehicleVelocity(GetPlayerVehicleID(playerid), Velocity[0], Velocity[1], Velocity[2]);
if(Velocity[0] >= VelS[0] && Velocity[1] >= VelS[1])
{
//Moving Forward ?
}else if(Velocity[0] <= VelS[0]&& Velocity[1] <= VelS[1])
{
//Moving Backwords ?
}else if(Velocity[0] == VelS[0]&& Velocity[1] == VelS[1])
{
//Same Pos ?
}
return 1;
}
forward SaveVelocity(playerid);
public SaveVelocity(playerid)
{
GetVehicleVelocity(GetPlayerVehicleID(playerid), VelS[0], VelS[1], VelS[2]);
return 1;
}
if not please show me a method