[DUV] Erro de Strtok
#1

Erro:
pawn Код:
C:\Documents and Settings\PC\Desktop\samp03bsvr_R2_win32\Servidor\gamemodes\StreetRP.pwn(46389) : error 021: symbol already defined: "strtok"
Codigo:
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;
}

Erro:
pawn Код:
C:\Documents and Settings\PC\Desktop\samp03bsvr_R2_win32\Servidor\gamemodes\StreetRP.pwn(46404) : error 047: array sizes do not match, or destination array is too small
Codigo:
pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];//axo q й esse o erro
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;//axo q й esse
    return result;//axo q й esse
}
PS: Os 2 erro й na msm Strtok
Reply
#2

apagua a stock
Reply
#3

ou entao mude para : strtok2
fiicando assim :
Код:
strtok2(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];//axo q й esse o erro
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;//axo q й esse
    return result;//axo q й esse
}
Reply
#4

Puts, vlws, ai como tiro esse warning:

pawn Код:
C:\Documents and Settings\PC\Desktop\samp03bsvr_R2_win32\Servidor\gamemodes\StreetRP.pwn(22401) : warning 219: local variable "mod" shadows a variable at a preceding level
pawn Код:
new mod = 1;
Reply
#5

essa warn eh pq ja existe essa string, apague este new mod = 1;
ou substitua por outra variavel como por exemplo new var = 1;
Reply
#6

tenta:
pawn Код:
new mod[1] = 1;
Ou

pawn Код:
new mod[2];
ou

pawn Код:
new mod[0];
Reply
#7

Deu uns 28 Erros quando coloquei new mod[1] = 1;
Reply
#8

bota como falei
Reply
#9

depende o cуdigo que vocк estб usando.
poste a linha de erro.
Reply
#10

nгo й presiso deletar(tirar) nada й sу vocк trocar as includes que vocк utiliza para copilar o gm eu fiz isso tinha o mesmo erro troquei funciono blz.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)