I know the ui name, and the datablock name, how would i rip this code to make it so i can use it in a function to add whatever to an inventory?
registerOutputEvent("Player", "addItem", "datablock ItemData", 1);
function Player::addItem(%player,%image,%client)
{
for(%i = 0; %i < %player.getDatablock().maxTools; %i++)
{
%tool = %player.tool[%i];
if(%tool == 0)
{
%player.tool[%i] = %image;
%player.weaponCount++;
messageClient(%client,'MsgItemPickup','',%i,%image);
break;
}
}
}