aviso no drop

Huezin
Por Huezin
em Scripts

Huezin

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 04/10/15Posts: 70

Queria um script que ao player dropar x item de um aviso só para ele ex:

Voce Dropou Demon Shield

zipter98

avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 20/09/12Posts: 2553Gênero: Masculino

Tag:

<event type="kill" name="Drop_info" script="nome_do_arquivo.lua"/>

Código:

local config = {
    itemid = xxx,                         --ID do item.
    drop_message = "Voce dropou %s.",     --Mensagem.
    drop_effect = xxx                     --Efeito que aparecerá em cima da corpse (apenas para o dono da corpse). OPCIONAL! Se não quiser, coloque false.
}
 
function corpse.examine(cid, position, corpse_id)
    if not isPlayer(cid) then return true end
    local corpse = getTileItemById(position, corpse_id).uid
    
    if corpse <= 1 or not isContainer(corpse) then return true end
 
    for slot = 0, getContainerSize(corpse) - 1 do
        local item = getContainerItem(corpse, slot)
        if item.uid <= 1 then return true end
        
        if item.itemid == config.itemid then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, config.drop_message:format(getItemNameById(item.itemid)))

            if config.drop_effect then
                doSendMagicEffect(position, config.drop_effect, cid)
            end
        end
    end
end
 
function onKill(cid, target)
    if not isMonster(target) then return true end
    
    local corpse_id = getMonsterInfo(getCreatureName(target)).lookCorpse
 
    addEvent(corpse.examine, 5, cid, getThingPos(target), corpse_id)
    return true
end
Em login.lua, registre:
registerCreatureEvent(cid, "Drop_info")
PS: É um creatureevent (data/creaturescripts).

Não respondo PMs solicitando suporte. Já existem seções no fórum para isto.

SkyLigh

User X
avatar
Lorde
Lorde

INFOS

Grupo: LordeRegistrado: 23/07/12Posts: 2183Char no Tibia: Kissy

Tópico movido para dúvidas / pedidos resolvidos.

Att,
Kissy