SA-MP Forums Archive
error 047: array sizes do not match, or destination array is too small - 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, or destination array is too small (/showthread.php?tid=523586)



error 047: array sizes do not match, or destination array is too small - Mriss - 02.07.2014

Okay, I came up with this problem i had never experienced before
Код:
error 047: array sizes do not match, or destination array is too small
These are the lines of error
pawn Код:
INI_String("Owner", HouseInfo[id][hOwner] , 32 );
INI_String("Type", HouseInfo[id][hType] , 32 );
Help


Re: error 047: array sizes do not match, or destination array is too small - Mriss - 02.07.2014

pawn Код:
INI_String("Owner", HouseInfo[id][hOwner] , sizeof(HouseInfo[id][hOwner]));
rp.pwn(5809) : error 017: undefined symbol "name"
rp.pwn(5809) : error 017: undefined symbol "id"
rp.pwn(5809) : error 001: expected token: "]", but found "-identifier-"
rp.pwn(5809) : fatal error 107: too many error messages on one line


Re: error 047: array sizes do not match, or destination array is too small - Mriss - 02.07.2014

Yah, Im sure


Re : Re: error 047: array sizes do not match, or destination array is too small - Clad - 02.07.2014

Quote:
Originally Posted by Mriss
Посмотреть сообщение
pawn Код:
INI_String("Owner", HouseInfo[id][hOwner] , sizeof(HouseInfo[id][hOwner]));
rp.pwn(5809) : error 017: undefined symbol "name"
rp.pwn(5809) : error 017: undefined symbol "id"
rp.pwn(5809) : error 001: expected token: "]", but found "-identifier-"
rp.pwn(5809) : fatal error 107: too many error messages on one line
Error line ? Anyway before line 5809 add ].


Re: error 047: array sizes do not match, or destination array is too small - Beckett - 02.07.2014

That isn't line 5809 because there's no such things as ID, name.


Re: error 047: array sizes do not match, or destination array is too small - Mriss - 02.07.2014

want proof?
Well its line 5810 cuz i added a line now, http://prntscr.com/3ytq7s


Re: error 047: array sizes do not match, or destination array is too small - Dignity - 03.07.2014

Show the lines that occur BEFORE line 5809. Surely you must have enough common sense to figure out that 5809 isn't the correct error line despite the compiler telling you it is.


Re: error 047: array sizes do not match, or destination array is too small - Mriss - 03.07.2014

pawn Код:
stock SaveHouses()
{
    for(new i=1;i < MAX_HOUSES;i++)
    {
        if(HouseIDTaken[i] == 0) continue;

        new uFile[35];
        format(uFile, 35, HOUSE_PATH, i);
        new INI:File = INI_Open(uFile);

        INI_SetTag(File, "House Owner");
        INI_String("Owner", HouseInfo[id][hOwner] , sizeof(HouseInfo[id][hOwner]));
        INI_WriteInt(File, "Owned", HouseInfo[i][hOwned]);
        INI_WriteInt(File, "Price", HouseInfo[i][hPrice]);
        INI_String("Type", HouseInfo[id][hType] , sizeof(HouseInfo[id][hType]));
        INI_WriteFloat(File, "EnterX", HouseInfo[i][hEnterX]);
        INI_WriteFloat(File, "EnterY", HouseInfo[i][hEnterY]);
        INI_WriteFloat(File, "EnterZ", HouseInfo[i][hEnterZ]);
        INI_WriteFloat(File, "EnterA", HouseInfo[i][hEnterA]);
        INI_WriteFloat(File, "ExitX", HouseInfo[i][hExitX]);
        INI_WriteFloat(File, "ExitY", HouseInfo[i][hExitY]);
        INI_WriteFloat(File, "ExitZ", HouseInfo[i][hExitZ]);
        INI_WriteFloat(File, "ExitA", HouseInfo[i][hExitA]);
        INI_WriteInt(File, "EnterInt", HouseInfo[i][hEnterInt]);
        INI_WriteInt(File, "EnterVW", HouseInfo[i][hEnterVW]);
        INI_WriteInt(File, "ExitInt", HouseInfo[i][hExitInt]);
        INI_WriteInt(File, "ExitVW", HouseInfo[i][hExitVW]);
        INI_WriteInt(File, "PickupID", HouseInfo[i][hPickupID]);
        INI_WriteInt(File, "hLock", HouseInfo[i][hLock]);
        INI_Close(File);
     }
}



Re: error 047: array sizes do not match, or destination array is too small - Dignity - 03.07.2014

Where do you use "name"? And the "id" error occured because you had to use "i" (refer to loop variable) and not "id".

pawn Код:
stock SaveHouses()
{
    for(new i=1;i < MAX_HOUSES;i++)
    {
        if(HouseIDTaken[i] == 0) continue;

        new uFile[35];
        format(uFile, 35, HOUSE_PATH, i);
        new INI:File = INI_Open(uFile);

        INI_SetTag(File, "House Owner");
        INI_String("Owner", HouseInfo[i][hOwner] , sizeof(HouseInfo[i][hOwner]));
        INI_WriteInt(File, "Owned", HouseInfo[i][hOwned]);
        INI_WriteInt(File, "Price", HouseInfo[i][hPrice]);
        INI_String("Type", HouseInfo[i][hType] , sizeof(HouseInfo[i][hType]));
        INI_WriteFloat(File, "EnterX", HouseInfo[i][hEnterX]);
        INI_WriteFloat(File, "EnterY", HouseInfo[i][hEnterY]);
        INI_WriteFloat(File, "EnterZ", HouseInfo[i][hEnterZ]);
        INI_WriteFloat(File, "EnterA", HouseInfo[i][hEnterA]);
        INI_WriteFloat(File, "ExitX", HouseInfo[i][hExitX]);
        INI_WriteFloat(File, "ExitY", HouseInfo[i][hExitY]);
        INI_WriteFloat(File, "ExitZ", HouseInfo[i][hExitZ]);
        INI_WriteFloat(File, "ExitA", HouseInfo[i][hExitA]);
        INI_WriteInt(File, "EnterInt", HouseInfo[i][hEnterInt]);
        INI_WriteInt(File, "EnterVW", HouseInfo[i][hEnterVW]);
        INI_WriteInt(File, "ExitInt", HouseInfo[i][hExitInt]);
        INI_WriteInt(File, "ExitVW", HouseInfo[i][hExitVW]);
        INI_WriteInt(File, "PickupID", HouseInfo[i][hPickupID]);
        INI_WriteInt(File, "hLock", HouseInfo[i][hLock]);
        INI_Close(File);
     }
}



Re: error 047: array sizes do not match, or destination array is too small - Konstantinos - 03.07.2014

Never use sizeof with an array + enum because all you'll get is errors.

Make sure that both hOwner and hType are strings in the enum and use their size in INI_String function.