#5

pawn Код:
new tmp[256], idx;
tmp = strtok(params, idx); //or strtok(cmdtext, idx) depends on the cmd engine you are using (for default sa-mp OnPlayerCommandText use (cmdtext, idx) )
if(!strcmp(tmp, "options", true))
{
   .......
}

edit:
if you get an error because of "strtok" add this to your code:
pawn Код:
stock strtok(const string[], &index,seperator=' ')
{
    new length = strlen(string);
    new offset = index;
    new result[128];
    while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }

    result[index - offset] = EOS;
    if ((index < length) && (string[index] == seperator))
    {
        index++;
    }
    return result;
}
Reply


Messages In This Thread
tmp - by omer5198 - 04.05.2011, 16:01
Re: tmp - by Sascha - 04.05.2011, 16:04
Re: tmp - by omer5198 - 04.05.2011, 16:07
Re: tmp - by omer5198 - 04.05.2011, 16:15
Re: tmp - by Sascha - 04.05.2011, 16:23
Re: tmp - by omer5198 - 04.05.2011, 16:29
Re: tmp - by Sascha - 04.05.2011, 16:35

Forum Jump:


Users browsing this thread: 1 Guest(s)