Author Topic: Brick killing function not working properly  (Read 348 times)

Yes, I am making a Brick Teleporter.

function BrickTeleProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
   %player = %obj.client.player;

   if(!%player)
      return;

   %colData = %col.getDataBlock();
   %colDataClass = %colData.classname;

   if(%colDataClass $= "brick")
   {
      %col.KillBrick();
   }
}

It just won't work.

Yes, I am making a Brick Teleporter.

function BrickTeleProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
   %player = %obj.client.player;

   if(!%player)
      return;

   %colData = %col.getDataBlock();
   %colDataClass = %colData.classname;

   if(%colDataClass $= "brick")
   {
      %col.KillBrick();
   }
}

It just won't work.
Try this:
Code: [Select]
function BrickTeleProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
%player = %obj.client.player;

if(!%player)
return;

%colData = %col.getDataBlock();
%colDataClass = %col.getClassName();

if(%colDataClass $= "fxDtsBrick")
{
%col.delete();
}
}
I changed %colDataClass = %colData.classname; to %colDataClass = %col.getClassName(); and if(%colDataClass $= "brick") to if(%colDataClass $= "fxDtsBrick") and I changed %col.KillBrick(); to %col.delete();