SA-MP Forums Archive
Hey - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Hey (/showthread.php?tid=244671)



Hey - ElChapoGuzman - 28.03.2011

How to get if player is near player?


Re: Hey - antonio112 - 28.03.2011

Using this:
pawn Код:
stock IsPlayerNearPlayer(playerid, id, Float: distance)
{
    new Float: pos[3];
    GetPlayerPos( id, pos[0], pos[1], pos[2] );
    if(IsPlayerInRangeOfPoint(playerid, distance, pos[0], pos[1], pos[2]))
    {
        if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(id) || GetPlayerInterior(playerid) == GetPlayerInterior(id))
        {
            return 1;
        }
    }
    return 0;
}
And now, all you have to do is using IsPlayerNearPlayer(player1, player2, distance)


Re: Hey - ElChapoGuzman - 28.03.2011

thanks