SA-MP Forums Archive
One simple error - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: One simple error (/showthread.php?tid=321097)



One simple error - Twinki1993 - 25.02.2012

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!!!!!!!!!!!!!!!!!




Re: One simple error - GtasaPoliceModz - 25.02.2012

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;
}



Re: One simple error - Tanush123 - 25.02.2012

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!!!!!!!!!!!!!!!!!
}



Re: One simple error - Twinki1993 - 25.02.2012

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)




Re: One simple error - GtasaPoliceModz - 25.02.2012

Try the one I posted

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


Re: One simple error - Twinki1993 - 25.02.2012

Oh tried that. No errors. Thanks!


Re: One simple error - GtasaPoliceModz - 25.02.2012

No Problem I do this to help people Succeed