Ir para conteúdo

Featured Replies

Postado

Pessoal, estou utilizando o seguinte script de alavanca porém, ele está dando alguns erros.

 

 
local config = {
    [45690] = {potion = 7618, cost = 1000, backpack_id = 2000}, -- health potion
    [5002] = {potion = 7588, cost = 2500, backpack_id = 2000}, -- strong health potion
    [5003] = {potion = 7591, cost = 5000, backpack_id = 2000}, -- great health potion
 
    [5004] = {potion = 7620, cost = 5000, backpack_id = 2001}, -- mana potion
    [5005] = {potion = 7589, cost = 5000, backpack_id = 2001}, -- string mana potion
    [5006] = {potion = 7590, cost = 5000, backpack_id = 2001}, -- great mana potion
} -- config end --
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local potion = config[item.id]
    if isInArray({9827, 9828}, item.itemid) ~= TRUE then
        return TRUE
    end
    if doPlayerBuyItemContainer(cid, potion.backpack_id, potion.potion, 1, potion.cost, 1) == TRUE then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You bought a backpack "..getItemNameById(potion.potion).." for "..potion.cost.." gold coins.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need "..potion.cost.." gold coins for a backpack "..getItemNameById(potion.potion)..".")
    end
    return TRUE
end
 

 

Lua Script Error: [Action Interface]
data/actions/scripts/other/alavancas.lua:onUse
data/actions/scripts/other/alavancas.lua:17: attempt to index local 'potion' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/actions/scripts/other/alavancas.lua:17: in function <data/actions/scripts/other/alavancas.lua:12>

 

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 520.1k

Informação Importante

Confirmação de Termo