SA-MP Forums Archive
[AJUDA] /pintar bugando comandos que nгo existem. - 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] /pintar bugando comandos que nгo existem. (/showthread.php?tid=246782)



[AJUDA] /pintar bugando comandos que nгo existem. - ASDF - 05.04.2011

Pessoal, estou com um bug no comando /pintar [cor1] [cor2]. Ele estб bugando comandos que nгo existem tipo, eu digito qualquer comando que nгo existe da estб mensagem 'Somente mecвnicos podem usar'. Estou achando que й alguma chave, mas nгo estou conseguindo arrumar. Serб que alguйm me ajuda?

pawn Код:
if(strcmp(cmd, "/pintar", true) == 0) {
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(file, sizeof(arquivo), "%s.ini", name);
    if(dini_Int(file, "ProfissaoX") == Mecanico) {
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, Vermelho, "vocк nгo estб no veнculo.");
    new tmp[80], idx;
    cmd = strtok(cmdtext, idx);
    new cor1, cor2;
    new veiculo;
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
    SendClientMessage(playerid, Vermelho, "/pintar [cor1] [cor2]");
    return 1;
    }
    cor1 = strval(tmp);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
    SendClientMessage(playerid, Vermelho, "/pintar [cor1] [cor1]");
    return 1;
    }
    cor2 = strval(tmp);
    veiculo = GetPlayerVehicleID(playerid);
    ChangeVehicleColor(veiculo,cor1,cor2);
    SendClientMessage(playerid, Amarelo, "Veнculo pintado.");
    } else {
    SendClientMessage(playerid, Vermelho, "Somente mecвnicos podem usar");
    }
    return 1;
    }



Re: [AJUDA] /pintar bugando comandos que nгo existem. - ASDF - 05.04.2011

Obrigado linda.
Mas eu jб tentei isso e deu o mesmo erro. Alguйm? :/


Re: [AJUDA] /pintar bugando comandos que nгo existem. - Chefгo - 05.04.2011

procura return 0; antes desse comando...


Re: [AJUDA] /pintar bugando comandos que nгo existem. - JonathanFeitosa - 05.04.2011

pawn Код:
if(strcmp(cmd, "/pintar", true) == 0)
{
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(file, sizeof(arquivo), "%s.ini", name);
    if(dini_Int(file, "ProfissaoX") != Mecanico)
    {
     SendClientMessage(playerid, Vermelho, "Somente mecвnicos podem usar o comando!");
     return 1;
    }
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, Vermelho, "vocк nгo estб no veнculo.");
    new tmp[80], idx;
    cmd = strtok(cmdtext, idx);
    new cor1, cor2;
    new veiculo;
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
     SendClientMessage(playerid, Vermelho, "/pintar [cor1] [cor2]");
     return 1;
    }
    cor1 = strval(tmp);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
     SendClientMessage(playerid, Vermelho, "/pintar [cor1] [cor1]");
     return 1;
    }
    cor2 = strval(tmp);
    veiculo = GetPlayerVehicleID(playerid);
    ChangeVehicleColor(veiculo,cor1,cor2);
    SendClientMessage(playerid, Amarelo, "Veнculo pintado.");
    return 1;
  }
    return 0;
}
Ai o da Net Faz o que o poderoso falou й bota assim. Que Significa o Final do OnPlayerCommandText


Re: [AJUDA] /pintar bugando comandos que nгo existem. - ASDF - 06.04.2011

Jonathan, ainda estб dando a mesma coisa. Esse return 0; nгo adiantou de nada pq jб tenho um
pawn Код:
return SendClientMessage(playerid, cor,"esse comando nгo existe");
}



Re: [AJUDA] /pintar bugando comandos que nгo existem. - JonathanFeitosa - 06.04.2011

pawn Код:
if(strcmp(cmd, "/pintar", true) == 0)
{
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(file, sizeof(arquivo), "%s.ini", name);
    if(dini_Int(file, "ProfissaoX") != Mecanico)
    {
     SendClientMessage(playerid, Vermelho, "Somente mecвnicos podem usar o comando!");
     return 1;
    }
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, Vermelho, "vocк nгo estб no veнculo.");
    new tmp[80], idx;
    cmd = strtok(cmdtext, idx);
    new cor1, cor2;
    new veiculo;
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
     SendClientMessage(playerid, Vermelho, "/pintar [cor1] [cor2]");
     return 1;
    }
    cor1 = strval(tmp);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
     SendClientMessage(playerid, Vermelho, "/pintar [cor1] [cor1]");
     return 1;
    }
    cor2 = strval(tmp);
    veiculo = GetPlayerVehicleID(playerid);
    ChangeVehicleColor(veiculo,cor1,cor2);
    SendClientMessage(playerid, Amarelo, "Veнculo pintado.");
    return 1;
  }
return SendClientMessage(playerid, cor,"esse comando nгo existe");
}



Re: [AJUDA] /pintar bugando comandos que nгo existem. - Ricop522 - 06.04.2011

Tб cheio de coisas erradas como o format(file, sizeof(arquivo)
E tб faltando news, etc.
Vк se foi brow

pawn Код:
if(strcmp(cmd, "/pintar", true) == 0)
    {
        new name[MAX_PLAYER_NAME], cor1, cor2, file[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), "%s.ini", name);
        if(dini_Int(file, "ProfissaoX") == Mecanico)
        {
            if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, Vermelho, "vocк nгo estб no veнculo.");
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, Vermelho, "USE: /pintar [cor1] [cor2]");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            cor1 = strval(tmp);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, Vermelho, "/pintar [cor1] [cor1]");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            cor2 = strval(tmp);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, Vermelho, "/pintar [cor1] [cor1]");
                return 1;
            }
            new veiculo = GetPlayerVehicleID(playerid);
            ChangeVehicleColor(veiculo, cor1, cor2);
            SendClientMessage(playerid, Amarelo, "Veнculo pintado.");
        }
        else
        {
            SendClientMessage(playerid, Vermelho, "Somente mecвnicos podem usar");
        }
        return 1;
    }
Tб identado pra vocк


Re: [AJUDA] /pintar bugando comandos que nгo existem. - ASDF - 07.04.2011

Ainda estб dando a mesma coisa galera. :/

O erro estб nesse cуdigo, pq quando eu removo ele, o bug para!


Re: [AJUDA] /pintar bugando comandos que nгo existem. - ASDF - 07.04.2011

Drakins, obrigado pela ajuda, mas agora estб dando 'vocк nгo estб no veнculo.' com qualquer comando que digito que nгo existe. :/ (OBS: Jб tem return 0; no final da public commandtext.)