Author Topic: Why wont this work?  (Read 768 times)

Im working on a mod, and I am trying to make ores and trees, but the bricks wont sense if its a Ore or Tree, and set variables.
Code: [Select]
datablock fxDTSBrickData(CRPIronOreData : brick2x2data)
{
category = "CRPBricks";
subCategory = "CRPOre(Admin)";
uiName = "Iron Ore";
isCRPOre = 1;
CRPOre = 1;
ore = 2;
};
datablock fxDTSBrickData(CRPGoldOreData : brick2x2data)
{
category = "CRPBricks";
subCategory = "CRPOre(Admin)";
uiName = "Gold Ore";
isCRPOre = 1;
CRPOre = 2;
Ore = 5;
};
//Tree: 38
datablock fxDTSBrickData(CRPTreeData : brickPineTreeData)
{
category = "CRPBricks";
subCategory = "CRPLumber(Admin)";
uiName = "Pine Tree";
isCRPLumber = 1;
CRPLumber = 1;
Lumber = 1;
};
package CRPBrickSupport
{
function fxDTSBrick::onPlant(%brick)
{
parent::onPlant(%brick);
%client = findClientbyBL_ID(%brick.stackBL_ID);
if(%brick.getDatablock().CRPOre $= 1)
{
echo(Test);
if(findClientbyBL_ID(%brick.stackBL_ID).isAdmin)
{
%brick.isCRPOre = 1;
%brick.setColor("48");
%brick.Hits = 5;
%brick.HitsB = 5;
%brick.Ore = 2;
}
else
{
%brick.delete();
messageClient(%cl, '', "\c7Sorry, you need to be an admin to plant bricks like these.");
}
}
}
function fxDTSBrick::onPlant(%brick)
{
parent::onPlant(%brick);
%client = findClientbyBL_ID(%brick.stackbl_id);
if(%brick.getDatablock().CRPLumber == 1)
{
if(findClientbyBL_ID(%brick.stackBL_ID).isAdmin)
{
%brick.isCRPLumber = 1;
%brick.setColor("38");
%brick.Hits = 15;
%brick.HitsB = 15;
%brick.Lumber = 1;
}
else
{
%brick.delete();
messageClient(%cl, '', "\c7Sorry, you need to be an admin to plant bricks like these.");
}
}
}
function fxDTSBrick::onPlant(%brick)
{
parent::onPlant(%brick);
%cl = findClientbyBL_ID(%brick.stackbl_id);
if(%brick.getDatablock().CRPOre $= 2)
{
if(findClientbyBL_ID(%brick.stackBL_ID).isAdmin)
{
%brick.isCRPOre = 1;
%brick.setColor("3");
%brick.Hits = 15;
%brick.HitsB = 15;
%brick.Ore = 5;
}
else
{
%brick.delete();
messageClient(%cl, '', "\c7Sorry, you need to be an admin to plant bricks like these.");
}
}
}
};
activatePackage("CRPBrickSupport");

First of all, you're overwriting the same function in the same package.

Second of all, it's city RP.

First of all, you're overwriting the same function in the same package.

Second of all, it's city RP.
Third of all, Pah1023 is an idiot.

Third of all, Pah1023 is an idiot.
Im not an idiot.
First of all, you're overwriting the same function in the same package.

Second of all, it's city RP.
I just noticed that,
And its not a City RP, I completely made this to be a medieval RP.
Code: [Select]
datablock fxDTSBrickData(CRPIronOreData : brick2x2data)
{
category = "CRPBricks";
subCategory = "CRPOre(Admin)";
uiName = "Iron Ore";
isCRPOre = 1;
CRPOre = 1;
ore = 2;
};
datablock fxDTSBrickData(CRPGoldOreData : brick2x2data)
{
category = "CRPBricks";
subCategory = "CRPOre(Admin)";
uiName = "Gold Ore";
isCRPOre = 1;
CRPOre = 2;
Ore = 5;
};
//Tree: 38
datablock fxDTSBrickData(CRPTreeData : brickPineTreeData)
{
category = "CRPBricks";
subCategory = "CRPLumber(Admin)";
uiName = "Pine Tree";
isCRPLumber = 1;
CRPLumber = 1;
Lumber = 1;
};
package CRPBrickSupport
{
function fxDTSBrick::onPlant(%brick)
{
parent::onPlant(%brick);
%client = findClientbyBL_ID(%brick.stackBL_ID);
if(%brick.getDatablock().CRPOre == 1)
{
echo(Test);
if(findClientbyBL_ID(%brick.stackBL_ID).isAdmin)
{
%brick.isCRPOre = 1;
%brick.setColor("48");
%brick.Hits = 5;
%brick.HitsB = 5;
%brick.Ore = 2;
}
else
{
%brick.delete();
messageClient(%cl, '', "\c7Sorry, you need to be an admin to plant bricks like these.");
}
}
if(%brick.getDatablock().CRPLumber == 1)
{
if(findClientbyBL_ID(%brick.stackBL_ID).isAdmin)
{
%brick.isCRPLumber = 1;
%brick.setColor("38");
%brick.Hits = 15;
%brick.HitsB = 15;
%brick.Lumber = 1;
}
else
{
%brick.delete();
messageClient(%cl, '', "\c7Sorry, you need to be an admin to plant bricks like these.");
}
}
if(%brick.getDatablock().CRPOre == 2)
{
if(findClientbyBL_ID(%brick.stackBL_ID).isAdmin)
{
%brick.isCRPOre = 1;
%brick.setColor("3");
%brick.Hits = 15;
%brick.HitsB = 15;
%brick.Ore = 5;
}
else
{
%brick.delete();
messageClient(%cl, '', "\c7Sorry, you need to be an admin to plant bricks like these.");
}
}
}
};
activatePackage("CRPBrickSupport");
Ok, I did this, and now it wont plant the bricks.
« Last Edit: August 04, 2010, 08:32:15 PM by Pah1023 »

Onplant has two args.
First one is datablock, second one is the brick.

That's your problem.

Onplant has two args.
First one is datablock, second one is the brick.

That's your problem.
Oh, thanks, where I got this from said it only had one args.
Edit: I did package A{function fxDTSBrick::onPlant(%data,%brick){echo("Data: "@%data@" Brick"@%brick);parent::onPlant(%data,%brick);}}; and it said %data and %brick is the same thing.
Edit again: but when I did it, it allowing be to build them, but it still says the brick doesn't have any hits.
« Last Edit: August 04, 2010, 11:58:46 PM by Pah1023 »