21.12.2013, 18:41
As the title says, my for and while loops jump over 1 at one exact point, when I'm trying to see if a file exists, otherwise my loops does count 1.
Picture of my console where it says which it loads:
An example of a while loop:
Example of a for loop:
FAQ:
OMG ur using the both variables x two times!!!
- No I am not, I am commenting one of the loops when trying to run the other.
Do you get any errors?
- Nope.
Does everything else work?
- Yes, it loads all the pickups properly BESIDES number 1, and it is always the same story.
Have you tried to only print out X?
- Yes, it jumps over number 1 as long as I have the "if(fexist)" statement inside the loop, otherwise the loops work fine.
Too many tabs somewhere!
- No it isn't, when you copy something like this into a forum it will look stupid.
Additional comment
I hope I provided enough with information haha. :P
Picture of my console where it says which it loads:
An example of a while loop:
Код:
new x = 0; new bizStr[128]; while(x < maxBusiness) { format(bizStr, sizeof(bizStr), BusinessPATH, x); if(fexist(bizStr)) { INI_ParseFile(bizStr, "loadbusiness", .bExtra = true, .extra = x); x = CreateDynamicPickup(eStats[x][bizModelID], eStats[x][bizType], eStats[x][bizX], eStats[x][bizY], eStats[x][bizZ], eStats[x][bizVW], eStats[x][bizIW], eStats[x][bizShowTo], eStats[x][bizRange]); printf(bizStr); } x++; }
Код:
for(new x; x < maxBusiness; x++) { new bizStr[128], lol[10]; format(bizStr, sizeof(bizStr), BusinessPATH, x); format(lol, sizeof(lol), "%i", x); printf(lol); if(fexist(bizStr)) { INI_ParseFile(bizStr, "loadbusiness", .bExtra = true, .extra = x); x = CreateDynamicPickup(eStats[x][bizModelID], eStats[x][bizType], eStats[x][bizX], eStats[x][bizY], eStats[x][bizZ], eStats[x][bizVW], eStats[x][bizIW], eStats[x][bizShowTo], eStats[x][bizRange]); printf(bizStr); } }
OMG ur using the both variables x two times!!!
- No I am not, I am commenting one of the loops when trying to run the other.
Do you get any errors?
- Nope.
Does everything else work?
- Yes, it loads all the pickups properly BESIDES number 1, and it is always the same story.
Have you tried to only print out X?
- Yes, it jumps over number 1 as long as I have the "if(fexist)" statement inside the loop, otherwise the loops work fine.
Too many tabs somewhere!
- No it isn't, when you copy something like this into a forum it will look stupid.
Additional comment
I hope I provided enough with information haha. :P