strtok.inc 420 B

1234567891011121314151617181920
  1. #include <a_samp>
  2. stock strtok(const string[], &index)
  3. {
  4. new length = strlen(string);
  5. while ((index < length) && (string[index] <= ' '))
  6. {
  7. index++;
  8. }
  9. new offset = index;
  10. new result[20];
  11. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  12. {
  13. result[index - offset] = string[index];
  14. index++;
  15. }
  16. result[index - offset] = EOS;
  17. return result;
  18. }