Blockland Forums > Modification Help
Why wont this work?
Pah1023:
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: ---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");
--- End code ---
Chrono:
First of all, you're overwriting the same function in the same package.
Second of all, it's city RP.
Kalphiter:
--- Quote from: Chrono on August 04, 2010, 08:00:54 PM ---First of all, you're overwriting the same function in the same package.
Second of all, it's city RP.
--- End quote ---
Third of all, Pah1023 is an idiot.
Pah1023:
--- Quote from: Kalphiter on August 04, 2010, 08:01:50 PM ---Third of all, Pah1023 is an idiot.
--- End quote ---
Im not an idiot.
--- Quote from: Chrono on August 04, 2010, 08:00:54 PM ---First of all, you're overwriting the same function in the same package.
Second of all, it's city RP.
--- End quote ---
I just noticed that,
And its not a City RP, I completely made this to be a medieval RP.
--- Code: ---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");
--- End code ---
Ok, I did this, and now it wont plant the bricks.
Chrono:
Onplant has two args.
First one is datablock, second one is the brick.
That's your problem.