Author Topic: Detecting if a player's inventory has changed?  (Read 1053 times)

Is there any kind of callback function for when a player's inventory has been changed (e.g. through the setInventory event)? If not, what would be an ideal way to determine this?

theres no callback when an inventory changes. two of your options include:
  • run a schedule loop on a player checking their %player.tool[%i] slots for changes
  • packaging armor::onCollision, giveDefaultInventory, cleartools, gameconnection::spawnplayer, etc (aka all functions that give/remove players items)

i dont know if theres any other way to do this other than the methods above. id personally go with the schedule loop cause packaging will involve a stuff ton of functions and probably break a bunch of mods. you can safely run the loop very fast since its just value comparisons, which wont lag the server significantly