strtok problems
#2

Wrong; AddPlayerClass is a function, not a statement.
strtok shouldn't be placed in a callback. Fixed script:

pawn Код:
public OnGameModeInit()
{
    new string[MAX_PLAYER_NAME];
    SetGameModeText("WW-Stunts Beta");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

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;
}
That should be okay
Reply


Messages In This Thread
strtok problems - by BizzyD - 14.03.2011, 20:46
Re: strtok problems - by Kwarde - 14.03.2011, 20:50
Re: strtok problems - by Stigg - 14.03.2011, 20:51
Re: strtok problems - by BizzyD - 14.03.2011, 21:08

Forum Jump:


Users browsing this thread: 1 Guest(s)