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



array sizes do not match - dominik523 - 10.07.2013

Hello! I want to add command in my gm which allows user to change name of his business. This is for the name:
Код:
enum bizInfo
{
.
.
bName[24]
}
// under stock loadbiz() ...
format(BizInfo[idx][bName], 24, "%s", binfo[13]);
Name of business must not be larger than 24 chars, and when I added command for change name:
Код:
// just part of the code
    if(sscanf(params, "s[24]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bizname [name]");
	BizInfo[idx][bName] = params;
I got an error which says that array sizes do not match, or or destination array is too small. How can I remove that error?


Re: array sizes do not match - Antonio144 - 10.07.2013

I think this will work:
pawn Код:
new name[24];
if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bizname [name]");
    BizInfo[idx][bName] = name;



Re: array sizes do not match - SuperViper - 10.07.2013

You can't set strings like that. You must use the following:

pawn Код:
format(BizInfo[idx][bName], 24, name);



Re: array sizes do not match - dominik523 - 10.07.2013

thank you both for your answers, my command is working now