SA-MP Forums Archive
array problem - 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 problem (/showthread.php?tid=333113)



array problem - rati555 - 10.04.2012

pawn Код:
new  
   Interiors[ 11 ][ iInfo ]={  
   { 1, "N1", 243.7176,304.9697,999.1484 },  
   { 3, "N2", 2495.9456,-1692.0854,1014.7422 },  
   { 10,"N3 [ • ]", 422.5720,2536.4568,10.0000 },  
   { 5,"N4 [ • • ]", 2233.6184,-1115.2618,1050.8828 },  
   { 9,"N5", 2317.7410,-1026.7661,1050.2178 },  
   { 10,"N6", 2259.3816,-1135.8962,1050.6403 },  
   { 3,"N7[ • • • ]", 235.2910,1186.6793,1080.2578 },  
   { 1,"N8[ • • ]", 223.1530,1287.0830,1082.1406 },  
   { 5,"N10 [ • • • ]", 226.2990,1114.3126,1080.9929 },  
   { 2,"N11 [ • • ]", 447.0905,1397.0645,1084.3047 },  
   { 10,"N12[ • • ]", 23.9724,1340.1591,1084.3750}
   } ;
pawn Код:
for(new x = 0; x < sizeof ( Interiors ); x++)  
            {
                 new str[400];             
        strcat( str, Interiors[ x ][ iName ] ), strcat( str,"\n" );  
                 ShowPlayerDialog(playerid, DIALOG_HOUSE3 , DIALOG_STYLE_LIST, "{FFFFFF}Choose Interior", str, "Choose", "Cancel");  
            }
but this dialog shows only N12


Re: array problem - Harish - 10.04.2012

try this
pawn Код:
new str[400];
new Fstr[128];
for(new x = 0; x < sizeof ( Interiors ); x++)  
            {
         format(Fstr,128,"%s\n",Interiors[ x ][ iName ]);
        strcat( str, Fstr)        
            }
ShowPlayerDialog(playerid, DIALOG_HOUSE3 , DIALOG_STYLE_LIST, "{FFFFFF}Choose Interior", str, "Choose", "Cancel");



Re: array problem - Luis- - 10.04.2012

pawn Код:
format(Fstr,128,'"%s\n",Interiors[ x ][ iName ]);
Should be;
pawn Код:
format(Fstr,128,"%s\n",Interiors[ x ][ iName ]);



Re: array problem - rati555 - 10.04.2012

it worked rep ++ both of you