how to get nearest player name
#1

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

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

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

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

Код:
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)