One simple error
#1

Well I've got this error

PHP код:
error 010invalid function or declaration 
Code:

PHP код:
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;
    }
    return 
0//ERROR HERE!!!!!!!!!!!!!!!!!

Reply
#2

Try This
Код:
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;
}
Reply
#3

try removing the bracket above
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;
    return 0; //ERROR HERE!!!!!!!!!!!!!!!!!
}
Reply
#4

When I delete it I get even more errors.
Quote:

C:\Users\Maki\Desktop\server 0.3d\filterscripts\TwinkisFS.pwn(2920) : warning 225: unreachable code
C:\Users\Maki\Desktop\server 0.3d\filterscripts\TwinkisFS.pwn(2920) : error 079: inconsistent return types (array & non-array)

Reply
#5

Try the one I posted

Код:
Return 0;
Doesn't Need to Be there because it returns to a result.
Reply
#6

Oh tried that. No errors. Thanks!
Reply
#7

No Problem I do this to help people Succeed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)