Detectar jugador mas cercano
#1

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
Reply
#2

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.
Reply
#3

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)