SA-MP Forums Archive
Some help please - 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: Some help please (/showthread.php?tid=621271)



Some help please - Exlivebs - 08.11.2016

The errors : C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(25114) : error 021: symbol already defined: "strtok"
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(25114) : error 003: declaration of a local variable must appear in a compound block
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(25113) : error 010: invalid function or declaration
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(25113 -- 25115) : fatal error 107: too many error messages on one line


The Lines :
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;
}



HELP PLEASE


Re: Some help please - PeanutButter - 08.11.2016

There were some missing brackets

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;




Re: Some help please - Exlivebs - 08.11.2016

I get this when i did it !
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(25114) : error 021: symbol already defined: "strtok"
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(25129) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(26654) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(26714) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(26767) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(27435) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(27494) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28175) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28203) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28214) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28274) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28543) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28570) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28600) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(2860 : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28642) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28650) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28683) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(2872 : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28791) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28849) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28857) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28892) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(28900) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(29127) : error 047: array sizes do not match, or destination array is too small
C:\Users\Admin\Desktop\Backup - Copy\gamemodes\larp.pwn(2943 : error 047: array sizes do not match, or destination array is too small

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


26 Errors.


Re: Some help please - MikeB - 08.11.2016

Just remove strtok, it's already defined...


Re: Some help please - Shaheen - 08.11.2016

you have defined strtok twice...
so find strtok by using ctrl+f and delete one strtok and it should work without any errors.