Author Topic: For loop crash  (Read 463 times)

I'm a scrub at coding so this is probably an easy fix but what am I doing wrong here? The game stops responding when I use the cmd.

Code: [Select]
function serverCmdControl(%client,%brickname)
{
   if(%brickname$="")
return;
   if(%client.isSuperAdmin)
   {
%group = getBrickGroupFromObject(%client);
%count = %group.NTObjectCount["_"@%brickname];
for(%a = 0; %i < %count; %a++)
{
       %brick = %group.NTObject["_"@%brickname, %i];
}
%brick.spawnHoleBot();
%client.setControlObject("_"@%brickname.hBot);
%client.controllingAI = %brickname;
   }
}

function serverCmdStopControl(%client)
{
%client.setControlObject(%client.player);
%client.controllingAI = "";
}

%i < %count will never become true, because you're incrementing %a.