Ir para conteúdo

Featured Replies

Postado

Estou adaptando um script que encontrei no forum (loot ring) para mostrar mensagem de loot quando matar o monstro.

O script funciona caso o monstro NAO drope uma bag dentro dele (outro container), e  caso for gold, ele nao mostra a quantidade: 17:35 Loot of rat: a gold coin, a gold coin

 

 

Quando o monstro dropa uma bag, eu recebo uma mensagem de erro:  luascriptinterface::luagetcontainersice(). container not found

 

script:

function getContentDescription(uid, comma)
 local ret, i, containers = '', 0, {}
 while i < getContainerSize(uid) do
 local v, s = getContainerItem(uid, i), ''
 local k = getItemDescriptions(v.itemid)
 if k.name ~= '' then
 if v.type > 1 and k.stackable and k.showCount then
 s = v.type .. ' ' .. getItemDescriptions(v.itemid).plural
 else
 local article = k.article
 s = (article == '' and '' or article .. ' ') .. k.name
 end
 ret = ret .. (i == 0 and not comma and '' or ', ') .. s
 if isContainer(v.uid) and getContainerSize(v.uid) > 0 then
 table.insert(containers, v.uid)
 end
 else
 ret = ret .. (i == 0 and not comma and '' or ', ') .. 'an item of type ' .. v.itemid .. ', please report it to gamemaster'
 end
 i = i + 1
 end
 for i = 1, #containers do
 ret = ret .. getContentDescription(containers, true)
 end
 return ret
 end

 local function send(cid, pos, name, party)
 local corpse = getTileItemByType(pos, ITEM_TYPE_CONTAINER).uid
 local ret = isContainer(corpse) and getContentDescription(corpse)
 doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of ' .. name .. ': ' .. (ret ~= '' and ret or 'nothing'))
 if party then
 for _, pid in ipairs(getPartyMembers(party)) do
 doPlayerSendChannelMessage(pid, '', 'Loot of ' .. name .. ': ' .. (ret ~= '' and ret or 'nothing'), TALKTYPE_CHANNEL_W, CHANNEL_PARTY)
 end
 end
 end

 function onKill(cid, target, lastHit)
 if not isPlayer(target) then
 addEvent(send, 0, cid, getThingPos(target), getCreatureName(target), getPartyMembers(cid))
 end
 return true
 end

bump

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

Informação Importante

Confirmação de Termo