Chat range
#8

thisis what you need just change the 30.0 if want more range you can do it also in /b

EDIT: added /b
pawn Код:
public OnPlayerText(playerid, text[])
{
    if (realchat)
    {
        if (IsDead[playerid] == 1)
        {
            SCM(playerid,-1,"You can't do that this time");
        }
        else
        {
            new string[128];
            format(string, sizeof(string), "%s says: %s", GetName(playerid), text);
            ProxDetector(30.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
            format(string, sizeof(string), "says: %s", text);
            SetPlayerChatBubble(playerid,string,COLOR_WHITE,5.0,5000);
            ApplyAnimation(playerid,"PED","IDLE_CHAT",2.0,1,0,0,1,1);
        }
        return 0;
    }
    return 1;
}

CMD:b(playerid,params[])
{

    new string[128];
    if(isnull(params)) return SCM(playerid, -1,"USAGE: /b [local ooc]");
    format(string, sizeof(string), "%s: (( %s ))", GetName(playerid), params);
    ProxDetector(30.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
    return 1;
}
added proxdetector function just copy it into your gamemode
pawn Код:
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                new playerworld, player2world;
                playerworld = GetPlayerVirtualWorld(playerid);
                player2world = GetPlayerVirtualWorld(i);
                if(playerworld == player2world)
                {
                    if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                    {
                        SCM(i, col1, string);
                    }
                    else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                    {
                        SCM(i, col2, string);
                    }
                    else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                    {
                        SCM(i, col3, string);
                    }
                    else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
                    {
                        SCM(i, col4, string);
                    }
                    else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                    {
                        SCM(i, col5, string);
                    }
                }
                else
                {
                    SCM(i, col1, string);
                }
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
fixed - by Nines - 30.06.2013, 11:54
Re: Chat range - by Nines - 30.06.2013, 13:00
Re: Chat range - by BlackID - 30.06.2013, 13:06
Re: Chat range - by Twizted - 30.06.2013, 13:17
Re: Chat range - by Nines - 30.06.2013, 13:37
Re: Chat range - by Twizted - 30.06.2013, 14:02
Re: Chat range - by Nines - 30.06.2013, 14:10
Re: Chat range - by drichie - 30.06.2013, 14:15
Re: Chat range - by Nines - 30.06.2013, 14:20
Re: Chat range - by drichie - 30.06.2013, 14:23

Forum Jump:


Users browsing this thread: 1 Guest(s)