SA-MP Forums Archive
[Ajuda] 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: [Ajuda] strtok (/showthread.php?tid=154796)



[Ajuda] strtok - Dr_Pawno - 15.06.2010

Код:
C:\DOCUME~1\PC1\MEUSDO~1\DOWNLO~1\Samppp\SAMP0~1.3AR\GAMEMO~1\Teste.pwn(1085) : error 017: undefined symbol "strtok"
C:\DOCUME~1\PC1\MEUSDO~1\DOWNLO~1\Samppp\SAMP0~1.3AR\GAMEMO~1\Teste.pwn(1085) : error 033: array must be indexed (variable "tmp")
C:\DOCUME~1\PC1\MEUSDO~1\DOWNLO~1\Samppp\SAMP0~1.3AR\GAMEMO~1\Teste.pwn(1091) : error 017: undefined symbol "strtok"
C:\DOCUME~1\PC1\MEUSDO~1\DOWNLO~1\Samppp\SAMP0~1.3AR\GAMEMO~1\Teste.pwn(1091) : error 033: array must be indexed (variable "tmp")
Oque й este strtok? pq ele esta aparencendo? numca tive problema com este treco -.-

As linhas:

Код:
85:	    tmp = strtok(cmdtext, idx);
91:	    tmp = strtok(cmdtext, idx);



Re: [Ajuda] strtok - Ricardo_Saddler - 15.06.2010

Coloque isso no seu GM, pode ser em qualquer lugar, menos dentro das publics:

pawn Код:
stock 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;
}