Errors [REP+]
#1

Hello

I have the following errors

pawn Код:
(13239) : error 021: symbol already defined: "strtok"
(13254) : error 047: array sizes do not match, or destination array is too small
(13707) : error 021: symbol already defined: "HexToInt"
Error lines

pawn Код:
stock HexToInt(string[])
{
    if (string[0] == 0)
    {
        return 0;
    }
    new i;
    new cur = 1;
    new res = 0;
    for (i = strlen(string); i > 0; i--)
    {
        if (string[i-1] < 58)
        {
            res = res + cur * (string[i - 1] - 48);
        }
        else
        {
            res = res + cur * (string[i-1] - 65 + 10);
            cur = cur * 16;
        }
    }
    return res;
}

stock 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;
}
When I tried to remove that stocks, the compile worked but when I joined in race (Because it is a part from Ryder's race system) I spawned in the air without a car but in correct position/place

+REP to everyone who will help me
Reply
#2

remove strtok function (you already have one)
same for hextoint
Reply
#3

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
remove strtok function (you already have one)
same for hextoint
I tried to find the second strtok and Hex but I just found the one is shown above
Reply
#4

strtok is old, try to replace it with sscanf.
Much easier to use and more flexible.
Reply
#5

And how I can replace it with sscanf?
Reply
#6

Sscanf is an include, which you can have here:
-> http://lmgtfy.com/?q=SAMP+SSCANF2
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)