25.11.2014, 08:01
pawn Код:
stock SetPlayerLookAt(playerid, Float:X, Float:Y)
{
new Float:Px, Float:Py, Float: Pa;
GetPlayerPos(playerid, Px, Py, Pa);
Pa = floatabs(atan((Y-Py)/(X-Px)));
if (X <= Px && Y >= Py) Pa = floatsub(180, Pa);
else if (X < Px && Y < Py) Pa = floatadd(Pa, 180);
else if (X >= Px && Y <= Py) Pa = floatsub(360.0, Pa);
Pa = floatsub(Pa, 90.0);
if (Pa >= 360.0) Pa = floatsub(Pa, 360.0);
SetPlayerFacingAngle(playerid, Pa);
}