[Ajuda] Team Chat
#1

Desse jeito que eu fiz irб funcionar?
pawn Код:
public OnPlayerText(playerid, text[])
{
if( (text[0] == '#' || text[0] == '@') && strlen(text) > 1)
    {
        new str[128];
        new szPlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

        if(gTeam(playerid) == TEAM_GREEN)
        {
            format(str, 128, "[Green Team Chat]» O jogador %s: %s", szPlayerName, text[1]);

            for(new iPlayerID; iPlayerID < MAX_PLAYERS; iPlayerID++)
            {
                if(!IsPlayerConnected(iPlayerID)) continue;
                if(!gTeam(iPlayerID) == TEAM_GREEN) continue;
                SendClientMessage(iPlayerID, 0x0080C0AA, str);
            }
        }

        return 0;
    }

    return 1;
}
Reply
#2

usas assim:
pawn Код:
public OnPlayerText(playerid, text[])
{
    if( (text[0] == '#' || text[0] == '@') && strlen(text) > 1)
    {
        static str[128];
        new szPlayerName[MAX_PLAYER_NAME];
        if(gTeam(playerid) == TEAM_GREEN)
        {
            format(str, 128, "[Green Team Chat]» O jogador %s: %s", szPlayerName, text[1]);

            for(new iPlayerID; iPlayerID < MAX_PLAYERS; iPlayerID++)
            {
                if(IsPlayerConnected(iPlayerID))
                {
                    if(gTeam[iPlayerID] == TEAM_GREEN)
                    {
                        SendClientMessage(iPlayerID, 0x0080C0AA, str);
                    }
                }
            }
        }

        return 0;
    }

    return 0;
}
continue and break sгo aconselhбveis usar em loop.
Reply
#3

pawn Код:
public OnPlayerText(playerid, text[])
{
    if( (text[0] == '#' || text[0] == '@') && strlen(text) > 1)
    {
        for(new i = 0; i < GetMaxPlayers(); i++)
        {
            if(!gTeam(i) == TEAM_GREEN)
            {
                new str[128],PlayerName[24];
                GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
                format(str,sizeof(str),"[TEAM CHAT] » %s: %s", PlayerName, text[1]);
                SendClientMessage(i, 0x0080C0AA, str);
            }
        }  
    }
    return 1;
}
Tente esse
Reply
#4

Quote:
Originally Posted by TheGarfield
Посмотреть сообщение
usas assim:
pawn Код:
public OnPlayerText(playerid, text[])
{
    if( (text[0] == '#' || text[0] == '@') && strlen(text) > 1)
    {
        static str[128];
        new szPlayerName[MAX_PLAYER_NAME];
        if(gTeam(playerid) == TEAM_GREEN)
        {
            format(str, 128, "[Green Team Chat]» O jogador %s: %s", szPlayerName, text[1]);

            for(new iPlayerID; iPlayerID < MAX_PLAYERS; iPlayerID++)
            {
                if(IsPlayerConnected(iPlayerID))
                {
                    if(gTeam[iPlayerID] == TEAM_GREEN)
                    {
                        SendClientMessage(iPlayerID, 0x0080C0AA, str);
                    }
                }
            }
        }

        return 0;
    }

    return 0;
}
continue and break sгo aconselhбveis usar em loop.
Agora deu esses erros aqui:
pawn Код:
I:\0.3c\0.3c\samp03csvr_win32\gamemodes\rivershell.pwn(426) : error: 012: invalid function call, not a valid address
I:\0.3c\0.3c\samp03csvr_win32\gamemodes\rivershell.pwn(426) : warning: 215: expression has no effect
I:\0.3c\0.3c\samp03csvr_win32\gamemodes\rivershell.pwn(426) : error: 001: expected token: ";", but found ")"
I:\0.3c\0.3c\samp03csvr_win32\gamemodes\rivershell.pwn(426) : error: 029: invalid expression, assumed zero
I:\0.3c\0.3c\samp03csvr_win32\gamemodes\rivershell.pwn(426) : error fatal: 107: too many error messages on one line
Nessa linha:
pawn Код:
if(gTeam(playerid) == TEAM_GREEN)
Reply
#5

o gTeam й uma Stock ou variбvel ?
Reply
#6

pawn Код:
static gTeam[MAX_PLAYERS];
pawn Код:
#define TEAM_GREEN 1
#define TEAM_BLUE 2
--
Como estava sem nada para fazer resolvi dar uma melhorada no Rivershell. Talvez eu poste aqui para download. Para ver a opniгo de vocкs. E qual seria a бrea apropriada para por ele para download?
Reply
#7

Й uma variбvel tenta assim
pawn Код:
public OnPlayerText(playerid, text[])
{
    if( (text[0] == '#' || text[0] == '@') && strlen(text) > 1)
    {
        for(new i = 0; i < GetMaxPlayers(); i++)
        {
            if(gTeam[i] == TEAM_GREEN)
            {
                new str[128],PlayerName[24];
                GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
                format(str,sizeof(str),"[TEAM CHAT] » %s: %s", PlayerName, text[1]);
                SendClientMessage(i, 0x0080C0AA, str);
            }
        }  
    }
    return 1;
}
Reply
#8

Quote:
Originally Posted by feliperch
Посмотреть сообщение
Й uma variбvel tenta assim
pawn Код:
public OnPlayerText(playerid, text[])
{
    if( (text[0] == '#' || text[0] == '@') && strlen(text) > 1)
    {
        for(new i = 0; i < GetMaxPlayers(); i++)
        {
            if(gTeam[i] == TEAM_GREEN)
            {
                new str[128],PlayerName[24];
                GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
                format(str,sizeof(str),"[TEAM CHAT] » %s: %s", PlayerName, text[1]);
                SendClientMessage(i, 0x0080C0AA, str);
            }
        }  
    }
    return 1;
}
Compilou certinho. Obrigado. E Garfild, qual seria a melhor бrea para postar o download do Rivershell que eu estou melhorando?
Reply
#9

Quote:
Originally Posted by Wendell_.
Посмотреть сообщение
Compilou certinho. Obrigado. E Garfild, qual seria a melhor бrea para postar o download do Rivershell que eu estou melhorando?
Postagens/Projetos: http://forum.sa-mp.com/forumdisplay.php?f=56
xD


ah o cуdigo assima manda a mensagen para 500 players e tambйm repete 2 vs no xat xD
Reply
#10

Poste em http://forum.sa-mp.com/forumdisplay.php?f=56
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)