SA-MP Forums Archive
[AJUDA] /Say - 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] /Say (/showthread.php?tid=292407)



[AJUDA] /Say - Allanrokeiro - 23.10.2011

Pessoal, estou com um Problema no /Say, Tipo Quando digita ''/Say Oi Tudo Bem?'' dai sai no Chat sу o ''Oi''...

Se alguйm puder me ajudar...

pawn Код:
if(strcmp(cmd, "/say", true) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
        new tmp[256];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
            {
                SendClientMessage(playerid, 0xFFFFE0AA, "Uso: /say [texto]");
                return 1;
            }
            else
            {
                if(IsPlayerConnected(playerid))
                {
                    new nome[MAX_PLAYER_NAME], str[128];
                    GetPlayerName(playerid, nome, sizeof(nome));
                    format(str, sizeof(str), "* Admin %s: %s", nome, tmp);
                    SendClientMessageToAll(0x2587CEAA, str);
                }
                return 1;
            }
        }
    }



Re: [AJUDA] /Say - iansinho - 23.10.2011

Tente:
PHP код:
if(strcmp(cmd"/say"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {    
        if(
IsPlayerAdmin(playerid))
        { 
            new 
length strlen(cmdtext);
            while ((
idx length) && (cmdtext[idx] <= ' '))
            {
                
idx++;
            }
            new 
offset idx;
            new 
result[64];
            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
            {
                
result[idx offset] = cmdtext[idx];
                
idx++;
            }
            
result[idx offset] = EOS;
            if(!
strlen(result))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"Uso: /say [texto].");
                return 
0x01;
            }
            new 
nome[MAX_PLAYER_NAME], str[128];
            
GetPlayerName(playeridnomesizeof(nome));
            
format(strsizeof(str), "*Admin %s: %s."nome, (result));
            
SendClientMessageToAll(0x2587CEAAstr);
        }
        }    
            
        return 
1;
    } 



Re: [AJUDA] /Say - Macintosh - 23.10.2011

pawn Код:
CMD:say(playerid, params[])
{
    new nome[MAX_PLAYER_NAME], str[128], Texto[128];
    if(sscanf(params, "s[128]", Texto)) return SendClientMessage(playerid, -1, "/Say [Texto]");
    GetPlayerName(playerid, nome, sizeof(nome));
    format(str, sizeof(str), "* Admin %s: %s", nome, Texto);
    SendClientMessageToAll(0x2587CEAA, str);
    return 1;
}
Use ZCMD alйm de ser mais rбpido economiza mais linhas.


Re: [AJUDA] /Say - Allanrokeiro - 23.10.2011

Quote:
Originally Posted by iansinho
Посмотреть сообщение
Tente:
PHP код:
if(strcmp(cmd"/say"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {    
        if(
IsPlayerAdmin(playerid))
        { 
            new 
length strlen(cmdtext);
            while ((
idx length) && (cmdtext[idx] <= ' '))
            {
                
idx++;
            }
            new 
offset idx;
            new 
result[64];
            while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
            {
                
result[idx offset] = cmdtext[idx];
                
idx++;
            }
            
result[idx offset] = EOS;
            if(!
strlen(result))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"Uso: /say [texto].");
                return 
0x01;
            }
            new 
nome[MAX_PLAYER_NAME], str[128];
            
GetPlayerName(playeridnomesizeof(nome));
            
format(strsizeof(str), "*Admin %s: %s."nome, (result));
            
SendClientMessageToAll(0x2587CEAAstr);
        }
        }    
            
        return 
1;
    } 
Funcionou, mas fiz uma corrigida no seu cуdigo, vejo que vocк editou, Obrigado б vocкs que responderam б minha pergunta!


Re: [AJUDA] /Say - iansinho - 23.10.2011

Quote:
Originally Posted by Allanrokeiro
Посмотреть сообщение
Funcionou, mas fiz uma corrigida no seu cуdigo, vejo que vocк editou, Obrigado б vocкs que responderam б minha pergunta!
Sim, sim, eu editei.
Eu esqueci de formatar kk, mas rapidamente eu editei e coloquei (acho que foi isso ._.)

Por nada, tamo junto ae


Re: [AJUDA] /Say - [O.z]Caroline - 23.10.2011

Quote:
Originally Posted by Macintosh
Посмотреть сообщение
pawn Код:
CMD:say(playerid, params[])
{
    new nome[MAX_PLAYER_NAME], str[128], Texto[128];
    if(sscanf(params, "s[128]", Texto)) return SendClientMessage(playerid, -1, "/Say [Texto]");
    GetPlayerName(playerid, nome, sizeof(nome));
    format(str, sizeof(str), "* Admin %s: %s", nome, Texto);
    SendClientMessageToAll(0x2587CEAA, str);
    return 1;
}
Use ZCMD alйm de ser mais rбpido economiza mais linhas.
Ai tem ZCMD e SSCANF.
nгo precisa Ser exatamente ZCMD!.
pode usar com strcmp tambйm!.

pawn Код:
if(!strcmp(cmtext,"/say", true))
{
   new text[50];
   if(!sscanf(cmdtext,"s[50]", text)) SendClientMessageToAll(-1, text);
   return 1;
}