Maximum Number for For Loop
#1

Hello All i have a loop to check some stuff. If i set a for loop like
Code:
for(new i=0; i<600000; i++)
this causes Command Crash and returns me Command Not Found. What is the maximum number i can have it checked?
Reply
#2

For loops can be infinite, what's causing the crash is what you're using with it.
Reply
#3

i used to use MAX_OBJECTS which is 1000 instead of 600000 only thing i changed in the command is that and when it was MAX_OBJECTS it worked fine.
Reply
#4

Well since you haven't posted any code, I can only assume you're creating or modifying objects. The for loop does not have a limit, but objects do, hence the 'MAX_OBJECTS' defined value.
Reply
#5

The for loop itself can't be causing a crash, but something that deals with the variable being incremented may be causing it to crash. Perhaps something you're doing is causing a stack overflow, I'd suggest compiling the script with debugging features and using something such as crashdetect so you can get a stack trace of what's going on once it crashes.

To compile with debugging features enabled:
pawn Code:
pawncc yourscript.pwn -;+ -(+ -d3
Crashdetect:
https://github.com/Zeex/samp-plugin-crashdetect
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)