Author Topic: When you drop an item...  (Read 788 times)

When you drop an item, how can you trigger something? OnThrow doesn't do anything, it seems...

Code: [Select]
function servercmdDropTool(%client,%slot)
 {
  if(!isObject(%client.player.tool[%slot])) return;
  if(%client.player.tool[%slot].getName() $= "itemname")
  {
   messageall('',"Message");
  }
}
That's the closest I've got, but as you can see, it doesn't actually drop the item. Is there no other choice but to manually find out what happens when you drop an item and slap it in? (Yes, this was in a package).

Quote
package drop
function servercmdDropTool(%client,%slot)
 {
  if(!isObject(%client.player.tool[%slot])) return;
  if(%client.player.tool[%slot].getName() $= "itemname")
  {
   //messageall('',"Message"); Functions you want to happen
   //return; Add this if you don't want it to drop the tool
  }
  Parent::servercmdDropTool(%client,%slot); //Always call the parent (real) function unless you are completely overriding it. Here, you're only adding an extra check, so you should call it
}
};activatepackage(drop);

Parent::servercmdDropTool(%client,%slot);
... Thank you, I'm handicapped.