[Pedido] Converter de dmcd para strcmp
#1

Alguem poderia por favor converter esse comando para strcmp ?

Tentei diversas vezes converte-lo, sem sucesso. Ou entгo, como usar ele em um gm totalmente em strcmp ?

PHP код:
dcmd_fechar_e(playeridparams[])
{
    
#pragma unused params
    
if(PlayerInfo[playerid][pAdmin] < 2)
        return 
SendClientMessage(playerid,COR_ERRO,"ERRO: Vocк nгo й um administrador para criar uma enquete!");
    if(
EnqueteAberta == false) return SendClientMessage(playerid,COR_ERRO,"ERRO: No momento jб existe uma enquete aberta");
        return 
SendClientMessage(playerid,COR_ERRO,"ERRO: No momento jб existe uma enquete aberta");
    
SendClientMessageToAll(TEXTO" ");
    
SendClientMessageToAll(TEXTO"=============================================================================================");
    
SendClientMessageToAll(COR_YELLOW"{6A5ACD}* O {E6E6FA}%s %s {6A5ACD}acaba de fechar uma enquete."AccountName(playerid), getPName(playerid));
    
SendClientMessageToAll(COR_YELLOW"{6A5ACD}* A pergunta era: {E6E6FA}%s"NomeEnquete);
    
SendClientMessageToAll(COR_YELLOW"{6A5ACD}* Total de votos: {E6E6FA}Sim [%d] {6A5ACD}| {E6E6FA}Nгo [%d] {E6E6FA}| {E6E6FA}Votos [%d]."TotalDeVotosSimTotalDeVotosNao, (TotalDeVotosSim TotalDeVotosNao));
    
SendClientMessageToAll(TEXTO"=============================================================================================");
    
TotalDeVotosSim 0;
    
TotalDeVotosNao 0;
    
EnqueteAberta false;
    for(new 
i<= MAX_PLAYERSi++)
        if(
PlayerVotou[i] == 1)
    {
        
PlayerVotou[i] = 0;
    }
    return 
1;
}
dcmd_criar_e(playeridparams[])
{
    
#pragma unused params
    
if(Player[playerid][pAdmin] < 2)
        return 
SendClientMessage(playerid,COR_ERRO,"ERRO: Vocк nгo й um administrador para criar uma enquete!");
    if(
EnqueteAberta == true)
        return 
SendClientMessage(playerid,COR_ERRO,"ERRO: No momento jб existe uma enquete aberta");
    if(
Player[playerid][pLogged] == false)
        return 
SendClientMessage(playeridCOR_ERRO"ERRO: Vocк nгo estб logado para utilizar este comando!");
    
ShowPlayerDialog(playerid,DIALOG_EN,DIALOG_STYLE_INPUT,"Criar Enquete","Por favor digite sua pergunta para enquete","Criar","Cancelar");
    return 
1;
}
dcmd_nao_e(playeridparams[])
{
    
#pragma unused params
    
if(PlayerVotou[playerid] == 1)
        return 
SendClientMessage(playerid,COR_ERRO,"ERRO: Vocк jб votou!");
    if(
EnqueteAberta == false)
        return 
SendClientMessage(playerid,COR_ERRO,"ERRO: Nenhuma enquete estб aberta!");
    if(
Player[playerid][pLogged] == false)
        return 
SendClientMessage(playeridCOR_ERRO"ERRO: Vocк nгo estб logado para utilizar este comando!");
    
TotalDeVotosNao++;
    
PlayerVotou[playerid] = 1;
    
SendClientMessage(playerid,COR_CYAN," Seu voto foi armazenado no banco de dados com sucesso - Nгo");
    return 
1;
}
dcmd_sim_e(playeridparams[])
{
    
#pragma unused params
    
if(PlayerVotou[playerid] == 1)
        return 
SendClientMessage(playerid,COR_ERRO,"ERRO: Vocк jб votou!");
    if(
EnqueteAberta == false)
        return 
SendClientMessage(playerid,COR_ERRO,"ERRO: Nenhuma enquete estб aberta!");
    if(
Player[playerid][pLogged] == false)
        return 
SendClientMessage(playeridCOR_ERRO"ERRO: Vocк nгo estб logado para utilizar este comando!");
    
TotalDeVotosSim++;
    
SendClientMessage(playerid,COR_CYAN," Seu voto foi armazenado no banco de dados com sucesso - Sim");
    
PlayerVotou[playerid] = 1;
    return 
1;

Reply
#2

pawn Код:
dcmd_fechar_e(playerid, params[])
//Para
if(strcmp("/fechar_e", cmdtext, true) == 0)
Й difнcil de fazer isso nй.
Reply
#3

Espero ter ajudado.

PHP код:
    if(strcmp(cmdtext"/fechar"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,COR_ERRO,"ERRO: Vocк nгo й um administrador para criar uma enquete!");
        if(
EnqueteAberta == false) return SendClientMessage(playerid,COR_ERRO,"ERRO: No momento jб existe uma enquete aberta");
        
SendClientMessageToAll(TEXTO" ");
        
SendClientMessageToAll(TEXTO"=============================================================================================");
        
SendClientMessageToAll(COR_YELLOW"{6A5ACD}* O {E6E6FA}%s %s {6A5ACD}acaba de fechar uma enquete."AccountName(playerid), getPName(playerid));
        
SendClientMessageToAll(COR_YELLOW"{6A5ACD}* A pergunta era: {E6E6FA}%s"NomeEnquete);
        
SendClientMessageToAll(COR_YELLOW"{6A5ACD}* Total de votos: {E6E6FA}Sim [%d] {6A5ACD}| {E6E6FA}Nгo [%d] {E6E6FA}| {E6E6FA}Votos [%d]."TotalDeVotosSimTotalDeVotosNao, (TotalDeVotosSim TotalDeVotosNao));
        
SendClientMessageToAll(TEXTO"=============================================================================================");
        
TotalDeVotosSim 0;
        
TotalDeVotosNao 0;
        
EnqueteAberta false;
        for(new 
i<= MAX_PLAYERSi++)
        {
            if(
PlayerVotou[i] == 1)
            {
                
PlayerVotou[i] = 0;
            }
        }
        return 
1;
    }

    if(
strcmp(cmdtext"/criar"true) == 0)
    {
        if(
Player[playerid][pAdmin] < 2) return SendClientMessage(playerid,COR_ERRO,"ERRO: Vocк nгo й um administrador para criar uma enquete!");
        if(
EnqueteAberta == true) return SendClientMessage(playerid,COR_ERRO,"ERRO: No momento jб existe uma enquete aberta");
        if(
Player[playerid][pLogged] == false) return SendClientMessage(playeridCOR_ERRO"ERRO: Vocк nгo estб logado para utilizar este comando!");
        
ShowPlayerDialog(playerid,DIALOG_EN,DIALOG_STYLE_INPUT,"Criar Enquete","Por favor digite sua pergunta para enquete","Criar","Cancelar");
        return 
1;
    }

    if(
strcmp(cmdtext"/nao"true) == 0)
    {
        if(
PlayerVotou[playerid] == 1) return SendClientMessage(playerid,COR_ERRO,"ERRO: Vocк jб votou!");
        if(
EnqueteAberta == false) return SendClientMessage(playerid,COR_ERRO,"ERRO: Nenhuma enquete estб aberta!");
        if(
Player[playerid][pLogged] == false) return SendClientMessage(playeridCOR_ERRO"ERRO: Vocк nгo estб logado para utilizar este comando!");
        
TotalDeVotosNao++;
        
PlayerVotou[playerid] = 1;
        
SendClientMessage(playerid,COR_CYAN," Seu voto foi armazenado no banco de dados com sucesso - Nгo");
        return 
1;
    }

    if(
strcmp(cmdtext"/sim"true) == 0)
    {
        if(
PlayerVotou[playerid] == 1) return SendClientMessage(playerid,COR_ERRO,"ERRO: Vocк jб votou!");
        if(
EnqueteAberta == false) return SendClientMessage(playerid,COR_ERRO,"ERRO: Nenhuma enquete estб aberta!");
        if(
Player[playerid][pLogged] == false) return SendClientMessage(playeridCOR_ERRO"ERRO: Vocк nгo estб logado para utilizar este comando!");
        
TotalDeVotosSim++;
        
SendClientMessage(playerid,COR_CYAN," Seu voto foi armazenado no banco de dados com sucesso - Sim");
        
PlayerVotou[playerid] = 1;
        return 
1;
    } 
Reply
#4

jб fiz isso e n foi irmгo
Reply
#5

Vou tentar esse Seu Madruga
Reply
#6

Quote:
Originally Posted by RenanQTG
Посмотреть сообщение
Vou tentar esse Seu Madruga
Funcionou?
Reply
#7

Nгo use conversor, use a mente, ficar na base de "ter tudo na mгo" nгo te farб aprender nada. Faзa como o MultiKill disse, e claro, nгo esqueзa de colocar todos os comandos dentro da callback OnPlayerCommandText (isso apenas para strcmp)
Reply
#8

Recomendo que vocк procure entender aquilo que vocк estб compondo em seu script.
A callback OnPlayerCommandText й chamada toda vez que vocк digita algo depois da / em seu chat, caso este conteъdo esteja no comeзo da frase. Ex: /comando

strcmp, й um comparador de strings, usando esta funзгo, vocк irб comparar se o que foi digitado no chat ou seja, cmdtext, й igual ao seu comando, isto й /comando

Ex:
pawn Код:
if(strcmp("/comando", cmdtext, true) == 0)
{
//...
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)