SA-MP Forums Archive
[Ajuda] Como passo esse cmd zcmd pra strcmp? - 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] Como passo esse cmd zcmd pra strcmp? (/showthread.php?tid=635951)



Como passo esse cmd zcmd pra strcmp? - zCyan - 17.06.2017

Galera me ajude passa esse codigo pra strcmp?

Код:
if(sscanf(params,"dd",id1,id2)) return SendClientMessage(playerid,COR_JEFF2,"Uso: /x1 [id1] [id2]");
Obrigado, se puderem me ajudar


Re: Como passo esse cmd zcmd pra strcmp? - IlanZ - 17.06.2017

Quote:
Originally Posted by zCyan
Посмотреть сообщение
Galera me ajude passa esse codigo pra strcmp?

Код:
if(sscanf(params,"dd",id1,id2)) return SendClientMessage(playerid,COR_JEFF2,"Uso: /x1 [id1] [id2]");
Obrigado, se puderem me ajudar
Isso nгo й cmd em zcmd, й sscanf


Re: Como passo esse cmd zcmd pra strcmp? - zCyan - 17.06.2017

Quote:
Originally Posted by IlanZ
Посмотреть сообщение
Isso nгo й cmd em zcmd, й sscanf
Tlg pow, mais como faзo esse sisteminha de x1 [id] [id2] em strcmp?


Re: Como passo esse cmd zcmd pra strcmp? - renatog - 17.06.2017

Uma dъvida, por que quer usar strcmp em 2017?


Re: Como passo esse cmd zcmd pra strcmp? - MorteAmerica - 17.06.2017

para nгo usar sscanf terб q usar strtok, um pouco inferior mas com a mesma funcгo.

Quote:
Originally Posted by renatog
Посмотреть сообщение
Uma dъvida, por que quer usar strcmp em 2017?
Talvez porquк nem todos tenham o mesmo gosto. Eu particularmente nгo gosto de zCMD, sscanf, dof2 e nem por isso julgo quem usa.


Re: Como passo esse cmd zcmd pra strcmp? - HardWar - 17.06.2017

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    new 
cmd[128], tmp[128], idxidx2;
    
cmd strtok(cmdtextidx);

    if(!
strcmp(cmd"/x1"true))
    {
        
tmp strtok(cmdtextidx);
        new 
tmp2[128];
        
tmp2 strtok(cmdtextidx);

        if (!
strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid0xFF0000FF"Uso: /x1 [id1] [id2]");
        new 
id1 strval(tmp);
        new 
id2 strval(tmp2);

        
// faзa o que quiser com os 2 ids

        
return 1;
    }
    return 
0;
}

strtok(const string[], &index)
{
    new 
length strlen(string);
    while ((
index length) && (string[index] <= ' '))
    {
        
index++;
    }
 
    new 
offset index;
    new 
result[20];
    while ((
index length) && (string[index] > ' ') && ((index offset) < (sizeof(result) - 1)))
    {
        
result[index offset] = string[index];
        
index++;
    }
    
result[index offset] = EOS;
    return 
result;




Re: Como passo esse cmd zcmd pra strcmp? - Meck - 17.06.2017

Amigo te aconselho a utilizar ZCMD й bem mais pratico de utilizar, vocк nгo vai ter tanta dor de cabeзa.


Re: Como passo esse cmd zcmd pra strcmp? - DarkBr - 18.06.2017

Quote:
Originally Posted by renatog
Посмотреть сообщение
Uma dъvida, por que quer usar strcmp em 2017?
Verdade


Re: Como passo esse cmd zcmd pra strcmp? - zCyan - 18.06.2017

Quote:
Originally Posted by HardWar
Посмотреть сообщение
PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    new 
cmd[128], tmp[128], idxidx2;
    
cmd strtok(cmdtextidx);
    if(!
strcmp(cmd"/x1"true))
    {
        
tmp strtok(cmdtextidx);
        new 
tmp2[128];
        
tmp2 strtok(cmdtextidx);
        if (!
strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid0xFF0000FF"Uso: /x1 [id1] [id2]");
        new 
id1 strval(tmp);
        new 
id2 strval(tmp2);
        
// faзa o que quiser com os 2 ids
        
return 1;
    }
    return 
0;
}
strtok(const string[], &index)
{
    new 
length strlen(string);
    while ((
index length) && (string[index] <= ' '))
    {
        
index++;
    }
 
    new 
offset index;
    new 
result[20];
    while ((
index length) && (string[index] > ' ') && ((index offset) < (sizeof(result) - 1)))
    {
        
result[index offset] = string[index];
        
index++;
    }
    
result[index offset] = EOS;
    return 
result;

Obrigado Mano