18.07.2013, 00:56
How do i modify this function to return the position left, right or behind of me?
I'd like something like this:
From:
EDIT: I made this, going to try it in a sec.
I'd like something like this:
pawn Код:
GetXYInAngleOfPlayer(playerid, &Float:x, &Float:y, Float:angle, Float:distance)
pawn Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x, y, a);
GetPlayerFacingAngle(playerid, a);
if (GetPlayerVehicleID(playerid))
{
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
}
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}
pawn Код:
stock GetXYInAngleOfPos(Float:xpos, Float:ypos, Float:angle, Float:distance, &Float:x, &Float:y)
{
x = xpos + (distance * floatsin(-angle, degrees));
y = ypos + (distance * floatcos(-angle, degrees));
}