SA-MP Forums Archive
[DUV] Erro de Strtok - 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: [DUV] Erro de Strtok (/showthread.php?tid=187064)



[DUV] Erro de Strtok - luandriftlogkdr - 31.10.2010

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


Respuesta: [DUV] Erro de Strtok - BiieL - 31.10.2010

apagua a stock


Re: [DUV] Erro de Strtok - [Ips]Guh - 31.10.2010

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
}



Re: [DUV] Erro de Strtok - luandriftlogkdr - 31.10.2010

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;



Respuesta: [DUV] Erro de Strtok - BiieL - 31.10.2010

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


Re: [DUV] Erro de Strtok - zSuYaNw - 31.10.2010

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

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

pawn Код:
new mod[0];



Re: [DUV] Erro de Strtok - luandriftlogkdr - 31.10.2010

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


Respuesta: [DUV] Erro de Strtok - BiieL - 31.10.2010

bota como falei


Re: [DUV] Erro de Strtok - zSuYaNw - 31.10.2010

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


Re: [DUV] Erro de Strtok - jonas_gabriel - 31.10.2010

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.