Author Topic: Mining? messageClient  (Read 888 times)

Hello again, Well this time I am trying to make it so that after your done mining it will say GoldOre: Number, SilverOre: Number, CopperOre: Number, But when your done mining it show's just the number like

10
6
7

Code: [Select]
//Oreearning////////////////////////////////////////////////////////////////////

function regrow(%brick){//recreate the brick
  %brick.setcolor(%brick.realcolor);//reset its color
  %brick.setcolliding(1);//make it collidable
  %brick.setraycasting(1);//make it hammerable
}

package Ore
{
    function hammerProjectile::oncollision(%this,%obj,%col,%fade,%pos,%normal)
    {
        if(!isobject(%col)){return;}//if there isnt a %col, dont continue
        if(%col.getDatablock() $= nametoid("brick2x2discData"))// nametoid(blah);
        {
            %col.hits++;//amount of hits taken plus 1
            if(%col.hits>=15){//10 hits
             %random = getRandom(1,100);
if(%random >= 1 && %random <= 10)
{
%obj.client.quantity["GoldOre"]+=getrandom(1,1);
}
else if(%random >= 11 && %random <= 30)
{
%obj.client.quantity["SilverOre"]+=getrandom(1,1);
}
else if(%random >=31 && %random <= 100)
{
%obj.client.quantity["CopperOre"]+=getrandom(1,1);
}
messageClient(%obj.client,'Ore  : %1',%obj.client.quantity["CopperOre"]);
messageClient(%obj.client,'Ore  : %1',%obj.client.quantity["GoldOre"]);
messageClient(%obj.client,'Ore  : %1',%obj.client.quantity["SilverOre"]);
             %col.realcolor = %col.getColorID();//get the bricks color
             %col.setcolor(63);//make it invisible
             %col.setcolliding(0);//make it walk-through
             %col.setraycasting(0);//make it unhammerable
             %col.hits=0;//reset the number of hits it takes
             %col.sched = schedule(15000,0,regrow,%col);//schedule the regrow in 25 seconds
         return;
        }else{return;}//otherwise return so it doesnt get hammered
        }
        Parent::onCollision(%this,%obj,%col,%fade,%pos,%normal);
    }
};
ActivatePackage(Ore);

I know it's not really an organized solution, but just try it.

Code: [Select]
%orestring = "Ore  :";
messageClient(%obj.client,'%2 %1',%obj.client.quantity["CopperOre"],%orestring);
messageClient(%obj.client,'%2 %1',%obj.client.quantity["GoldOre"],%orestring);
messageClient(%obj.client,'%2 %1',%obj.client.quantity["SilverOre"],%orestring);

If that don't work then I don't know.

Quote from: code
   messageClient(%obj.client, '', 'Ore  : %1', %obj.client.quantity["CopperOre"]);
   messageClient(%obj.client, '', 'Ore  : %1', %obj.client.quantity["GoldOre"]);
   messageClient(%obj.client, '', 'Ore  : %1', %obj.client.quantity["SilverOre"]);
You just need to add in an extra argument to your messageClient function calls.