array sizes do not match
#1

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

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;
Reply
#3

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)