Send message for near player
#7

Quote:
Originally Posted by stokdam
Посмотреть сообщение
you checked the distance from the same player you did GetPlayerPos.

pawn Код:
stock SendMessageForNearbyPlayer(playerid, text[])
{
    new Float:posX, Float:posY, Float:posZ;
    GetPlayerPos(playerid, posX, posY, posZ);
    for (new p = 0; p<MAX_PLAYERS; p++)
    {
        if (IsPlayerConnected(p))
        {
            if(IsPlayerInRangeOfPoint(p, 2.0, posX, posY, posZ))
            {
                SendClientMessage(p, 0x3C3C3CFF, text);
                return 1;
            }
            else if(IsPlayerInRangeOfPoint(p, 4.0, posX, posY, posZ))
            {
                SendClientMessage(p, 0x6F6F6FFF, text);
                return 1;
            }
            else if(IsPlayerInRangeOfPoint(p, 6.0, posX, posY, posZ))
            {
                SendClientMessage(p, 0xFFFFFF, text);
                return 1;
            }
        }
    }
return 1;
}
edited: added returns.
You really don't need the returns inside the loop as they will just send the message to the lowest ID and stop there.
Reply


Messages In This Thread
Send message for near player - by Garwan50 - 03.08.2013, 15:49
Re: Send message for near player - by Virtual1ty - 03.08.2013, 16:14
Re : Send message for near player - by Garwan50 - 03.08.2013, 16:40
Re : Send message for near player - by Garwan50 - 03.08.2013, 17:13
Re : Send message for near player - by Garwan50 - 03.08.2013, 19:18
Re: Send message for near player - by stokdam - 03.08.2013, 19:39
Re: Send message for near player - by [KHK]Khalid - 03.08.2013, 19:53
Re : Send message for near player - by Garwan50 - 03.08.2013, 20:47
Re : Send message for near player - by Garwan50 - 04.08.2013, 09:23
Re: Send message for near player - by stokdam - 04.08.2013, 19:02

Forum Jump:


Users browsing this thread: 1 Guest(s)