14.05.2011, 18:03
im now doing the normal admin script on the samp wiki, and it said that using it requires "ReturnUser", "strtok" and "IsNumeric". where can i find these and plz tell me how do i use them ?
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;
}
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;
}