[Include] [INC] Easy Local Chat!
#5

You do not get the radius value using the Float: tag...

pawn Code:
#include <a_samp>
#include <foreach>
stock HexToStr(color)
{
    new colorstr[7];
    for(new i = 5; i >= 0; i--)
    {
        new number = (color&(0xF<<(i*4+8)))>>>(i*4+8);
        switch(number)
        {
            case 0..9: colorstr[5-i] = number+'0';
            case 10..15: colorstr[5-i] = number+'A'-10;
            default: printf("HexToStr: Unknown parameter %d at %d.", number, i);
        }
    }
    return colorstr;
}

stock SendLocalMessage(playerid, color, Float:radius, msg[])
{
    new Float:p_pos[3], p_name[MAX_PLAYER_NAME], chatstr[256], count = 0;
    GetPlayerPos(playerid, p_pos[0], p_pos[1], p_pos[2]);
    GetPlayerName(playerid, p_name, sizeof p_name);
    format(chatstr, sizeof chatstr, "{%s}[%d] %s: {FFFFFF}%s", HexToStr(GetPlayerColor(playerid)), playerid, p_name, msg);
    foreach(Player, toplayerid)
    {
        if(!IsPlayerInRangeOfPoint(toplayerid, radius, p_pos[0], p_pos[1], p_pos[2])) continue;
        SendClientMessage(toplayerid, color, chatstr);
        if(playerid != toplayerid) count++;
    }
    return count;
}
Take a look at this example above.
Reply


Messages In This Thread
[INC] Easy Local Chat! - by goudewup - 30.01.2010, 14:16
Re: [INC] Easy Local Chat! - by goudewup - 30.01.2010, 14:58
Re: [INC] Easy Local Chat! - by NiiRV4N4 - 25.03.2010, 19:56
Re: [INC] Easy Local Chat! - by ChrisMorasco - 11.06.2013, 18:31
AW: [INC] Easy Local Chat! - by BigETI - 11.06.2013, 20:11

Forum Jump:


Users browsing this thread: 1 Guest(s)