Send message for near player
#1

hello,

i want that just nearby player can hear what someone else tell.

My callback OnPlayerText:
pawn Код:
if (PlayerInfo[playerid][pAdmin] == 0)
    {
        new playername[MAX_PLAYER_NAME], str[124];
        GetPlayerName(playerid, playername, sizeof(playername));
        format(str, sizeof(str), "%s [%i] dit: %s", playername, playerid, text);
        SendMessageForNearbyPlayer(playerid, str);
    }
The function SendMessageForNearbyPlayer:
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, posX, posY, posZ))
            {
                SendClientMessage(p, -1, text);
            }
            else if(IsPlayerInRangeOfPoint(p, 4, posX, posY, posZ))
            {
                SendClientMessage(p, 0xFF949494, text);
            }
            else if(IsPlayerInRangeOfPoint(p, 6, posX, posY, posZ))
            {
                SendClientMessage(p, 0xFF373737, text);
            }
        }
    }
}

If the player is at 2 meter, i hear well, if 4, less, and 6, barely none. (white to gray/black)

But in game, the text is only white.

Sorry for my english, i'm french !
Thanks a lot
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: 4 Guest(s)