19.06.2009, 22:29
pawn Код:
public TestDistance(playerid,giveplayerid,Float:tarx,Float:tary,Float:tarz,Float:radi)
{
if (gdebug >= 3){printf("DEBUG TestDistance()");}
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
//radi = 2.0; //Trigger Radius
GetPlayerPos(giveplayerid, posx, posy, posz);
tempposx = (tarx -oldposx);
tempposy = (tary -oldposy);
tempposz = (tarz -oldposz);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
if (gdebug >= 2){printf("DEBUG TestDistance2()");}
tempposx = (tarx -posx);
tempposy = (tary -posy);
tempposz = (tarz -posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
if (gdebug >= 2){printf("DEBUG TestDistance3()");}
return 1;
}
}
else
{
return 0;
}
return 0;
}