23.08.2010, 16:32
(
Последний раз редактировалось Nero_3D; 23.08.2010 в 19:41.
)
pawn Код:
public IsPlayerLookAt(playerid, const Float:range,
const Float:x, const Float:y, const Float:z, const Float:max_al, const Float:max_ar)
{
if(IsPlayerInRangeOfPoint(playerid, range, x, y, z))
{
new Float:angle, Float:Pos[3];
GetPlayerFacingAngle(playerid, angle);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
if(Pos[0] > x) angle -= (atan( (Pos[1] - y) / (Pos[0] - x) ) + 90.0);
else angle -= (atan( (Pos[1] - y) / (Pos[0] - x) ) + 270.0);
if(angle < 0) {
if((angle > -max_al) || ((angle + 360.0) < max_ar)) return 1;
} else {
if((angle < max_ar) || ((angle - 360.0) > -mal_al)) return 1;
}
}
return 0;
}