80
« on: October 14, 2013, 08:47:11 PM »
function Player::giveTool(%this,%image)
{
if(getWordCount(%image) == 1)
{
for(%i = 0; %i < %this.getDatablock().maxTools; %i++)
{
%tool = %this.tool[%i];
talk(%tool);
if(!%tool)
{
%this.tool[%i] = %image;
%this.weaponCount++;
messageClient(%this.client,'MsgItemPickup','',%i,%image.getID());
break;
}
}
}
else
{
for(%j=0;%j<getWordCount(%image);%j++)
{
%img = getWord(%image,%j);
for(%i = 0; %i < %this.getDatablock().maxTools; %i++)
{
%tool = %this.tool[%i];
if(!%tool)
{
%this.tool[%i] = %img;
%this.weaponCount++;
messageClient(%this.client,'MsgItemPickup','',%i,%img.getID());
break;
}
}
}
}
}
There are no console errors. Though when I call
findclientbyname(brian).player.giveTool("hammerItem");
it does not work.
edit: adding in the messageClient .getID(), it makes it so it appears in my tools, but opening it nothing shows up in my hand.