18.09.2009, 04:42
pawn Код:
stock IsPlayerClose(playerid, Float:radi)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
new Float:otherx, Float:othery, Float:otherz;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
GetPlayerPos(i, otherx, othery, otherz);
tempposx = (oldposx -otherx);
tempposy = (oldposy -othery);
tempposz = (oldposz -otherz);
if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
}
return 0;
}