I am working on a piece of my Colony RP where you need to pay resources to spawn vehicles. It spams the console with unable to find function getdatablock()
function fxDTSBrick::setVehicle(%brick, %vehicle)
{
if(isObject(%brick.getGroup().client) && isObject(%vehicle))
{
%CostWood = %vehicle.getdatablock().CostWood;
%CostSteel = %vehicle.getdatablock().CostSteel;
if(%Costwood >= 1 || %Coststeel >= 1)
{
%client = %brick.getGroup().client;
if(%client.Colonies["Wood"] >= %Costwood && %client.Colonies["Steelbar"] >= %CostSteel)
{
%client.Colonies["Wood"] -= %costwood;
%client.Colonies["Steelbar"] -= %costSteel;
parent::setVehicle(%brick, %vehicle);
}
else
{
%vehicle = 0;
return;
messageClient(%brick.getGroup().client, '', "\c6You need at least \c3" SPC %Costwood @ "\c6Wood and \c3" SPC %CostSteel @ "\C6Steel.");
}
}
else
{
%vehicle = 0;
return;
}
}
}
I want it to make you lose the amount of resources specified in the vehicle's datablock as well as return and not force you to pay when the vehicle has an error when spawning, such as stuck in terrain.
It's packaged by the way, just didn't feel like pasting the whole mega package.