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



error 047: array sizes do not match, or destination array is too small - Xenforox - 18.07.2014

Hello buddies, i've been making my own adminname system, i'm using y_ini to save/load players data
This is the error i get.
pawn Код:
error 047: array sizes do not match, or destination array is too small
and this is the line
pawn Код:
PlayerInfo[id][AdminName] = name;
Help me please.


Re: error 047: array sizes do not match, or destination array is too small - Konstantinos - 18.07.2014

sizeof won't work with arrays from enums and format is slow for copying strings. Use strcat instead:

pawn Код:
#define strcpy(%0,%1) strcat((%0[0] = '\0', %0), %1)
and
pawn Код:
// Usage: strcpy(destination, source, lenght)
strcpy(PlayerInfo[id][AdminName], name, MAX_PLAYER_NAME);
// change the size to higher if it's needed.



Re : error 047: array sizes do not match, or destination array is too small - Xenforox - 18.07.2014

I got this warning
pawn Код:
warning 201: redefinition of constant/macro (symbol "strcpy(%0,%1)")



Re : error 047: array sizes do not match, or destination array is too small - S4t3K - 18.07.2014

Then use this :

pawn Код:
#if defined strcpy
      #undef strcpy
      #define strcpy(%0,%1) strcat((%0[0] = '\0', %0), %1)
#endif