04.05.2011, 16:23
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;
}