Author Topic: Inventory Item Adding  (Read 776 times)

I've been working on a script to add an item to your inventory when you first spawn, but it doesn't seem to be working correctly...

Code: [Select]
package addItemTest
{
function gameConnection::onClientEnterGame(%client)
{
Parent::onClientEnterGame(%client);
messageClient(%client,'MsgItemPickup','',4,skiItem.getID());
}
};
activatePackage(addItemTest);

Anyone know what is wrong with my script? Thanks.

The MsgItemPickup callback just tells the client what they should be displaying in the inventory gui. You will need to also tell the server what item they have in which slot.

The MsgItemPickup callback just tells the client what they should be displaying in the inventory gui. You will need to also tell the server what item they have in which slot.

Thank you, Ephialtes, but now I have another problem... How do I tell the server what item was added? Thanks.
Sorry, I am very new to programming...
« Last Edit: March 09, 2010, 12:26:38 PM by General »

How do I tell the server what item was added?
%player.tool[%slot] = %item;

%player.tool[%slot] = %item;

I've added that function, but the item is still not added to your inventory...

Code: [Select]
package addItemTest
{
function gameConnection::onClientEnterGame(%client)
{
Parent::onClientEnterGame(%client);
%client.tool[4] = skiItem.getID();
messageClient(%client,'MsgItemPickup','',4,skiItem.getID());
}
};
activatePackage(addItemTest);

What is meant to go where %client.tool is to identify the client?

EDIT: I've also tried %player, but I get the same result...
« Last Edit: March 10, 2010, 11:36:12 AM by General »

%client.player.tool[4] = ...

Also, this will only happen when they spawn for the first time.

Thank you, Chrono, it's about time I finish my project after working on it for a long time... Also, I know this will only happen the first time the player spawns, it's just a test.

Great, I still need hep... Is there a function which checks if you've changed your datablock?
« Last Edit: March 11, 2010, 01:41:42 PM by General »

No, but there's functions called to change your datablock.

Never mind, got it working correctly, thanks.