SA-MP Forums Archive
[Ajuda] Chat - 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 (/showthread.php?tid=362550)



Chat - denis15711 - 24.07.2012

Eae galera agora todo o server esta vendo o chat das torcidas eu queria q so os menbros da t.o podesem ver o chat alguem me ajuda ae pf cуdigo :
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '!')
    {
        if(PlayerInfo[playerid][pTorcida] == 1)
        {
        new Nome[24], String[128];
        GetPlayerName(playerid, Nome, sizeof(Nome));
        format(String, sizeof(String), "[Chat Gaviхes da Fiel] %s : {FFFFFF}%s", Nome, text[1]);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlayerInfo[i][pTorcida] == 1)
            {
                SendHelperMessage(COLOR_TVP, String);
                return 0;
            }
        }
        }
        if(PlayerInfo[playerid][pTorcida] == 2)
        {
        new Nome[24], String[128];
        GetPlayerName(playerid, Nome, sizeof(Nome));
        format(String, sizeof(String), "[Chat Torcida Coringгo Chopp] %s : {FFFFFF}%s", Nome, text[1]);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlayerInfo[i][pTorcida] == 2)
            {
                SendHelperMessage(COLOR_TVP, String);
                return 0;
                        }

            }
        }
    }
 }
    return 1;
}

public SendHelperMessage(color, string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pTorcida] == 1)
            {
                SendClientMessage(i, COLOR_TVP, string);
                    }
            if(PlayerInfo[i][pTorcida] == 2)
            {
                SendClientMessage(i, COLOR_TVP, string);
            }
        }
    }
    printf("[Chat]%s", string);
}// Esta tipow Chat Global



AW: Chat - billy the kid - 24.07.2012

antes estva funcionando normal ?
se sim nao sei
se nao e tipo um new da torcida ou define nao sei explicar perfeito aguarde os mais experientes ae!


Re: Chat - denis15711 - 24.07.2012

й em static Torcida[MAX_PLAYERS];


Re: Chat - ViniBorn - 24.07.2012

Tenta ai
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '!')
    {
        new Nome[24], String[128];
        GetPlayerName(playerid, Nome, sizeof(Nome));
        if(PlayerInfo[playerid][pTorcida] == 1)
            format(String, sizeof(String), "[Chat Gaviхes da Fiel] %s : {FFFFFF}%s", Nome, text[1]);
        else if(PlayerInfo[playerid][pTorcida] == 2)
            format(String, sizeof(String), "[Chat Torcida Coringгo Chopp] %s : {FFFFFF}%s", Nome, text[1]);

        SendHelperMessage(COLOR_TVP, String);
        return 0;
    }
    return 1;
}

public SendHelperMessage(color, string[])
{
    for(new i, j = GetMaxPlayers(); i != j; i++)
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pTorcida] == 1)
                SendClientMessage(i, COLOR_TVP, string);
            else if(PlayerInfo[i][pTorcida] == 2)
                SendClientMessage(i, COLOR_TVP, string);
        }

    printf("[Chat]%s", string);
}



Re: Chat - leonardo1434 - 24.07.2012

static local й destruнda ao termino de cada chave, uma new local й destruнda ao termino de cada funзгo ou ao termino da chave local.

Tenta mudar para new Torcida[MAX_PLAYERS];


Re: Chat - denis15711 - 24.07.2012

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
Tenta ai
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '!')
    {
        new Nome[24], String[128];
        GetPlayerName(playerid, Nome, sizeof(Nome));
        if(PlayerInfo[playerid][pTorcida] == 1)
            format(String, sizeof(String), "[Chat Gaviхes da Fiel] %s : {FFFFFF}%s", Nome, text[1]);
        else if(PlayerInfo[playerid][pTorcida] == 2)
            format(String, sizeof(String), "[Chat Torcida Coringгo Chopp] %s : {FFFFFF}%s", Nome, text[1]);

        SendHelperMessage(COLOR_TVP, String);
        return 0;
    }
    return 1;
}

public SendHelperMessage(color, string[])
{
    for(new i, j = GetMaxPlayers(); i != j; i++)
        if(IsPlayerConnected(i))
            SendClientMessage(i, COLOR_TVP, string);

    printf("[Chat]%s", string);
}
Sгo 72 TORCIDAS VEY kk postei so estas 2 mals vou testar leonardo


Re: Chat - ViniBorn - 24.07.2012

Adicione o resto ...
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '!')
    {
        new Nome[24], String[128];
        GetPlayerName(playerid, Nome, sizeof(Nome));
        if(PlayerInfo[playerid][pTorcida] == 1)
            format(String, sizeof(String), "[Chat Gaviхes da Fiel] %s : {FFFFFF}%s", Nome, text[1]);
        else if(PlayerInfo[playerid][pTorcida] == 2)
            format(String, sizeof(String), "[Chat Torcida Coringгo Chopp] %s : {FFFFFF}%s", Nome, text[1]);

        SendHelperMessage(playerid, COLOR_TVP, String);
        return 0;
    }
    return 1;
}

public SendHelperMessage(playerid, color, string[])
{
    for(new i, j = GetMaxPlayers(); i != j; i++)
        if(IsPlayerConnected(i))
            if(PlayerInfo[playerid][pTorcida] == PlayerInfo[i][pTorcida])
                SendClientMessage(i, COLOR_TVP, string);

    printf("[Chat]%s", string);
}



Re: Chat - denis15711 - 24.07.2012

Deu certo n vey


Re: Chat - denis15711 - 24.07.2012

Alguem me ajuda ae pff


Re: Chat - Don_Speed - 24.07.2012

Como disse no outro post seu sobre isso
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '!')
    {
        if(PlayerInfo[playerid][pTorcida] == 1)
        {
            new Nome[24], String[128];
            GetPlayerName(playerid, Nome, sizeof(Nome));
            format(String, sizeof(String), "[Chat Gaviхes da Fiel] %s : %s", Nome, text[1]);
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(VarTorcida[i] == Torcida[playerid])
                {
                   SendClientMessage(i, COLOR_TVP, String);
                   return 0;
                }
            }
        }
    }
    return 0;
}