24.03.2016, 20:47
Код:
new a[5]; a[0]=1; a[1]=4; a[2]=0; a[3]=7; a[4]=0;
I guess start should look something like this...
Код:
for(new i; i<5; i++) { if(a[i]!=0) { // dont know what to do } }
new a[5]; a[0]=1; a[1]=4; a[2]=0; a[3]=7; a[4]=0;
for(new i; i<5; i++) { if(a[i]!=0) { // dont know what to do } }
new a[5];
a[0]=1;
a[1]=4;
a[2]=0;
a[3]=7;
a[4]=0;
----------------------------------
new b[5], count;
for(new i = 0; i < 5; i ++)
{
if(a[i] != 0)
{
b[count] = a[i];
count ++;
}
}
b[random(count)]; // select a random number
pawn Код:
|
new a[5];
a[0]=1;
a[1]=4;
a[2]=0;
a[3]=7;
a[4]=0;
----------------------------------
new b[5][2], count;
for(new i = 0; i < 5; i ++)
{
if(a[i])
{
b[count][0] = a[i];
b[count][1] = i;
count ++;
}
}
b[random(count)]; // select a random number
In that case:
pawn Код:
b[count][1] = the index Also "if(a[i] != 0)" is the same as "if(a[i])". |