Ir para conteúdo

Featured Replies

Postado
Alguem sabe me ajudar?
 
Here's my error
Lua Script Error: [Action Interface]


data/actions/scripts/reward_chest.lua:OnUse
data/actions/scripts/reward_chest.lua:10: attempt to call method 'getAttribute'
(a nil value)
stack traceback:
[C]: in function 'getAttribute'
data/actions/scripts/reward_chest.lua:10: in function <data/actions/scri
pts/reward_chest.lua:1>
 
Here's my script
function onUse(player, item, fromPosition, target, toPosition, isHotkey)


    -- Reward Chest
    if item.itemid == 21584 then
        if player:getExhaustion(REWARD_CHEST.STORAGE) > 0 then
            return player:sendCancelMessage('You need to wait ' .. string.diff(player:getStorageValue(REWARD_CHEST.STORAGE) - os.time()) .. ' before using this chest again.')
        end
        player:updateRewardChest()
    -- Boss Corpse
    elseif item.actionid == 21584 then
        local reward = REWARD_CHEST.LOOT[tonumber(item:getAttribute('text'))][player:cid()]
        if reward then
            local rewardBag = Container(doCreateItemEx(REWARD_CHEST.CONTAINER, 1))
            addContainerItems(rewardBag, reward)
            if player:getCapacity() < rewardBag:getCapacity() then
                return player:sendCancelMessage(RETURNVALUE_NOTENOUGHCAPACITY)
            end
 
            if player:addItemEx(rewardBag, false) == RETURNVALUE_NOERROR then
                REWARD_CHEST.LOOT[tonumber(targetitem:getAttribute('text'))][player:getGuid()] = nil
                player:sendCancelMessage('You have picked up a reward container.')
            else
                player:sendCancelMessage(RETURNVALUE_NOTENOUGHROOM)
                return true
            end
        end
    end
    return false
end
 
thanks

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo