[FilterScript] Simples Processador de Comandos (Usando Strtok)
#8

ATUALIZADO,rs.
Mudado para '\0'

pawn Код:
#define CMD:(%1) if(!strcmp(cmd,%1, true))
#define UsarProcessador new cmd[128],idx;cmd = Processar(cmdtext, idx);
#define UsarParametros new tmp[128],idxp;tmp = Processar(cmdtext, idxp);
Processar(const s[], &i)
{
    new l = strlen(s);while ((i < l) && (s[i] <= ' ')) {
    i++;}new o = i;new r[20];while ((i < l) && (s[i] > ' ') && ((i - o) < (sizeof(r) - 1))) {
    r[i - o] = s[i];i++;}r[i - o] = '\0'; return r;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)