Author Topic: Can't add items on player spawn :/  (Read 584 times)

It seems not to work. It echoes as it does add items but it actually can't?

Code: [Select]
function Player::addItem(%player,%tools)
{
if($UiNameTableCreated == false)
createUiNameTable();

%client = %player.client;
for (%i = 0; %i < %player.getDatablock().maxTools; %i++)
{
%tool = %player.tool[%i];
if(%tool == 0)
{
// Add tool
%toolID = $uiNameTable_Items[getField(%tools, %i)];
%player.tool[%i] = %toolID;
messageClient(%client, 'MsgItemPickup', "", %i, %toolID);
}
}
}

function Player::giveEquipments(%player)
{
//This only refers to physical items
if(%player.client.item["Jack"])
%itemque = "Jackhammer";
if(%player.client.item["Drillbit"])
%itemque = %itemque TAB "Drill-bit";

%player.addItem(%itemque);
echo("** Adding " @ %itemque @ " to " @ %player.client.getplayername());
}
« Last Edit: November 16, 2009, 07:29:00 AM by Jaydee »



Can anyone give a simple layout for adding items?

If you have the "addItem" event enabled it might be overwriting your function.

If you have the "addItem" event enabled it might be overwriting your function.

Its not enabled. I even tried using the event itself. Is there a function in which it can convert ItemData > ID?