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



array sizes do not match or des....... - TheRaGeLord - 02.08.2015

compiler is giving me these error at this line:

PHP код:
CreateStore(i,Store[i][extX],Store[i][extY],Store[i][extZ],Store[i][sname],Store[i][color],Store[i][Int],Store[i][minm],Store[i][smodel]); 
PHP код:
//Enum
enum sInfo
{
    
stid,
    
sname[30],
    
Float:extX,
    
Float:extY,
    
Float:extZ,
    
Float:intX,
    
Float:intY,
    
Float:intZ,
    
vw,
    
Int,
    
Robbable,
    
minm,
    
pickup,
    
Text3D:text,
    
smodel,
    
scolor[30],
}; 
PHP код:
//Stock
CreateStore(sidFloat:x,Float:y,Float:zsName[30],COLORsInt,minmoney,mid



Re: array sizes do not match or des....... - Mariciuc223 - 02.08.2015

EDIT: You can give me the code where you save / load that things ? [Enums ...]


Re: array sizes do not match or des....... - TheRaGeLord - 02.08.2015

PHP код:
stock SaveStore(sid)
{
    new 
INI:file INI_Open(StorePath(sid));
    
INI_SetTag(file,"Store Data");
    
INI_WriteString(file,"Name",Store[sid][sname]);
    
INI_WriteString(file,"Color",Store[sid][scolor]);
    
INI_WriteFloat(file,"extX",Store[sid][extX]);
    
INI_WriteFloat(file,"extY",Store[sid][extY]);
    
INI_WriteFloat(file,"extZ",Store[sid][extZ]);
    
INI_WriteFloat(file,"intX",Store[sid][intX]);
    
INI_WriteFloat(file,"intY",Store[sid][intY]);
    
INI_WriteFloat(file,"intZ",Store[sid][intZ]);
    
INI_WriteInt(file,"vw",Store[sid][vw]);
    
INI_WriteInt(file,"Int",Store[sid][Int]);
    
INI_WriteInt(file,"minm",Store[sid][minm]);
    
INI_WriteInt(file,"Model",Store[sid][smodel]);
    
INI_Close(file);

PHP код:
forward LoadStore(sidname[],value[]);
public 
LoadStore(sid,name[],value[])
{
    
INI_String("Name",Store[sid][sname]);
    
INI_String("Color",Store[sid][scolor]);
    
INI_Float("extX",Store[sid][extX]);
    
INI_Float("extY",Store[sid][extY]);
    
INI_Float("extZ",Store[sid][extZ]);
    
INI_Float("intX",Store[sid][intX]);
    
INI_Float("intY",Store[sid][intY]);
    
INI_Float("intZ",Store[sid][intZ]);
    
INI_Int("vw",Store[sid][vw]);
    
INI_Int("Int",Store[sid][Int]);
    
INI_Int("minm",Store[sid][minm]);
    
INI_Int("Model",Store[sid][smodel]);
    return 
1;




Re: array sizes do not match or des....... - Mencent - 02.08.2015

Try this:
PHP код:
CreateStore(i,Store[i][extX],Store[i][extY],Store[i][extZ],Store[i][sname],Store[i][scolor],Store[i][Int],Store[i][minm],Store[i][smodel]);
//Stock
CreateStore(sidFloat:x,Float:y,Float:zsName[30],COLOR[30], sInt,minmoney,mid
scolor is a string so you have to declare it like this:
PHP код:
COLOR[30



Re: array sizes do not match or des....... - TheRaGeLord - 02.08.2015

Not working.. I forgot to mention that.. Player has to type in HEX Color that will be save in Store[i][scolor]..


Re: array sizes do not match or des....... - Mencent - 02.08.2015

Can you show us your error with the line? We need more code


Re: array sizes do not match or des....... - TheRaGeLord - 02.08.2015

+ I tried Removing colors.. still getting the same error


Re: array sizes do not match or des....... - TheRaGeLord - 02.08.2015

Error: GM.pwn(543) : error 047: array sizes do not match, or destination array is too small

I've mentioned the lines above,,


Re: array sizes do not match or des....... - Mariciuc223 - 02.08.2015

you use y_ini or mysql ?

EDIT: Show us the whole stock


Re: array sizes do not match or des....... - TheRaGeLord - 02.08.2015

PHP код:
stock CreateStore(sidFloat:xFloat:yFloat:zsName[50],sIntminmoneymid)
{
    
Store[sid][pickup]=CreateDynamicPickup(mid,1,x,y,z);
    new 
str1[129];
    
format(str1,129,"'%s'\nStore ID: %d",sName,sid);
    
Store[sid][text]=CreateDynamic3DTextLabel(str1,-1,x,y,z+1,8);
    
Store[sid][minm]=minmoney;
    
format(Store[sid][sname],50,sName);
    
Store[sid][vw]=19877+sid;
    
Store[sid][smodel]=mid;
    
Store[sid][extX]=x;
    
Store[sid][extY]=y;
    
Store[sid][extZ]=z;
    
Store[sid][Robbable]=1;
    if(
sInt==1)
    {
        
Store[sid][intX]=-25.132598;
        
Store[sid][intY]=-139.066986;
        
Store[sid][intZ]=1003.546875;
        
Store[sid][Int]=16;
    
    }
    else if(
sInt==2)
    {
        
Store[sid][intX]=286.148986;
        
Store[sid][intY]=-40.644397;
        
Store[sid][intZ]=1001.515625;
        
Store[sid][Int]=1;
    
    }
    else if(
sInt==3)
    {
        
Store[sid][intX]=207.737991;
        
Store[sid][intY]=-109.019996;
        
Store[sid][intZ]=1005.132812;
        
Store[sid][Int]=15;
    
    }
    else if(
sInt==4)
    {
        
Store[sid][intX]=369.579528;
        
Store[sid][intY]=-4.487294;
        
Store[sid][intZ]=1001.858886;
        
Store[sid][Int]=9;
    
    }

I used Y_INI