Problema com 2 Errors!
#1

Entгo, to com problema com 2 errors na hora de compilar!
Aqui os erros:

Код:
(13974) : error 021: symbol already defined: "strtok"
(13989) : error 047: array sizes do not match, or destination array is too small
Aqui as linhas dos erros:

13973 << postei essa linha porque na linha do erro (13974) sу tem um { '-'
pawn Код:
strtok(const string[], &index)
13974:
pawn Код:
{
13989:
pawn Код:
return result;

Agora o codigo todo:

pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply
#2

Apague a strtok toda porque ela jб estб definida.

Eae DJ '-' Aqui й o Most :]
Reply
#3

#define strtok strtok2
#pragma unused strtok
Reply
#4

Quote:
Originally Posted by Diogo_braz
Посмотреть сообщение
Apague a strtok toda porque ela jб estб definida.

Eae DJ '-' Aqui й o Most :]
Iaee most
Tipo apagar a strtok toda б para apagar todo o codigo ae?
Sou iniciante '-'
Eu tentei apagar esse:

pawn Код:
strtok(const string[], &index)
Ai deu super erro!



@Rcop
Tipo, й pra eu colocar esses 2 no define ou sу o primeiro, porque o segundo ta parecendo tipo uma zuaзгo kk!
Poe os 2 ou sу o primeiro?
Reply
#5

Apagar todo o code que vocк postou!
Reply
#6

Eu tirei aqui e parece que desativo o comando /ban!
Porque ele й ligado com o /ban eu acho! Porque o Knife que fez pra mim.
Aqui o codigo do meu meu /ban:

pawn Код:
if ( strcmp( cmd, "/ban", true)   == 0)
    {
        if ( IsPlayerConnected( playerid)  )
        {
            tmp = strtok( cmdtext, idx)   ;
            if ( !strlen( tmp)  )
            {
                SendClientMessage( playerid, COLOR_GRAD2, "Use : /ban [Id / Nome] [razгo]")   ;
                return 1 ;
            }
            giveplayerid = ReturnUser( tmp)   ;
            if ( PlayerInfo[playerid][pAdmin] >= 1)
            {
                if ( IsPlayerConnected( giveplayerid)   && PlayerInfo[giveplayerid][pAdmin] == 0)
                {
                    if ( giveplayerid != INVALID_PLAYER_ID)
                    {
                        GetPlayerName( giveplayerid, giveplayer, sizeof( giveplayer)  )   ;
                        GetPlayerName( playerid, sendername, sizeof( sendername)  )   ;
                        new length = strlen( cmdtext)   ;
                        while ( ( idx < length)   && ( cmdtext[idx] <= ' ')  )
                        {
                            idx++ ;
                        }
                        new offset = idx ;
                        new result[64] ;
                        while ( ( idx < length)   && ( ( idx - offset)   < ( sizeof( result)   - 1)  )  )
                        {
                            result[idx - offset] = cmdtext[idx] ;
                            idx++ ;
                        }
                        result[idx - offset] = EOS ;
                        if ( !strlen( result)  )
                        {
                            SendClientMessage( playerid, COLOR_GRAD2, "Use : /ban [Id / Nome] [reason]")   ;
                            return 1 ;
                        }
                        new year, month,day ;
                        getdate( year, month, day)   ;
                        if ( strcmp( result,"1",true)   == 0)   { result = "Uso de cheat" ; }
                        format( string, sizeof( string)  , "%s foi banido por %s, razгo: %s ( %d-%d-%d)  ", giveplayer, sendername, ( result)  ,month,day,year)   ;
                        BanLog( string)   ;
                        format( string, sizeof( string)  , "%s foi banido por %s, razгo: %s", giveplayer, sendername, ( result)  )   ;
                        SendClientMessageToAll( COLOR_LIGHTRED, string)   ;
new cooordstring[256],lstring[256] ;
format( lstring, sizeof( lstring)  , "Vocк foi banido pelo Administrador %s\n\nMotivo : %s\n\nCaso ache que foi algum erro visite nosso forum\n               FORUM AKI\n",sendername,( result)  )   ;
strcat( cooordstring,lstring)   ;
ShowPlayerDialog( giveplayerid, 1000, DIALOG_STYLE_MSGBOX, "Banido", cooordstring, "Ok", "Fechar")   ;
strmid( BanInfo[giveplayerid][bMotivo], string, 0, strlen( string)  , 256)   ;
strmid( BanInfo[giveplayerid][bQuemBaniu], giveplayer, 0, strlen( giveplayer)  , 256)   ;
BanInfo[giveplayerid][bBan] = 1 ;
SBan( giveplayerid)   ;
                        return 1 ;
                    }
                }//not connected
            }
            else
            {
                format( string, sizeof( string)  , "   %d is not an active player.", giveplayerid)   ;
                SendClientMessage( playerid, COLOR_GRAD1, string)   ;
            }
        }
        return 1 ;
    }
Reply
#7

@edit
Reply
#8


Nem confunda o cara
Se vocк nгo sabe diferenciar strtok de stock nгo vem falar bobagem okay ? (Y)

@ Edit
RodiauOUI nгo adianta usar @edit por que vc ja falo a merda e a menssagem ta dada

@OFF
Nem й BPT.
Eu que ajudei ele em algumas coisas.
E eu que fiz a parada do BanInfo pro DJ Bruninho.
Reply
#9

Quote:
Originally Posted by [FeK]Knife
Посмотреть сообщение

Nem confunda o cara
Se vocк nгo sabe diferenciar strtok de stock nгo vem falar bobagem okay ? (Y)

@ Edit
RodiauOUI nгo adianta usar @edit por que vc ja falo a merda e a menssagem ta dada

@OFF
Nem й BPT.
Eu que ajudei ele em algumas coisas.
E eu que fiz a parada do BanInfo pro DJ Bruninho.
Sim, o Knife que faz para mim, Knife nгo da pra entra msn agora porque vou jantar, ai mais tarde eu entro talvez.

@Badio
Eu tentei mudar para Strtok2
E deu os mesmos erros:

pawn Код:
(58437) : warning 203: symbol is never used: "strtok2"
Sу que meu GM vai atй a linha 58437.
E mesmo assim ele esta bloqueando o /ban ainda ;(

Acho que sу o Knife pra ajuda!
Reply
#10

Isto deve resolver o seu problema:


Apague todo este cуdigo do seu GM e compile:

pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

Se o comando /ban continuar causando bugs troque-o por:


pawn Код:
if(strcmp("/ban", cmdtext, true, 3) == 0)
    {
        if ( IsPlayerConnected( playerid)  )
        {
            tmp = KcmD(1, cmdtext);
            if ( !strlen( tmp)  )
            {
                SendClientMessage( playerid, COLOR_GRAD2, "Use : /ban [Id / Nome] [razгo]")   ;
                return 1 ;
            }
            giveplayerid = strval(tmp);
            new result[64];
            result = KcmD(2, cmdtext);
            if ( PlayerInfo[playerid][pAdmin] >= 1)
            {
                if ( IsPlayerConnected( giveplayerid)   && PlayerInfo[giveplayerid][pAdmin] == 0)
                {
                    if ( giveplayerid != INVALID_PLAYER_ID)
                    {
                        GetPlayerName( giveplayerid, giveplayer, sizeof( giveplayer)  )   ;
                        GetPlayerName( playerid, sendername, sizeof( sendername)  )   ;
                        if ( !strlen( result)  )
                        {
                            SendClientMessage( playerid, COLOR_GRAD2, "Use : /ban [Id / Nome] [reason]")   ;
                            return 1 ;
                        }
                        new year, month,day ;
                        getdate( year, month, day)   ;
                        if ( strcmp( result,"1",true)   == 0)   { result = "Uso de cheat" ; }
                        format( string, sizeof( string)  , "%s foi banido por %s, razгo: %s ( %d-%d-%d)  ", giveplayer, sendername, ( result)  ,month,day,year)   ;
                        BanLog( string)   ;
                        format( string, sizeof( string)  , "%s foi banido por %s, razгo: %s", giveplayer, sendername, ( result)  )   ;
                        SendClientMessageToAll( COLOR_LIGHTRED, string)   ;
                        new cooordstring[256],lstring[256] ;
                        format( lstring, sizeof( lstring)  , "Vocк foi banido pelo Administrador %s\n\nMotivo : %s\n\nCaso ache que foi algum erro visite nosso forum\n               FORUM AKI\n",sendername,( result)  )   ;
                        strcat( cooordstring,lstring)   ;
                        ShowPlayerDialog( giveplayerid, 1000, DIALOG_STYLE_MSGBOX, "Banido", cooordstring, "Ok", "Fechar")   ;
                        strmid( BanInfo[giveplayerid][bMotivo], string, 0, strlen( string)  , 256)   ;
                        strmid( BanInfo[giveplayerid][bQuemBaniu], giveplayer, 0, strlen( giveplayer)  , 256)   ;
                        BanInfo[giveplayerid][bBan] = 1 ;
                        SBan( giveplayerid)   ;
                        return 1 ;
                    }
                }//not connected
            }
            else
            {
                format( string, sizeof( string)  , "   %d is not an active player.", giveplayerid)   ;
                SendClientMessage( playerid, COLOR_GRAD1, string)   ;
            }
        }
        return 1 ;
    }

E adicione no Final do GM:

pawn Код:
stock KcmD(param, cmdtext[])
{
    new string[128], pos, var;
    format(string, sizeof(string), "%s ", cmdtext);

    while((pos = strfind(string, " ", true)) != -1)
    {
        if(var == param) return string;
        var++;

        strdel(string, 0, pos + 1);
        if(strcmp(string, " ", true, pos) == 0) goto end;
    }

end:
    string[0] = '\0';
    return string;
}

Espero ter ajudado
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)