function serverCmdClearColorBricks(%client, %color){ if(!%client.isAdmin) return; if($Server::BrickCount > 0) messageAll('MsgClearBricks', "\c3" @ %client.getPlayerName() @ "\c0 cleared (color name hurr) bricks."); //loop through all bricks %groupCount = MainBrickGroup.getCount(); for(%i = 0; %i < %groupCount; %i++) { %group = MainBrickGroup.getObject(%i); %count = %group.getCount(); for(%j = 0; %j < %count; %j++) { %brick = %group.getObject(%j); //we're only interested in bricks... if(!(%brick.getType() & $TypeMasks::FxBrickAlwaysObjectType)) continue; //and planted... if(!%brick.isPlanted) continue; //and not dead... if(%brick.isDead) continue; %brickData = %brick.getDataBlock().getID(); if(%brickData.category $= "Bricks") { if(%brick.getColorID() == %color) { %brick.killBrick(); } } } }}
//that are on the ground... if(%brick.getDistanceFromGround() != 0) continue; //and planted... if(!%brick.isPlanted) continue; //and not dead... if(%brick.isDead) continue;You have an issue here.
//that are on the ground... if(%brick.getDistanceFromGround() != 0) continue;So only for bricks on the ground?
Oops, just saw that it's still set to say "White bricks"Anyone know how to get a color's name by the color's number?
getColorIDTable(int index)Have fun assigning a name to every color.
0 = red1 = color below red.Start naming%count = -1;%color[%count++] = "Red";%color[%count++] = "color below red";
%count = -1;%color[%count++] = "Red";%color[%count++] = "color below red";%db = getColorIDTable(%color);%finalColor = %colorif(%color[%db]) %finalColor = %color[%db];if($Server::BrickCount > 0) messageAll('MsgClearBricks', "\c3" @ %client.getPlayerName() @ "\c0 cleared "@ %finalColor @" bricks.");
Code: [Select]%count = -1;%color[%count++] = "Red";%color[%count++] = "color below red";%db = getColorIDTable(%color);%finalColor = %colorif(%color[%db]) %finalColor = %color[%db];if($Server::BrickCount > 0) messageAll('MsgClearBricks', "\c3" @ %client.getPlayerName() @ "\c0 cleared "@ %finalColor @" bricks.");It will print the color name if there is no name for it