Loop Not Work
#1

I made a object loop for create 20 objects but with this command created one object.

Код:
new LoopTimer;
LoopTimer = SetTimerEx("LoopTunnel", 100, true, "");
Код:
forward LoopTunnel();
public LoopTunnel()
{
	for(new Objects; Objects < 20; Objects++)
	{
	  new Float:X = -38;
		CreateObject(13666, X, 2492, 30, 0, 0, 0);
		Objects++;
		X += 5;
		if(Objects == 20)
		{
		  KillTimer(LoopTimer);
		  break;
		}
		else continue;
	}
}
Who is the error.
Reply
#2

Quote:
Originally Posted by _TeRmiNaToR_
I made a object loop for create 20 objects but with this command created one object.

Код:
new LoopTimer;
LoopTimer = SetTimerEx("LoopTunnel", 100, true, "");
Код:
forward LoopTunnel();
public LoopTunnel()
{
	for(new Objects; Objects < 20; Objects++)
	{
	  new Float:X = -38;
		CreateObject(13666, X, 2492, 30, 0, 0, 0);
		Objects++;
		X += 5;
		if(Objects == 20)
		{
		  KillTimer(LoopTimer);
		  break;
		}
		else continue;
	}
}
Who is the error.
Код:
forward LoopTunnel();
public LoopTunnel()
{
    new Float:X = -38;// create X before the loop

	for(new Objects; Objects < 20; Objects++)
	{
         
	  //new Float:X = -38; //you create and set X at each step of loop.
		CreateObject(13666, X, 2492, 30, 0, 0, 0);
		Objects++;
		X += 5;
		if(Objects == 20)
		{
		  KillTimer(LoopTimer);
		  break;
		}
		else continue;
	}
}
Reply
#3


This time give me crash for invalid object id.
I use 0.3a RC-4-4
Reply
#4

Then use a correct object ID, the problem with your function is that you're creating all 20 objects in the same spot, so you won't notice the difference.
Reply
#5

Quote:
Originally Posted by Joe Staff
Then use a correct object ID, the problem with your function is that you're creating all 20 objects in the same spot, so you won't notice the difference.
What must I ?

_________________________________________________

When I add in ongamemodeinit are work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)