SA-MP Forums Archive
|***|Need Help|***| - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: |***|Need Help|***| (/showthread.php?tid=261736)



|***|Need Help|***| - Serifukas - 14.06.2011

Hi all,I need help with this I make new house system in my server and now I get that error can someone help me?

Error:

Код:
data/houseDB.txt(61) : error 047: array sizes do not match, or destination array is too small



Re: |***|Need Help|***| - Jack_Rocker - 14.06.2011

First of all your title for this topic does not help
Second, I dnot know why you put it as a .txt not .inc
Thirdly you need to count how many arrays there are or put into the array Sizeof([arraynamehere])

Jack_Rocker

EDIT: Sorry, I know why it is txt now :L


Re: |***|Need Help|***| - jot16 - 14.06.2011

Quote:
Originally Posted by Serifukas
Посмотреть сообщение
Hi all,I need help with this I make new house system in my server and now I get that error can someone help me?

Error:

Код:
data/houseDB.txt(61) : error 047: array sizes do not match, or destination array is too small
post the code here


Re: |***|Need Help|***| - Cyanide - 14.06.2011

The error is self-explanatory, the error occurs when the array size is too small for the string. Here's an example:

pawn Код:
public OnGameModeInit( )
{
     static
          s_string[4]
     ;
     s_string = "Hello";          
     return true;
}
The error will show up because Hello doesn't match the size of _string.


Re: |***|Need Help|***| - Serifukas - 14.06.2011

This is the code:

Код:
new text[512];	
        new file[128]; print("Kraunami namai");
        for(new house=0; house<pickups[1][namai]+1; house++)
        {
	format(file,sizeof(file),"saves/house/%i",house);
        houseDB[house][nkaina]=150000+random(1000000);
        if(!fexist(file))
        {
        houseDB[house][housetext] = Create3DTextLabel("",0xFFFFFFFF,PickupIDs[house][0],PickupIDs[house][1],PickupIDs[house][2],25, 0, 1);
        format(text,sizeof(text),"Namo {00FF00}%i{FFFFFF} Numeris\n{FFFFFF} Namas parduodamas!\nKaina: {00FF00}%i Lt",house,houseDB[house][nkaina],houseDB[house][setting]);
        Update3DTextLabelText(houseDB[house][housetext],0xFFFFFFFF,text);
        strmid(houseDB[house][owner_name],"no",0,MAX_PLAYER_NAME,MAX_PLAYER_NAME);
        continue;
        }
        new uber[MAX_PLAYER_NAME];
        uber = dini_Get(file,"owner_name");
        strcat(houseDB[house][owner_name], dini_Get(file,"owner_name"));
        strmid(houseDB[house][owner_name],dini_Get(file,"owner_name"),0,MAX_PLAYER_NAME,MAX_PLAYER_NAME);
        houseDB[house][namehash]=dini_Int(file,"hash");
        houseDB[house][setting]=dini_Int(file,"setting");
        houseDB[house][housetext] = Create3DTextLabel("",0xFFFFFFFF,PickupIDs[house][0],PickupIDs[house][1],PickupIDs[house][2],25, 0, 1);
        format(file,sizeof(file),"Namo {00FF00}%i{FFFFFF} Numeris\nNamas nupirktas!\nSavininkas:{FF0000} %s",house,houseDB[house][owner_name]);
        Update3DTextLabelText(houseDB[house][housetext],0xFFFFFFFF,file);
        printf("Namas %i priklauso %s (vidaus ID: %i)",house,houseDB[house][owner_name],houseDB[house][setting]);
        }



Re: |***|Need Help|***| - Serifukas - 14.06.2011

Please help me.


Re: |***|Need Help|***| - park4bmx - 14.06.2011

Which one is line 61 ?


Re: |***|Need Help|***| - SchurmanCQC - 14.06.2011

In the houseDB's enum, make everything that is a STRING, the size of 255, else it won't work.


Re: |***|Need Help|***| - Serifukas - 14.06.2011

That is 61:

Код:
 strcat(houseDB[house][owner_name], dini_Get(file,"owner_name"));



Re: |***|Need Help|***| - SchurmanCQC - 14.06.2011

Change the size of houseDB[house][owner_name] to 255