09.01.2011, 14:13
Add This at the end of your script:
pawn Код:
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
pawn Код:
stock IsNumeric(const string[]) {
new length=strlen(string);
if (length==0) return false;
for (new i = 0; i < length; i++) {
if (
(string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+')
|| (string[i]=='-' && i!=0) //
|| (string[i]=='+' && i!=0) //
) return false;
}
if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
return true;
}