question about an array - 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: question about an array (
/showthread.php?tid=433968)
question about an array -
dusk - 30.04.2013
So i have this array,
pawn Код:
new gangDB[MAX_GANGS][giitem];
and for reason when loading i want it to not load into the 0th slot. Is it possible too skip it? I'm using a for loop to load stuff into it and just couldn't think of a way.
pawn Код:
new rows,fields;
cache_get_data(rows,fields);
for(new i; i<rows; i++)
{
new tmp[64];
cache_get_row(i,0,tmp,dbHandler); gangDB[i][gid]=strval(tmp);
cache_get_row(i,1,tmp,dbHandler); format(gangDB[i][Leader],sizeof(tmp),tmp);
}
Re: question about an array -
dusk - 30.04.2013
Thats all well, but won't it then start from the 1st line of data? and skip the 0th?
Re: question about an array -
Scenario - 30.04.2013
If you set the variable to 1 it's going to start the loop with i equaling 1. So, yes, 0 is skipped.
Re: question about an array -
dusk - 30.04.2013
Wait, you mean like
to
?
Re: question about an array -
Scenario - 30.04.2013
You are declaring i and the default value is 0.
If you want i to equal 1 and skip 0, then you have to set it to 1.
pawn Код:
for(new i = 1; i<rows; i++)
Re: question about an array -
dusk - 30.04.2013
thats the thing i don't want to skip it,kind of, i want it to start putting into an array like gangDB[1][gid], but i want the 0th line from my DB
Re: question about an array -
dusk - 30.04.2013
Because my brain decided that it will fail on the second try...which doesn't matter now,because everything is working fine! I thank you all, and invite you to look at my other problems.
http://forum.sa-mp.com/showthread.ph...51#post2504051
https://sampforum.blast.hk/showthread.php?tid=429376&page=3