Detectar jugador mas cercano - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (
https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Detectar jugador mas cercano (
/showthread.php?tid=580026)
Detectar jugador mas cercano -
romperson - 01.07.2015
Quisiera saber como detectar al jugador mas cercano
EJEMPLO:
Estoy en una posiciуn y saber cual es el jugador mas cercano desde donde estoy
Respuesta: Detectar jugador mas cercano -
Swedky - 02.07.2015
Creo que hay una funciуn de RyDeRґ o Mauzen que hace eso, se llamaba
GetPlayerNear o algo asн.
EDIT: mira йsto:
http://forum.sa-mp.com/showpost.php?...66&postcount=2.
Respuesta: Detectar jugador mas cercano -
DesingMyCry - 02.07.2015
Feliz navidad. Nunca mas.
pawn Код:
stock obtenerCercano(playerid)
{
new
ultimo = INVALID_PLAYER_ID,
Float:distancia = 6000.0;
for(new player = 0; player < MAX_PLAYERS; player++)
{
if(!IsPlayerConnected(player) || player === playerid) continue;
new
Float:tmp[3],
Float:tmp2;
GetPlayerPos(player, tmp[0], tmp[1], tmp[2]);
tmp2 = GetPlayerDistanceFromPoint(playerid, tmp[0], tmp[1], tmp[2]);
if(tmp2 <= distancia)
ultimo = player;
}
return ultimo;
}