(DCMD) Make one command do several things problem
#6

Quote:
Originally Posted by SharkyKH
pawn Код:
new
text[128],string[128];
They are created but empty.
Use 'strtok'.
pawn Код:
new
  text[128], string[128], idx;
text = strtok(params, idx);
string = strtok(params, idx);
STRTOK Function:
pawn Код:
stock strtok(const string[], &index, seperator=' ')
{
  new length = strlen(string);
  new offset = index;
  new result[127];
  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;
}
The whole point in using dcmd is so i don't have to use strtok and pen_†ĥęGun it works perfectly, thanks.

And no they aren't Sharky, the strings are formatting just fine.
Reply


Messages In This Thread
(DCMD) Make one command do several things problem - by Norn - 24.03.2009, 02:27
Re: (DCMD) Make one command do several things problem - by Backwardsman97 - 24.03.2009, 03:00
Re: (DCMD) Make one command do several things problem - by Norn - 24.03.2009, 03:04
Re: (DCMD) Make one command do several things problem - by TheSh@rk - 24.03.2009, 10:30
Re: (DCMD) Make one command do several things problem - by pen_theGun - 24.03.2009, 11:13
Re: (DCMD) Make one command do several things problem - by Norn - 24.03.2009, 23:37
Re: Delete me - by Backwardsman97 - 24.03.2009, 23:47
Re: Delete me - by Norn - 24.03.2009, 23:50

Forum Jump:


Users browsing this thread: 1 Guest(s)