SA-MP Forums Archive
how to get nearest player name - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: how to get nearest player name (/showthread.php?tid=450606)



how to get nearest player name - Semo - 13.07.2013

Hello.

I want to know how to get the nearest cop from me

Cop code:
pawn Код:
copteam[playerid]==1
I just need function to get the nearest cop from me name!

And thanks


Re: how to get nearest player name - -Prodigy- - 13.07.2013

http://forum.sa-mp.com/showpost.php?...50&postcount=2


Re: how to get nearest player name - Semo - 13.07.2013

Well you do as i ordered? i want nearest player from cop team class
copteam[playerid] == 1 // mine


Re: how to get nearest player name - -Prodigy- - 13.07.2013

Have you tried anything so far? If not, go and try it.


Re : how to get nearest player name - Miro96 - 13.07.2013

Код:
stock IsPlayerNearPlayer(playerid, nearplayerid, Float:maxdis)
{
    new Float:pos[6];
    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    GetPlayerPos(nearplayerid, pos[3], pos[4], pos[5]);
    if (pos[0] >= floatsub(pos[3], maxdis) && pos[0] <= floatadd(pos[3], maxdis)
    && pos[1] >= floatsub(pos[4], maxdis) && pos[1] <= floatadd(pos[4], maxdis)
    && pos[2] >= floatsub(pos[5], maxdis) && pos[2] <= floatadd(pos[5], maxdis))
    {
        return 1;
    }
    return 0;
}