21.12.2018, 07:03
Quote:
stock SetPlayerFacingObject(playerid, object) { new Float:Px, Float:Py, Float: Pa; new Float,Float:y,Float:z; GetDynamicObjectPos(object, x, y, z); 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); return SetPlayerFacingAngle(playerid, Pa); } |