SA-MP Forums Archive
Porfavor necesito ayuda con 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: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Porfavor necesito ayuda con strtok. (/showthread.php?tid=189050)



Porfavor necesito ayuda con strtok. - arturo clark - 10.11.2010

Hola
Bueno, necesito ayuda con esto porfavor.
Estoy aprendiendo a utilizar strtok, pero cuando trato de hacer un commando me salen algunos errores. :S

Quote:

C:\Documents and Settings\Administrador\Escritorio\Server\DeathMatc h\gamemodes\DeathMatch.pwn(170) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Administrador\Escritorio\Server\DeathMatc h\gamemodes\DeathMatch.pwn(170) : error 033: array must be indexed (variable "cmd")
C:\Documents and Settings\Administrador\Escritorio\Server\DeathMatc h\gamemodes\DeathMatch.pwn(175) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Administrador\Escritorio\Server\DeathMatc h\gamemodes\DeathMatch.pwn(175) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\Administrador\Escritorio\Server\DeathMatc h\gamemodes\DeathMatch.pwn(169) : warning 203: symbol is never used: "idx"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.




Re: Porfavor necesito ayuda con strtok. - The_Moddler - 10.11.2010

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;
}
Pegб eso en tu script, pero te recomendaria que empieses a usar sscanf2+zcmd.