Portal SAMP
[Pedido] Chat Local - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Pedido] Chat Local (/showthread.php?tid=1643)



Chat Local - ivansamp - 18/09/2021

Estou tentando fazer um chat local com as tegs de adm civil e das orgs mais nehuma com execito 
Alguém pode min ajudar? Confused


RE: Chat Local - AlanR - 18/09/2021

Não entendi bem o seu problema, mas isto pode te ajudar:


Citar:
Código:
if(IsPlayerAdmin(playerid))
{
           format(string, sizeof(string), "[ADM]%s(%d) diz: %s", NomePlayer(playerid), playerid,text);
         SendClientMessageInRange(35.0, playerid, string,0xFFAEB9AA,0xFFAEB9AA,0xFFAEB9AA,0xFFAEB9AA,0xFFAEB9AA);
           SetPlayerChatBubble(playerid, text, [color=#333333][size=small][font=Monaco, Consolas, Courier, monospace]0xFFAEB9AA[/font][/size][/color], 35.0, 10000);
}

Code em OnPlayerText.



RE: Chat Local - ivansamp - 18/09/2021

E Um chat local com tegs mn


RE: Chat Local - geek - 18/09/2021

(18/09/2021 08:11)ivansamp Escreveu: E Um chat local com tegs mn
oque seria esse chat local?, seria mensagens apenas para jogadores próximos ao raio do 

Código:
public OnPlayerText(playerid, text[])
{
    new string[150];
    if(PlayerInfo[playerid][pAdmin] == 1)
    {
        format(string, sizeof(string), "%d: [Moderador]%s", playerid, text);
        ProxDetector(30.0, playerid, string, COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE);
        return 0;
    }
    if(PlayerInfo[playerid][pAdmin] == 2)
    {
        format(string, sizeof(string), "%d:Administrador %s", playerid, text);
        ProxDetector(30.0, playerid, string, COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE,COLOR_DBLUE);
        return 0;
    }
    return 1;
}
Código:
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
forward ProxDetectorS(Float:radi, playerid, targetid);
public ProxDetectorS(Float:radi, playerid, targetid)
{
    if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
    {
        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);
        GetPlayerPos(targetid, posx, posy, posz);
        tempposx = (oldposx -posx);
        tempposy = (oldposy -posy);
        tempposz = (oldposz -posz);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}
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);
        //radi = 2.0; //Trigger Radius
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(!BigEar[i])
                {
                    GetPlayerPos(i, posx, posy, posz);
                    tempposx = (oldposx -posx);
                    tempposy = (oldposy -posy);
                    tempposz = (oldposz -posz);
                    //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
                    if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                    {
                        SendClientMessage(i, col1, string);
                    }
                    else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                    {
                        SendClientMessage(i, col2, string);
                    }
                    else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                    {
                        SendClientMessage(i, col3, string);
                    }
                    else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
                    {
                        SendClientMessage(i, col4, string);
                    }
                    else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                    {
                        SendClientMessage(i, col5, string);
                    }
                }
                else
                {
                    SendClientMessage(i, col1, string);
                }
            }
        }
    }//not connected
    return 1;
}



RE: Chat Local - xbruno1000x - 18/09/2021

Creio que o código do Geek te ajude. Para adicionar novas Tag's basta replicar o código de Admin com a variável do cargo desejado.