[Ajuda] Ajuda com comando
#1

Eu tentei fazer um comando de pintar mais quando eu uso /pintar cor1 cor2 aparece "Use /pintar cor1 cor2"

PHP код:
CMD:pintar(playeridparams[])
{
    static 
c1 ,c2;
    new 
tmp[128];
    if(!
strlen(tmp))
    {
        
SendClientMessage(playerid, -1"/pintar [cor1] [cor2]");
        return 
1;
    }
    if ( 
IsPlayerInAnyVehicle playerid ) ) {
        new 
string[128];
        
ChangeVehicleColor GetPlayerVehicleID playerid ) , c1 c2 ) ;
        
PlayerPlaySound(playerid1133257.6206, -41.53071002.0234);
        
format string 128 "[INFO] Vocк mudou as cores de seu carro para: [%i]-[%i]" c1 c2 ) ;
        
SendClientMessage playerid , -string ) ;
        return 
;
    }
    else return 
SendClientMessage playerid 0xF60000AA "[ERRO] Voce tem que estar em um veiculo." ) ;

Obs: Nгo quero usar sscanf
Reply
#2

Se esta aparecendo "Use /pintar cor1 cor2", a funзгo esta parando aqui

Quote:

if(!strlen(tmp))
{
SendClientMessage(playerid, -1, "/pintar [cor1] [cor2]");
return 1;
}

Tente rever o codigo, se nao conseguir , responda aqui novamente.
Reply
#3

Troque:

pawn Код:
if(!strlen(tmp))
    {
        SendClientMessage(playerid, -1, "/pintar [cor1] [cor2]");
        return 1;
    }
Por:

pawn Код:
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "/pintar [cor1] [cor2]");
Reply
#4

meu

pawn Код:
if(strcmp(cmd, "/pintar", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
//variaveis pra quem poder usa esse cmd, ser for liberado dx sem.
new tmp[256];
new cor1,cor2;
new veiculo;
tmp = strtok(cmdtext,idx);
cor1 = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "/pintar [cor1] [cor2]");
return 1;
}
aki deu.
Reply
#5

Quote:
Originally Posted by Zona_Sky
Посмотреть сообщение
meu

pawn Код:
if(strcmp(cmd, "/pintar", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
//variaveis pra quem poder usa esse cmd, ser for liberado dx sem.
new tmp[256];
new cor1,cor2;
new veiculo;
tmp = strtok(cmdtext,idx);
cor1 = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "/pintar [cor1] [cor2]");
return 1;
}
aki deu.

Nгo vai funcionar, porque a funзгo vai parar alн igual, com return darб menos chances de erro nesses casos.
Reply
#6

@FuneraL - Ainda continua o mesmo erro.
@Zona_Sky - Esse ai da um monte de erros, eu quero tentar colocar o outro pois й mais facil pra eu entender rs.
Reply
#7

Por que nгo usa sscanf?
Bem mais prбtico.

pawn Код:
CMD:pintar(playerid, params[])
{
    static C1, C2, String[128];
    if(sscanf(params, "dd", C1, C2)) return SendClientMessage(playerid, -1, "Digite: /pintar <cor 1> <cor 2>");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "[ERRO] Vocк nгo estб em um veнculo.");
    format(String, sizeof String, "[INFO] Vocк mudou as cores do seu veнculo para: %d e %d", Cor1, Cor2);
    SendClientMessage(playerid, -1, String);
    PlayerPlaySound(playerid, 1133, 257.6206, -41.5307, 1002.0234);
    ChangeVehicleColor(GetPlayerVehicleID(playerid), C1, C2);
    return 1;
}
Reply
#8

Quote:
Originally Posted by .FuneraL.
Посмотреть сообщение
Troque:

pawn Код:
if(!strlen(tmp))
    {
        SendClientMessage(playerid, -1, "/pintar [cor1] [cor2]");
        return 1;
    }
Por:

pawn Код:
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "/pintar [cor1] [cor2]");
Nossa hein, que diferenзa.
Reply
#9

piowiwpowiwop, usa sscanf..
Reply
#10

Eu nгo queria usar sscanf porquк estava dando um erro com a include, mais jб consegui obrigado galera.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)