You may want to turn %brick.getDatablock().getName() into a variable instead of calling those functions every time if you plan to add mediumFoodBrick and largeFoodBrick
datablock fxDTSBrickData (smallFoodBrick)
{
brickFile = "./smallfood.blb";
category = "Special";
subCategory = "DayZ";
uiName = "1 Food";
iconName = "";
};
package FoodBricks
{
function fxDTSBrick::onActivate(%brick, %obj, %client, %pos, %dir)
{
parent::onActivate(%brick, %obj, %client, %pos, %dir);
%data = %brick.getDatablock().getName();
if(%data $= "smallFoodBrick")
{
%client.food++;
commandtoclient(%client,'centerPrint',"You found food.");
}
}
};
activatePackage(FoodBricks);