05.06.2010, 22:55
well you can check if there are any cars in the 100m circle in 50m front of the player and he should be looking at them
these might be handy
and
these might be handy
pawn Код:
stock Float:GetPosInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance){
new Float:a;
GetPlayerPos(playerid, x, y, a);
if (IsPlayerInAnyVehicle(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
else GetPlayerFacingAngle(playerid, a);
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
return a;
}
pawn Код:
stock GetStartDirection(Float:angle) { // by Noobanatior
new direction[16];
if (angle > 22.5 && angle <= 67.5) direction = "North East";
else if (angle > 67.5 && angle <= 112.5) direction = "East";
else if (angle > 112.5 && angle <= 157.5) direction = "South East";
else if (angle > 157.5 && angle <= 202.5) direction = "South";
else if (angle > 202.5 && angle <= 247.5) direction = "South West";
else if (angle > 247.5 && angle <= 292.5) direction = "West";
else if (angle > 247.5 && angle <= 337.5) direction = "North West";
else direction = "North";
return direction;
}