SA-MP Forums Archive
array sizes do not match, or destination array is too small - 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: array sizes do not match, or destination array is too small (/showthread.php?tid=631646)



array sizes do not match, or destination array is too small - GoldenLion - 02.04.2017

Hi, I'm getting this error
Код:
error 047: array sizes do not match, or destination array is too small
at this line
Код:
MapInfo[0][Name] = "CS_TEST";
Even if I leave it blank it gives me that error or if I use strcat then it still stays empty. Everything is OK, I have
Код:
Name[20]
in the enumerator so it should be working. What's up?

EDIT: I added size to strcat and it works now, but why can't I just do MapInfo[0][Name] = ...?


Re: array sizes do not match, or destination array is too small - iKarim - 02.04.2017

Because, in PAWN, strings are arrays, so you'd probably have to do:
PHP код:
MapInfo[0][Name] = {'C''S''_''T''E''S''T''\0'}; 



Re: array sizes do not match, or destination array is too small - GoldenLion - 02.04.2017

Quote:
Originally Posted by PawnHunter
Посмотреть сообщение
Because, in PAWN, strings are arrays, so you'd probably have to do:
PHP код:
MapInfo[0][Name] = {'C''S''_''T''E''S''T''\0'}; 
I know, but it's still usually possible to do that. Also I tried your method and it gives the same error. :P


Re: array sizes do not match, or destination array is too small - Nero_3D - 02.04.2017

No clue why but "arrays" from an enum are treated different than normal arrays

It only works if the source and destination have the same size
PHP код:
new name[20];
name "CS_TEST"// well that works for normal arrays
MapInfo[0][Name] = name// same size