SA-MP Forums Archive
error: array sizes do not match - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: error: array sizes do not match (/showthread.php?tid=224897)



error: array sizes do not match - Lumixa - 12.02.2011

hi ppl i need help when i compile gm i have 2 errors

D:\Lumix\LARP\LA-RPv1.5\gamemodes\larp.pwn(1629 : error 047: array sizes do not match, or destination array is too small
D:\Lumix\LARP\LA-RPv1.5\gamemodes\larp.pwn(16795) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.



this errors


Script:
-----------------------------------------------------
if(strcmp(cmd, "/trunk", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new x_nr[64];
x_nr = strtok(cmdtext, idx); <--- i think something here is wrong please help(Line:16795)
if(!strlen(x_nr))
{

------------------------------------------------------






Re: error: array sizes do not match - Medal Of Honor team - 12.02.2011

i don't see anything wrong. Try replacing cmdtext with cmd


Re: error: array sizes do not match - Lumixa - 12.02.2011

thx bro but dont work same errors any helps?


Re: error: array sizes do not match - Shadow™ - 12.02.2011

Increase the size of the string from [64] to [128], if it works then decrease the string until you get the errors so you're not stuff you don't need.


Re: error: array sizes do not match - Lumixa - 12.02.2011

Worksssssssssssssssss thxxxxxxxxxxxxxxx man thank you ))) [64] changed to [256]


Re: error: array sizes do not match - Mean - 12.02.2011

Ah, an edit.
Anyways, you should consider using SSCANF + ZCMD instead of STRCMP + STRTOK, because ZCMD + SSCANF is much faster!


Respuesta: error: array sizes do not match - Code8976Man - 12.02.2011

why [256], use [128]!


Re: Respuesta: error: array sizes do not match - Mean - 13.02.2011

Quote:
Originally Posted by Code8976Man
Посмотреть сообщение
why [256], use [128]!
Because TMP size must be minimum of 255, otherwise it will give you the same error. Also, strtok is outdated and slow, use SSCANF!


Re: error: array sizes do not match - Lumixa - 15.02.2011

yea i used 128 too but same errors, with 256 works fine


AW: error: array sizes do not match - Nero_3D - 15.02.2011

you just use one of the fucked up strtok's with an array size of 256
Even in the wiki or pawn-lang.pdf are the versions with the index 20
Just copy this code and use the cmd array instead of a new one

But I rly advise to use sscanf, the plugin or the old pawn code version which are both faster and easier than strtok