SA-MP Forums Archive
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)
+--- Thread: Array sizes do not match (/showthread.php?tid=616790)



Array sizes do not match - GoldenLion - 10.09.2016

Hi, I'm making a gamemode right now, but I stumbled across two errors right now.
They are:
Код:
(158) : error 047: array sizes do not match, or destination array is too small
(159) : error 047: array sizes do not match, or destination array is too small
Lines 158 and 159:
Код:
PlayerInfo[playerid][pBannedBy] = "None";
PlayerInfo[playerid][pBanReason] = "None";
This is what I got in the enum:
Код:
pBannedBy[MAX_PLAYER_NAME],
pBanReason[32],
What's wrong with it?


Re: Array sizes do not match - Mister0 - 10.09.2016

try

format(PlayerInfo[playerid][pBannedBy],MAX_PLAYER_NAME,"None");
format(PlayerInfo[playerid][pBanReason],MAX_PLAYER_NAME,"None");


Re: Array sizes do not match - Kaliber - 10.09.2016

Use format:

PHP код:
format(PlayerInfo[playerid][pBannedBy],MAX_PLAYER_NAME,"None");
format(PlayerInfo[playerid][pBanReason],32,"None"); 



Re: Array sizes do not match - GoldenLion - 10.09.2016

Thanks, I knew that before, but I thought that there's something wrong with my code because sometimes the way I did first worked with other strings.