Adding a message when you equip a weapon

Hi, I have a gun system that uses ammo. Would like to add a pop up message to warn the player when they try to equip the gun when the ammo is zero. Is there a plugin like this? At this moment, I only managed to add the warning during battle, which is kinda too late. I can add a message the minute Ammo is zero, but that does not prevent you from equipping the gun. Any suggestion or ideas are welcome.
I think Nerine wrote a plugin similar to what you need last year.

Spoiler: Common Event Equipment
Well, since there wasn't a plugin, I was looking I decided to make one myself, not a greatest plugin, since I just search through rmmz files and try to look for solution, but it works. Actually, this is the first plugin I wrote, so I bet there are tons of stuff you could improve.


JavaScript:
//=============================================================================
// RPG Maker MZ - Common Event Equipment
//=============================================================================

/*:
 * @target MZ
 * @plugindesc Common events / JS snippets when equipping or unequipping items.
 * @author Nerine
 * @help
 *     To use plugin put these tags in weapon/armor notes:
 *
 *     <onEquip: id, id, id>
 *
 *     <onUnequip: id, id, id>
 *
 *     <onEquipJS>
 *     code
 *     code
 *     </onEquipJS>
 *
 *     <onUnequipJS>
 *     code
 *     code
 *     </onUnequipJS>
 *
 * Terms of use:
 *   Free to use and modify as long as you credit me.
 */
((alias) => {
    Game_Actor.prototype.changeEquip = function(slotId, item) {
        let previous = this._equips[slotId].object();
        alias.apply(this, arguments);
        let current = this._equips[slotId].object();
        if (previous && current !== previous) {
            if (typeof previous.meta.onUnequip !== 'undefined'){
                previous.meta.onUnequip.replaceAll(" ", "").split(",").forEach(index => $gameTemp.reserveCommonEvent(index));
            }
            if (previous.note.contains("<onUnequipJS>") && previous.note.contains("</onUnequipJS>")) {
                eval(previous.note.split("<onUnequipJS>")[1].split("</onUnequipJS>")[0]);
            }
        }
        if (item && current === item) {
            if (typeof item.meta.onEquip !== 'undefined') {
                item.meta.onEquip.replaceAll(" ", "").split(",").forEach(index => $gameTemp.reserveCommonEvent(index));
            }
            if (item.note.contains("<onEquipJS>") && item.note.contains("</onEquipJS>")) {
                eval(item.note.split("<onEquipJS>")[1].split("</onEquipJS>")[0]);
            }
        }
    };
})(Game_Actor.prototype.changeEquip);

No credit required for non-commercial games.
Free to use in commercial games, as long as you credit Nerine.

Here's the thread:
@CrocPirate Thanks. The plugin works. Will be perfect for me if the message appears right after the equip and not after the menu screen closes. But I rather have it than no message at all.
I think Nerine wrote a plugin similar to what you need last year.


Here's the thread:

Original thread: https://forums.rpgmakerweb.com/threads/adding-a-message-when-you-equip-a-weapon.147609/