looping from 4 to 8? - 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: looping from 4 to 8? (
/showthread.php?tid=458542)
looping from 4 to 8? -
newbienoob - 17.08.2013
new ASD[8];
How can I loop from 4 to 8?
Like this?
for(new s = 4; s < 8; s++) Doesn't work though.
Re: looping from 4 to 8? -
PinkFloydLover - 17.08.2013
Why not use a switch statement?
pawn Код:
switch(ASD)
{
case 4..8:
{
// code
}
}
Re: looping from 4 to 8? -
newbienoob - 17.08.2013
I want to show a textdraws.
pawn Код:
new Text:TD[8];
TD[0] = TextDrawCreate(.....);
TD[1] = TextDrawCreate(.....);
TD[2] = TextDrawCreate(.....);
TD[3] = TextDrawCreate(.....);
TD[4] = TextDrawCreate(.....);
TD[5] = TextDrawCreate(.....);
TD[6] = TextDrawCreate(.....);
TD[7] = TextDrawCreate(.....);
//I just want to show textdraw 4 to 8. So that's why I need to loop it. But I don't know how.
Re: looping from 4 to 8? -
yugecin - 17.08.2013
No idea why it wouldn't work
As alternative, you can use
for(new s=0; s<4; s++)
And then use s+4
Re: looping from 4 to 8? -
PinkFloydLover - 17.08.2013
You shouldn't need a loop for something that small, you could just show the 4 textdraws you want using the 'TextDrawCreate' function
Re: looping from 4 to 8? -
GWMPT - 17.08.2013
so, 1, 2, 3,
4, 5, 6, 7, 8, 9, 10
pawn Код:
for(new i = 4; i <= 8; i++) {
print("Loop %d\n", i);
}
0, 1, 2, 3,
4, 5, 6, 7, 8, 9
pawn Код:
for(new i = 4; i < 8; i++) {
print("Loop %d\n", i);
}
What's the trouble of it?
Re: looping from 4 to 8? -
newbienoob - 17.08.2013
@Kikito: It shows for 1 second, then it's gone.
@PinkFloydLover: I have a lot actually.
EDIT: Fixed! It's another problem actually.