SA-MP Forums Archive
error 047: 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: error 047: array sizes do not match (/showthread.php?tid=348350)



error 047: array sizes do not match - Supercop - 05.06.2012

When loading: (This causes the error)
pawn Код:
Player[playerid][GroupRank] = dini_Get(string, "GroupRank");
Declaring:
pawn Код:
enum PlayerStatistics
GroupRank[256],
Saving:
pawn Код:
dini_Set(string, "GroupRank", Player[playerid][GroupRank]);

help :P


Re: error 047: array sizes do not match - JaKe Elite - 05.06.2012

This is wrong

pawn Код:
Player[playerid][GroupRank] = dini_Get(string, "GroupRank");
This is correct

pawn Код:
format(Player[playerid][GroupRank], 100, "%s", dini_Get(string, "GroupRank"));



Re: error 047: array sizes do not match - Supercop - 05.06.2012

Works, thank you!

Can you explain me the difference please, because other things works on the way I did like that.

Example:
pawn Код:
Player[playerid][Offence1] = dini_Get(string, "Offence1");
perfectly works


AW: error 047: array sizes do not match - Extremo - 05.06.2012

The difference is that it's a text. There's currently no operator to copy a string to a string because of one reason. Pawn is a typeless 32 bit system, it doesn't know what a string is. For pawn a string is like an array. So in order for you to actually do what you ask it to do you'd have to change every byte.

pawn Код:
for(new i = 0; i < sizeof(array); i++)
{
    array[i] = something[i];
}
Hence the format.

Regards.


Re: error 047: array sizes do not match - Supercop - 05.06.2012

Aha, thank you!

You learn something every day.