SA-MP Forums Archive
[Ajuda] Chat global - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Chat global (/showthread.php?tid=255870)



[Ajuda] Chat global - [RoxX]Ygor - 17.05.2011

Bom como meu servidor tem chat global, eu queria saber como fazer para que enquanto o player nгo logar ao servidor ou seja se ele estiver no RequestClass ele й impedido de ver o Chat Global, alguйm sabe como fazer isso? Obrigado pela compreensгo.


Re: [DЪVIDA] Chat global - [S]trong - 17.05.2011

pawn Код:
new bool:Spawned[MAX_PLAYERS];

public OnPlayerText(playerid,text[])
{
    for (new x; x < MAX_PLAYERS; x ++) {
        if (Spawned[playerid] == true && IsPlayerConnected(x) && Spawned[x] == true) {
            new name[MAX_PLAYER_NAME],Msg[128];
            GetPlayerName(playerid,name,sizeof(name));
            format(Msg,sizeof(Msg),"%s:%s",name,text);
            SendClientMessage(x,-1,Msg);
        }
    }
    return false; //retornar a falso й realmente muito importante neste caso.
}

public OnPlayerSpawn(playerid)
{
    Spawned[playerid] = true;
    return true;
}



Re: [DЪVIDA] Chat global - [RoxX]Ygor - 17.05.2011

Strong vou testar aqui, obrigado eu estava atrбs disso fais muito tempo.


Re: [DЪVIDA] Chat global - Dr_Pawno - 17.05.2011

pawn Код:
new bool:ToNoChatGente[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
    ToNoChatGente[playerid] = false;
    return 1;
}
public OnPlayerText(playerid, text[]);
{
    new string[256], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s[%d]: {FFFFFF}%s", pname, playerid, text);
    SendClientMessageToAllEx(GetPlayerColor(playerid), string);
    return 0;
}
public OnPlayerSpawn(playerid)
{
    if(ToNoChatGente[playerid] == false)
    {
        ToNoChatGente[playerid] = true;
    }
    return 1;
}
stock SendClientMessageToAllEx(color, const message[])
{
    for(new i = 0; i <= MAX_PLAYERS; i++)
    {
        if(ToNoChatGente[i] == true && IsPlayerConnected(i))
        {
            SendClientMessage(i, color, message);
        }
    }
    return 1;
}



Re: [DЪVIDA] Chat global - [S]trong - 17.05.2011

o tуpico jб foi respondido nгo teve a necessidade nenhuma de vocк postar este cуdigo que no final das contas da na mesma meu caro.


Re: [Ajuda] Chat global - [RoxX]Ygor - 17.05.2011

Strong eu usei seu code, tinha um errinho mais eu arrumei, mбs mesmo assim muito obrigado mesmo.