error 047: array sizes do not match, or destination array is too small
#1

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

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

Yah, Im sure
Reply
#4

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 ].
Reply
#5

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

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

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.
Reply
#8

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);
     }
}
Reply
#9

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);
     }
}
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)