24.10.2010, 22:33
Do not change x or y, this will just move the starting point (player position) a bit. Change a like i explained:
angle=0 : front of the player
angle>0 : degrees to the left side
angle<0 : right side (maybe the other way round, test it)
pawn Код:
forward GetXYInFrontOfPlayer2(playerid, &Float, &Float:y, Float:distance, Float:angle);
public GetXYInFrontOfPlayer2(playerid, &Float, &Float:y, Float:distance, Float:angle) {
new Float:a;
GetPlayerPos(playerid, x, y, a);
GetPlayerFacingAngle(playerid, a);
if (GetPlayerVehicleID(playerid))
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
a += angle;
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}
angle>0 : degrees to the left side
angle<0 : right side (maybe the other way round, test it)