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=613456)



Error 047: array sizes do not match, or destination array is too small - LoLeRo - 28.07.2016

Hi, i have a error when i compile my server, how to fix it?

Код:
error 047: array sizes do not match, or destination array is too small
Код:
        ....,
	ClanR,
	ClanName[35],  //variable declaration
	Skin,
        ....,
Код:
PlayerInfo[playerid][ClanName] = "Without clan."; //Line error
Thanks!!


Re: Error 047: array sizes do not match, or destination array is too small - AlexPalermitano97 - 28.07.2016

ClanName[24]...try


Respuesta: Re: Error 047: array sizes do not match, or destination array is too small - LoLeRo - 28.07.2016

Quote:
Originally Posted by AlexPalermitano97
Посмотреть сообщение
ClanName[24]...try
I'm getting the same error


Re: Error 047: array sizes do not match, or destination array is too small - VVWVV - 28.07.2016

pawn Код:
static const some_str[] = "Without clan.";
memcpy(PlayerInfo[playerid][ClanName], some_str, 35 - 1, sizeof some_str * 4, 35);
But, you can use other functions (strcpy, etc...)

pawn Код:
#if defined strcpy
    #undef strcpy
#endif

#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)



Respuesta: Error 047: array sizes do not match, or destination array is too small - LoLeRo - 28.07.2016

Mmm that's some complicated to me, is there any other way to save a string for each player? (in game)


Re: Respuesta: Error 047: array sizes do not match, or destination array is too small - VVWVV - 28.07.2016

Quote:
Originally Posted by LoLeRo
Посмотреть сообщение
Mmm that's some complicated to me, is there any other way to save a string for each player? (in game)
No, but you can use other functions (strcpy).


Respuesta: Error 047: array sizes do not match, or destination array is too small - LoLeRo - 28.07.2016

Ok thanks!


Re: Error 047: array sizes do not match, or destination array is too small - Dragony92 - 28.07.2016

pawn Код:
strins(PlayerInfo[playerid][ClanName], "Without clan.", 0, 35);
or
strpack(PlayerInfo[playerid][ClanName], "Without clan.", 35);
or
strmid(PlayerInfo[playerid][ClanName], "Without clan.", 0, strlen("Without clan."), 35);
or
format(PlayerInfo[playerid][ClanName], 35, "Without clan.");



Respuesta: Re: Error 047: array sizes do not match, or destination array is too small - LoLeRo - 28.07.2016

Quote:
Originally Posted by Dragony92
Посмотреть сообщение
pawn Код:
strins(PlayerInfo[playerid][ClanName], "Without clan.", 0, 35);
or
strpack(PlayerInfo[playerid][ClanName], "Without clan.", 35);
or
strmid(PlayerInfo[playerid][ClanName], "Without clan.", 0, strlen("Without clan."), 35);
or
format(PlayerInfo[playerid][ClanName], 35, "Without clan.");
I'll use format method, thanks!!