Author Topic: Giving items.  (Read 1079 times)

I'm trying to script up a shop system, that by typing /buyitem (Or /buygun for example) that it deducts cash from the person, and gives that person the gun.

Everything in the script is working, exept for the fact that once you get the gun, and it shows up in your inventory, but you can't use it, or even scroll to it.
Code: [Select]
for(%i = 0; %i < 5; %i++)
{
%toolDB = %client.player.tool[%i];

if(!%toolDB)
{
%client.player.tool[%i] = gunItem;
%client.player.weaponCount++;

messageClient(%client.player.client, 'MsgItemPickup', '', %i, gunItem);

%client.cash = %client.cash - %cost;

break;
}
}
Thats the part of the code that I think is stuffing up.

nice idea, don't think I can help though :(

Make a database to remember peoples money.

Runeth, wtf does that have to do with the problem?

also
%client.inventory[%i] = gunItem;//add this one
%client.player.tool[%i] = nametoID(gunItem);//replace the one you have with this one
messageClient(%client, 'MsgItemPickup', '', %i, nametoID(gunItem));//replace the one you have with this one

That should work.

Runeth, wtf does that have to do with the problem?

also
%client.inventory[%i] = gunItem;//add this one
%client.player.tool[%i] = nametoID(gunItem);//replace the one you have with this one
messageClient(%client, 'MsgItemPickup', '', %i, nametoID(gunItem));//replace the one you have with this one

That should work.


Er no, %client.inventory is for bricks. How can you have gotten this far without knowing that?

By posting that off the top of my head.

Runeth, wtf does that have to do with the problem?

also
%client.inventory[%i] = gunItem;//add this one
%client.player.tool[%i] = nametoID(gunItem);//replace the one you have with this one
messageClient(%client, 'MsgItemPickup', '', %i, nametoID(gunItem));//replace the one you have with this one

That should work.

It's a suggestion...