SA-MP Forums Archive
error 035: argument type mismatch (argument 1) - 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: error 035: argument type mismatch (argument 1) (/showthread.php?tid=419010)



error 035: argument type mismatch (argument 1) - Duun - 27.02.2013

pawn Код:
CMD:tempo(playerid, params[])
{
    new
        Temp
    ;
   
    if(sscanf(params, "us", Temp))
    return SendClientMessage(playerid, Vermelho, "Uso й /tempo [ Nome ]");
   
    SetWorldTime(NT(Temp));

    return 1;
}

stock NT(str[])
{
    new                        
        _sk = -1
    ;
    if(!strcmp(str, "dia", true)) _sk = 9;
    if(!strcmp(str, "tarde", true)) _sk = 20;
    if(!strcmp(str, "noite", true)) _sk = 24;
    return _sk;
}
Linha :

pawn Код:
SetWorldTime(NT(Temp));



Re: error 035: argument type mismatch (argument 1) - Schocc - 27.02.2013

A funзгo retorna um numero Inteiro

@edit alias ao contrario

Tem que usar string

SetWorldTime( NT("dia" ) );


Re: error 035: argument type mismatch (argument 1) - Supera - 27.02.2013

pawn Код:
CMD:tempo(playerid, params[])
{
    new
        Temp[10]
    ;
   
    if(sscanf(params, "s[10]", Temp))
    return SendClientMessage(playerid, -1, "Uso й /tempo [ Nome ]");
   
    SetWorldTime(NT(Temp));

    return 1;
}

stock NT(str[])
{
    new                        
        _sk = -1
    ;
    if(!strcmp(str, "dia", true)) _sk = 9;
    if(!strcmp(str, "tarde", true)) _sk = 20;
    if(!strcmp(str, "noite", true)) _sk = 24;
    return _sk;
}



Re: error 035: argument type mismatch (argument 1) - Duun - 27.02.2013

Valeu Supera !


Re: error 035: argument type mismatch (argument 1) - Gii - 27.02.2013

Cуdigo mais simples:

pawn Код:
CMD:tempo(playerid, params[] ) {

    if (isnull(params))
        return SendClientMessage(playerid, -1, "Uso:/tempo [descriзгo]");
       
    if ( strcmp (params, "dia", true) == 0 )
        SetWorldTime(9);
    else if ( strcmp (params, "tarde", true) == 0 )
        SetWorldTime(20);
    else if ( strcmp (params, "noite", true) == 0 )
        SetWorldTime(24);
    else
        SendClientMessage(playerid, -1, "Parametros inseridos invalidos!");

    return true;
}