SA-MP Forums Archive
[Ajuda] sscanf2 + zcmd = unknown command - 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] sscanf2 + zcmd = unknown command (/showthread.php?tid=355570)



[Ajuda] sscanf2 + zcmd = unknown command - F_Cinco - 30.06.2012

1° - Excluir a callback OnPlayerCommandText
2° - Comandos adicionados no fim do gm
3° - Adicionada a callback OnPlayerCommandPerformed
4° - returns 1; adicionados no fim de cada comando
5° - GM compilando com sucesso

Resultado: FS funcionando normal(no caso sу estou usando o gl_realtime), e todos os comando no qual digito da unknown command.

Ex. de alguns comandos:

pawn Код:
CMD:gmx(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return SCM(playerid,-1,"Tu nгo й Admin!");
    GetPlayerName(id,nome,sizeof(nome));
    format(Str,sizeof(Str),"Reiniciando o Servidor!",id,nome);
    GameTextForAll(Str,4000,3);
    SendRconCommand("gmx");
    return 1;
}
pawn Код:
CMD:arrumarv(playerid)
{
    if(!IsPlayerAdmin(playerid)) return SCM(playerid,-1,"Tu nгo й Admin!");
    SetVehicleHealth(playerid,1000.0);
    return 1;
    }



Re: [Ajuda] sscanf2 + zcmd = unknown command - .FuneraL. - 30.06.2012

Quote:
Originally Posted by F_Cinco
Посмотреть сообщение
1° - Excluir a callback OnPlayerCommandText
2° - Comandos adicionados no fim do gm
3° - Adicionada a callback OnPlayerCommandPerformed
4° - returns 1; adicionados no fim de cada comando
5° - GM compilando com sucesso

Resultado: FS funcionando normal(no caso sу estou usando o gl_realtime), e todos os comando no qual digito da unknown command.

Ex. de alguns comandos:

pawn Код:
CMD:gmx(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return SCM(playerid,-1,"Tu nгo й Admin!");
    GetPlayerName(id,nome,sizeof(nome));
    format(Str,sizeof(Str),"Reiniciando o Servidor!",id,nome);
    GameTextForAll(Str,4000,3);
    SendRconCommand("gmx");
    return 1;
}
pawn Код:
CMD:arrumarv(playerid)
{
    if(!IsPlayerAdmin(playerid)) return SCM(playerid,-1,"Tu nгo й Admin!");
    SetVehicleHealth(playerid,1000.0);
    return 1;
    }
Tenta retirar o FS e Utilizar algum Comando, Veja se Sai isto.


Re: [Ajuda] sscanf2 + zcmd = unknown command - F_Cinco - 30.06.2012

Nгo deu man, q problema LoL, credo! :S nгo faзo ideia do q possa ser.


Re: [Ajuda] sscanf2 + zcmd = unknown command - .FuneraL. - 30.06.2012

Quote:
Originally Posted by F_Cinco
Посмотреть сообщение
Nгo deu man, q problema LoL, credo! :S nгo faзo ideia do q possa ser.
Vish :> , jб excluiu minhas possibilidades de conflito , problema em public... sei lб '-', Exclusгo da OnPlayerCommandText...


Re: [Ajuda] sscanf2 + zcmd = unknown command - F_Cinco - 30.06.2012

...


Re: [Ajuda] sscanf2 + zcmd = unknown command - sanalex - 30.06.2012

Muito estranho isso, vc nгo tб colocando os comandos em alguma public?, verifique tudo com calma.


Re: [Ajuda] sscanf2 + zcmd = unknown command - zbt - 30.06.2012

Vocк utiliza mais de uma pasta com arquivos do samp?

Ex: Vocк tem arquivos do samp no Meus Documentos, outra no Disco C, outra no Disco D.


Re: [Ajuda] sscanf2 + zcmd = unknown command - F_Cinco - 30.06.2012

Quote:
Originally Posted by zbt
Посмотреть сообщение
Vocк utiliza mais de uma pasta com arquivos do samp?

Ex: Vocк tem arquivos do samp no Meus Documentos, outro no Disco C, outro no Disco D.
Sim! mais jб realizei a exclusгo.


------
Encontrei o maldidO erro '-', ao da //#include sscanf2, tudo se normalizou, mais quando aos demais comandos q uso com sscanf :S, vcs tem uma sscanf aк q funfe sem problemas?


Re: [Ajuda] sscanf2 + zcmd = unknown command - zbt - 30.06.2012

Faзa o seguinte, retire a include sscanf e o plugin, use apenas a stock sscanf no seu script.

pawn Код:
stock sscanf(string[], format[], {Float,_}:...)
{
    #if defined isnull
        if (isnull(string))
    #else
        if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
    #endif
    {
        return format[0];
    }
    #pragma tabsize 4
    new
        formatPos = 0,
        stringPos = 0,
        paramPos = 2,
        paramCount = numargs(),
        delim = ' ';
    while (string[stringPos] && string[stringPos] <= ' ')
    {
        stringPos++;
    }
    while (paramPos < paramCount && string[stringPos])
    {
        switch (format[formatPos++])
        {
            case '\0':
            {
                return 0;
            }
            case 'i', 'd':
            {
                new
                    neg = 1,
                    num = 0,
                    ch = string[stringPos];
                if (ch == '-')
                {
                    neg = -1;
                    ch = string[++stringPos];
                }
                do
                {
                    stringPos++;
                    if ('0' <= ch <= '9')
                    {
                        num = (num * 10) + (ch - '0');
                    }
                    else
                    {
                        return -1;
                    }
                }
                while ((ch = string[stringPos]) > ' ' && ch != delim);
                setarg(paramPos, 0, num * neg);
            }
            case 'h', 'x':
            {
                new
                    num = 0,
                    ch = string[stringPos];
                do
                {
                    stringPos++;
                    switch (ch)
                    {
                        case 'x', 'X':
                        {
                            num = 0;
                            continue;
                        }
                        case '0' .. '9':
                        {
                            num = (num << 4) | (ch - '0');
                        }
                        case 'a' .. 'f':
                        {
                            num = (num << 4) | (ch - ('a' - 10));
                        }
                        case 'A' .. 'F':
                        {
                            num = (num << 4) | (ch - ('A' - 10));
                        }
                        default:
                        {
                            return -1;
                        }
                    }
                }
                while ((ch = string[stringPos]) > ' ' && ch != delim);
                setarg(paramPos, 0, num);
            }
            case 'c':
            {
                setarg(paramPos, 0, string[stringPos++]);
            }
            case 'f':
            {

                new changestr[16], changepos = 0, strpos = stringPos;
                while(changepos < 16 && string[strpos] && string[strpos] != delim)
                {
                    changestr[changepos++] = string[strpos++];
                }
                changestr[changepos] = '\0';
                setarg(paramPos,0,_:floatstr(changestr));
            }
            case 'p':
            {
                delim = format[formatPos++];
                continue;
            }
            case '\'':
            {
                new
                    end = formatPos - 1,
                    ch;
                while ((ch = format[++end]) && ch != '\'') {}
                if (!ch)
                {
                    return -1;
                }
                format[end] = '\0';
                if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
                {
                    if (format[end + 1])
                    {
                        return -1;
                    }
                    return 0;
                }
                format[end] = '\'';
                stringPos = ch + (end - formatPos);
                formatPos = end + 1;
            }
            case 'u':
            {
                new
                    end = stringPos - 1,
                    id = 0,
                    bool:num = true,
                    ch;
                while ((ch = string[++end]) && ch != delim)
                {
                    if (num)
                    {
                        if ('0' <= ch <= '9')
                        {
                            id = (id * 10) + (ch - '0');
                        }
                        else
                        {
                            num = false;
                        }
                    }
                }
                if (num && IsPlayerConnected(id))
                {
                    setarg(paramPos, 0, id);
                }
                else
                {
                    #if !defined foreach
                        #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
                        #define __SSCANF_FOREACH__
                    #endif
                    string[end] = '\0';
                    num = false;
                    new
                        name[MAX_PLAYER_NAME];
                    id = end - stringPos;
                    foreach (Player, playerid)
                    {
                        GetPlayerName(playerid, name, sizeof (name));
                        if (!strcmp(name, string[stringPos], true, id))
                        {
                            setarg(paramPos, 0, playerid);
                            num = true;
                            break;
                        }
                    }
                    if (!num)
                    {
                        setarg(paramPos, 0, INVALID_PLAYER_ID);
                    }
                    string[end] = ch;
                    #if defined __SSCANF_FOREACH__
                        #undef foreach
                        #undef __SSCANF_FOREACH__
                    #endif
                }
                stringPos = end;
            }
            case 's', 'z':
            {
                new
                    i = 0,
                    ch;
                if (format[formatPos])
                {
                    while ((ch = string[stringPos++]) && ch != delim)
                    {
                        setarg(paramPos, i++, ch);
                    }
                    if (!i)
                    {
                        return -1;
                    }
                }
                else
                {
                    while ((ch = string[stringPos++]))
                    {
                        setarg(paramPos, i++, ch);
                    }
                }
                stringPos--;
                setarg(paramPos, i, '\0');
            }
            default:
            {
                continue;
            }
        }
        while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
        {
            stringPos++;
        }
        while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
        {
            stringPos++;
        }
        paramPos++;
    }
    do
    {
        if ((delim = format[formatPos++]) > ' ')
        {
            if (delim == '\'')
            {
                while ((delim = format[formatPos++]) && delim != '\'') {}
            }
            else if (delim != 'z')
            {
                return delim;
            }
        }
    }
    while (delim > ' ');
    return 0;
}



Re: [Ajuda] sscanf2 + zcmd = unknown command - .FuneraL. - 30.06.2012

Tente com Essa:

http://pastebin.com/8VtK2Dty

Basta salvar com extensгo .inc

@Edit - Ou fazer isso que o ZBT Falou kkk