Author Topic: Kickall  (Read 2495 times)

The problem is with your loop:

At the start, it checks the "list":
1. A
2. B
3. C
4. D
5. E

Selects person "1" - "A" and deletes him.
1. X
2. B
3. C
4. D
5. E

The list shifts up due to the way simGroups work to make them easier to handle.
1. B
2. C
3. D
4. E
5. -

%i++;, so it moves to the #2 on the list and deletes him.
1. B
2. X
3. D
4. E
5. -

Shifts up and %i++;.
1. B
2. D
3. E
4. -
5. -

Then it selects the third person.
1. B
2. D
3. X
4. -
5. -

%i > ClientGroup.getCount() - %i equals three, the list now returns two, so it quits leaving two people behind.
Code: [Select]
for(%i=ClientGroup.getCount()-1;%i>-1;%i--)
{
      %cl = ClientGroup.getObject(%i);

      if(!%cl.isSuperAdmin)
      {
         %cl.delete();
      }
}

It just looks more professional with SPC.

You use your way, i'll use mine.