SA-MP Forums Archive
[AJUDA] 2 mensagens no 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] 2 mensagens no chat (/showthread.php?tid=259089)



[AJUDA] 2 mensagens no chat - Miqueias Barros - 02.06.2011

Seguinte, estou com um gm, dai quando digita no chat samp n mostra o id, dai coloquei pra mostra, pois quando alguem digita agora, mostra a mensagem que tem o id, e a mensagem que n tem o id :S

Ai segue o OnPlayerText:
pawn Код:
public OnPlayerText( playerid, text[ ] )
{
    if ( !playerData[ playerid ][ p_logged_in ] && playerData[ playerid ][ p_registered ] )
        return SendClientMessage( playerid, ERROR_COLOR, "[ERRO] Vocк precisa estб logado para usar o chat!" ), false;

    if ( playerData[ playerid ][ p_muted ] )
        return SendClientMessage( playerid, ERROR_COLOR, "[ERRO] Vocк estб mutado, entгo, nгo pode falar no chat." ), false;

    if ( text[ 0 ] == '!' )
    {
        new teamChat[ 128 ];

        format( teamChat, sizeof( teamChat ), "[TEAM] %s: %s", playerData[ playerid ][ p_name ], text[ 1 ] );

        loopPlayers( otherid )
        {
            if ( playerData[ otherid ][ p_team ] != playerData[ playerid ][ p_team ] )
                continue;

            SendClientMessage( otherid, teamColor[ playerData[ playerid ][ p_team ] ][ 0 ], teamChat );

            PlayerPlaySound( otherid, 1058, 0, 0, 0 );
        }

        return false;
    }

    if ( text[ 0 ] == '#' && playerData[ playerid ][ p_level ] )
    {
        new adminChat[ 128 ];

        format( adminChat, sizeof( adminChat ), "[Chat Admin] %s: %s", playerData[ playerid ][ p_name ], text[ 1 ] );
       
        loopPlayers( otherid )
        {
            if ( !playerData[ otherid ][ p_level ] )
                continue;

            SendClientMessage( otherid, 0x87CEFFFF, adminChat );
        }

        return false;
    }

    if ( serverData[ s_chatlock ] )
        return SendClientMessage( playerid, ERROR_COLOR, "[ERRO] O chat estб trancado, use o team chat." ), false;

        UpperToLower(text);
        new string[256];
        format(string,sizeof(string),"(ID:%d): %s",playerid,text);
        SendPlayerMessageToAll(playerid,string);

    return true;
}
Alguem me ajude..


Re: [AJUDA] 2 mensagens no chat - Shadoww5 - 02.06.2011

Como assim ?

Qual й a mensagem que tem o ID e qual a que nгo tem ?


AW: Re: [AJUDA] 2 mensagens no chat - Miqueias Barros - 02.06.2011

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
Como assim ?

Qual й a mensagem que tem o ID e qual a que nгo tem ?
Exemplo quando digito algo no chat aparece assim:

MiqueiasBarros: (ID:0): Oiii
MiqueiasBarros: Oiii

Seja qualquer nome ele faz isso ae...

Help-mee please


AW: [AJUDA] 2 mensagens no chat - Miqueias Barros - 03.06.2011

Alguem pode me ajudar?


Re: [AJUDA] 2 mensagens no chat - Shadoww5 - 03.06.2011

Poste esta callback/stock: UpperToLower

Caso eu nao ajude agora de noite, amanha eu ajudo.


Re: [AJUDA] 2 mensagens no chat - [S]trong - 03.06.2011

gm da mrs hehe, o problema era o return true no final da callback

pawn Код:
public OnPlayerText( playerid, text[ ] )
{
    if ( !playerData[ playerid ][ p_logged_in ] && playerData[ playerid ][ p_registered ] )
        return SendClientMessage( playerid, ERROR_COLOR, "[ERRO] Vocк precisa estб logado para usar o chat!" ), false;

    if ( playerData[ playerid ][ p_muted ] )
        return SendClientMessage( playerid, ERROR_COLOR, "[ERRO] Vocк estб mutado, entгo, nгo pode falar no chat." ), false;

    if ( text[ 0 ] == '!' )
    {
        new teamChat[ 128 ];

        format( teamChat, sizeof( teamChat ), "[TEAM] %s: %s", playerData[ playerid ][ p_name ], text[ 1 ] );

        loopPlayers( otherid )
        {
            if ( playerData[ otherid ][ p_team ] != playerData[ playerid ][ p_team ] )
                continue;

            SendClientMessage( otherid, teamColor[ playerData[ playerid ][ p_team ] ][ 0 ], teamChat );

            PlayerPlaySound( otherid, 1058, 0, 0, 0 );
        }

        return false;
    }

    if ( text[ 0 ] == '#' && playerData[ playerid ][ p_level ] )
    {
        new adminChat[ 128 ];

        format( adminChat, sizeof( adminChat ), "[Chat Admin] %s: %s", playerData[ playerid ][ p_name ], text[ 1 ] );

        loopPlayers( otherid )
        {
            if ( !playerData[ otherid ][ p_level ] )
                continue;

            SendClientMessage( otherid, 0x87CEFFFF, adminChat );
        }

        return false;
    }

    if ( serverData[ s_chatlock ] )
        return SendClientMessage( playerid, ERROR_COLOR, "[ERRO] O chat estб trancado, use o team chat." ), false;

        UpperToLower(text);
        new string[256];
        format(string,sizeof(string),"(ID:%d): %s",playerid,text);
        SendPlayerMessageToAll(playerid,string);

    return false;
}



Re: [AJUDA] 2 mensagens no chat - Shadoww5 - 03.06.2011

E por que deve retornar "false" ?


Re: [AJUDA] 2 mensagens no chat - [S]trong - 03.06.2011

pq retornando a true retorna ao chat que jб vem na onplayertext.


Re: [AJUDA] 2 mensagens no chat - Shadoww5 - 03.06.2011

Vlw Strong. Mas se alguem puder me explicar melhor, agradeзo.

Continuo sem entender muito bem.


AW: [AJUDA] 2 mensagens no chat - Miqueias Barros - 03.06.2011

KKK'

Strong ownaa!!

Valeu brother (Y)'