Quote:
Originally Posted by Dr_Pawno
Claro.
pawn Код:
stock IsPlayerInRangeOfPoint2D(playerid, Float:range, Float:x, Float:y) { new Float:posX, Float:posY, Float:posZ; GetPlayerPosition(playerid, posX, posY, posZ); new Float:newX = (posX - x > 0 ? (posX - x) : (x - posX)), Float:newY = (posY - y > 0 ? (posY - y) : (y - posY)); new Float:distance = Floatsqrt((newX * newX) + (newY * newY)); //Pitбgoras bбsico if(distance <= range) return true; return false; }
Obs: Nгo verifiquei o code pois nгo possuo mais SA:MP no meu computador.
No caso do cуdigo acima nгo funcionar, pensei nesta outra maneira (mais lуgica, menos calculo):
pawn Код:
stock IsPlayerInRangeOfPoint2D(playerid, Float:range, Float:x, Float:y) { new Float:posX, Float:posY, Float:posZ; GetPlayerPosition(playerid, posX, posY, posZ); if(IsPlayerInRangeOfPoint(playerid, range, x, y, posZ)) return true; return false; }
|
Vou tentar aqui amigo, jб te dou respostas '-'