SA-MP Forums Archive
[Ajuda] Mudei uns comandos para 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] Mudei uns comandos para strcmp (/showthread.php?tid=440597)



Mudei uns comandos para strcmp - clerISoN - 30.05.2013

Mudei uns comandos para strcmp e deu esses 2 erros:

O que falta ?

Код:
.pwn(719) : error 017: undefined symbol "params"
.pwn(761) : error 017: undefined symbol "params
"


Re: Mudei uns comandos para strcmp - -GooGle- - 30.05.2013

Poste o cуdigo para eu ver.


Re: Mudei uns comandos para strcmp - clerISoN - 30.05.2013

Linha 719 /darvip

pawn Код:
if(strcmp(cmdtext,"/darvip", true) == 0)
{
    new ID;
    new Dias;

    if(IsPlayerAdmin(playerid))
    {
        if(!sscanf(params,"dd",ID,Dias))
        {
            SendClientMessage(playerid,0xBFBFBFAA,"Use: /darvip ID Dias.");
            return 1;
        }
        if(!IsPlayerConnected(ID))
        {
            SendClientMessage(playerid,0xBFBFBFAA,"Player nгo online.");
            return 1;
        }
        else
        {
            if(VIP[ID] == 1)
            {
                SendClientMessage(playerid,0xBFBFBFAA,"O mesmo Jб й VIP.");
                return 1;
            }
            else
            {
                GetPlayerName(ID,NomeV,sizeof(NomeV));
                format(Fala,sizeof(Fala),"Vips/%s.ini",NomeV);

                DOF2_CreateFile(Fala);
                DOF2_SetInt(Fala,"Vencimento",getdate());
                DOF2_SetInt(Fala,"Dias",Dias);
                DOF2_SaveFile();

                VIP[ID] = 1;

                format(Fala,sizeof(Fala),"O administrador deu VIP para o player %s por %d dias.",NomeV,Dias);
                SendClientMessageToAll(0xFF8080AA,Fala);
            }
        }
    }
    return 1;
}
Linha 761 /removervip

pawn Код:
if(strcmp(cmdtext,"/removervip", true) == 0)
{
    new ID;

    if(IsPlayerAdmin(playerid))
    {
        if(!sscanf(params,"d",ID))
        {
            SendClientMessage(playerid,0xBFBFBFAA,"Use: /removervip ID.");
            return 1;
        }
        if(!IsPlayerConnected(ID))
        {
            SendClientMessage(playerid,0xBFBFBFAA,"Player nгo online.");
            return 1;
        }
        else
        {
            if(VIP[ID] == 0)
            {
                SendClientMessage(playerid,0xBFBFBFAA,"O mesmo nгo й VIP.");
                return 1;
            }
            else
            {
                GetPlayerName(ID,NomeV,sizeof(NomeV));
                format(Fala,sizeof(Fala),"Vips/%s.ini",NomeV);

                DOF2_RemoveFile(Fala);

                VIP[ID] = 0;

                format(Fala,sizeof(Fala),"O administrador removeu o VIP do player %s.",NomeV);
                SendClientMessageToAll(0xFF8080AA,Fala);
            }
        }
    }
    return 1;
}



Re: Mudei uns comandos para strcmp - Cromado - 30.05.2013

LoL vocк estб tentando me ajudar? Vlw msm mano se for ne


Re: Mudei uns comandos para strcmp - clerISoN - 30.05.2013

Quote:
Originally Posted by Cromado
Посмотреть сообщение
LoL vocк estб tentando me ajudar? Vlw msm mano se for ne
Tambйm rss...


Re: Mudei uns comandos para strcmp - Don_Speed - 30.05.2013

Achei algumas coisas que lhe ajudara!

Quote:
Originally Posted by zSuYaNw
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) {
    // Exemplo
    if(!strcmp(cmdtext,"/dinheiro", true)) {
   
        if(!IsPlayerAdmin(playerid))
            return SendClientMessage(playerid, 0x1E90FFFF, ">> Somente administradores rcon.");
           
        static id, quantia;
        if(sscanf(cmdtext, "ud", id, quantia))
            return SendClientMessage(playerid, 0x1E90FFFF, ">> Sintaxe: /dinheiro [ID] [Quantia]");
           
        GivePlayerMoney(id, quantia);
        return 1;
    }

    // Outros comandos
    return 0;
}
б й mesmo auehuaheuahueha
Quote:
Originally Posted by Kyosaur
Посмотреть сообщение
If your code isnt tested, you shouldnt post it. Those commands wont work correctly! Not only are specifying the wrong length to the strcmp function (10 for both, which neither equal 10!), but your passing the entire cmdtext string to sscanf, which includes the original command.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/Example", true, 8))
    {
        new
            number,
            string[16];

        if(!sscanf(cmdtext[9], "is[15]", number, string))
        {
            printf("number = %d, string = %s.", number, string);
            return 1;
        }
        SendClientMessage(playerid, 0xFF0000FF, "Syntax error: /Example <number> <string>");
        return 1;
    }

    return 0;
}
The above should work without any problems, but it's highly recommended to just use a command processor like zcmd/ycmd with sscanf. This not only is faster, but its much safer due to how easy it is to make mistakes using the above methodology.

Remember to always update the strcmp length parameter (should be the lenght of the command) and the index for cmdtext (should be the length of the command + 1) if you change the name of the command.

#Edit

Em vez de params e cmdtext




Re: Mudei uns comandos para strcmp - clerISoN - 30.05.2013

mudei para cmdtext copilei n deu erro mas ficou aquele erro na box de quando abre o samp-serve ;/


Re: Mudei uns comandos para strcmp - Cromado - 30.05.2013

mostra?


Re: Mudei uns comandos para strcmp - Don_Speed - 30.05.2013

Quote:
Originally Posted by clerISoN
Посмотреть сообщение
mudei para cmdtext copilei n deu erro mas ficou aquele erro na box de quando abre o samp-serve ;/
Falta plugin nй !



Re: Mudei uns comandos para strcmp - Cromado - 30.05.2013

Vix========= Dormiu