Error 047: array sizes do not match, or destination array is too small
#1

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!!
Reply
#2

ClanName[24]...try
Reply
#3

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

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)
Reply
#5

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

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).
Reply
#7

Ok thanks!
Reply
#8

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.");
Reply
#9

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!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)