SA-MP Forums Archive
Create Faction errors - 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: Create Faction errors (/showthread.php?tid=349631)



error 047: array sizes do not match, or destination array is too small - cloudysky - 09.06.2012

Yeah hey, recently made a thread about saving problems, these are now fixed but I've got these now errors now, which is related to this command as far as I know.

Errors
pawn Код:
: error 047: array sizes do not match, or destination array is too small
error 047: array sizes do not match, or destination array is too small
error 047: array sizes do not match, or destination array is too small
 error 047: array sizes do not match, or destination array is too small
 error 047: array sizes do not match, or destination array is too small
 error 047: array sizes do not match, or destination array is too small
 error 047: array sizes do not match, or destination array is too small
error 047: array sizes do not match, or destination array is too small
And this is the command, I add this and the errors appear.

pawn Код:
command(createfaction, playerid, params[])
{
    new fname[150], r1[150], r2[150], r3[150], r4[150], r5[150], r6[150], r7[150];
    if( sscanf( params, "zzzzzzzz", fname, r1, r2, r3, r4, r5, r6, r7))
    CreateFaction(fname, r1, r2, r3, r4, r5, r6, r7);
    SendClientMessage(playerid, COLOUR_RED, "DONE" );
    return 1;
}
Lines the errors appear on...
pawn Код:
Faction[i][FactionName] = dini_Get(Factionfile, "FactionName" );
            Faction[i][FactionRank1] = dini_Get(Factionfile, "FactionRank1" );
            Faction[i][FactionRank2] = dini_Get(Factionfile, "FactionRank2" );
            Faction[i][FactionRank3] = dini_Get(Factionfile, "FactionRank3" );
            Faction[i][FactionRank4] = dini_Get(Factionfile, "FactionRank4" );
            Faction[i][FactionRank5] = dini_Get(Factionfile, "FactionRank5" );
            Faction[i][FactionRank6] = dini_Get(Factionfile, "FactionRank6" );
            Faction[i][FactionRank7] = dini_Get(Factionfile, "FactionRank7" );



Re: Create Faction errors - cloudysky - 09.06.2012

Sorry for the double post but I need this fixed :S?


Re: Create Faction errors - Faisal_khan - 09.06.2012

Use format. Like this:

pawn Код:
format(Faction[i][FactionName], MAX_STRING, "%s",dini_Get(Factionfile, "FactionName" ));
format(Faction[i][FactionRank1], MAX_STRING, "%s",dini_Get(Factionfile, "FactionRank1" ));
format(Faction[i][FactionRank2], MAX_STRING, "%s",dini_Get(Factionfile, "FactionRank2" ));
format(Faction[i][FactionRank3], MAX_STRING, "%s",dini_Get(Factionfile, "FactionRank3" ));
format(Faction[i][FactionRank4], MAX_STRING, "%s",dini_Get(Factionfile, "FactionRank4" ));
format(Faction[i][FactionRank5], MAX_STRING, "%s",dini_Get(Factionfile, "FactionRank5" ));
format(Faction[i][FactionRank6], MAX_STRING, "%s",dini_Get(Factionfile, "FactionRank6" ));
format(Faction[i][FactionRank7], MAX_STRING, "%s",dini_Get(Factionfile, "FactionRank7" ));



Re: Create Faction errors - cloudysky - 09.06.2012

It takes away the errors but when I use the command in game it says: "Strings without a length are depreciated please add a destination size." in the server.exe


Re: Create Faction errors - Faisal_khan - 09.06.2012

LOL forgot this, add this on top, below includes:
pawn Код:
#define MAX_STRING 128