Hello! im triying to put a scriptname i did in scriptname column in item_template but item dont load the scriptname also if i put the scriptname in an item that already have a scripname the item continue loading the old scriptname, can someone help me with this please? im very confused :s





This is the script i did:



Code:
class llave_cofre : public ItemScript
{
public:
    llave_cofre() : ItemScript("llave_cofre") { }

    bool OnUse(Player player, Item item, SpellCastTargets const& /*targets*/)
    {
        uint32 itemId = item->GetEntry();
        uint64 playerGuid = player->GetGUID();
        bool disabled = false;
        
        QueryResult result = CharacterDatabase.PQuery("SELECT `item` FROM `character_inventory` WHERE guid = %u AND item = 34477", playerGuid);
        if (result) 
        {
            player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
            return true;
        }
        else
        {
            return false;
        }
    }
};