23.08.2010, 14:57
I want get if player look at house entrance
here is what I done so far, haven't tested yet.
here is what I done so far, haven't tested yet.
pawn Код:
public IsPlayerLookAt(playerid,Float:range,Float:x,Float:y,Float:z)
{
if(IsPlayerInRangeOfPoint(playerid,range,x,y,z))
{
new Float:Face,Float:FaceX,Float:FaceY,Float:FaceZ;
GetPlayerPos(playerid,FaceX,FaceY,FaceZ);
GetPlayerFacingAngle(playerid,Face);
if(FaceX > 0 && FaceY > 0) { if(Face > -1 && Face < 91) { return 1; } }
if(FaceX < 0 && FaceY > 0) { if(Face > 89 && Face < 181) { return 1; } }
if(FaceX < 0 && FaceY < 0) { if(Face > 179 && Face < 271) { return 1; } }
if(FaceX > 0 && FaceY < 0) { if(Face > 269 && Face < -1) { return 1; } }
}
return 0;
}