data/creaturescripts/scripts
local config = {
name = "monster_name", --Nome do monstro.
minDamage = 7000, --Dano mínimo para receber as recompensas.
items = {
prize = {itemid, count}, --{ID do item, quantidade}
medal = xxx, --ID da medalha.
},
storage = 91828,
}
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) and isMonster(cid) and getCreatureName(cid) == config.name and type == STATSCHANGE_HEALTHLOSS then
local damage = getPlayerStorageValue(attacker, config.storage) < 1 and 0 or getPlayerStorageValue(attacker, config.storage)
setPlayerStorageValue(attacker, config.storage, damage + value)
end
return true
end
function onDeath(cid, corpse, deathList)
for _, pid in pairs(deathList) do
local damage = getPlayerStorageValue(pid, config.storage)
if damage >= config.minDamage then
doPlayerSendTextMessage(pid, 27, "For helping killing "..config.name..", you received a medal and "..config.items.prize[2].."x "..getItemNameById(config.items.prize[1])..".")
doPlayerAddItem(pid, config.items.prize[1], config.items.prize[2])
doItemSetAttribute(doPlayerAddItem(pid, config.items.medal, 1), "description", "Medalha de honra ganha por "..getCreatureName(pid).." por ajudar a derrotar o "..config.name.." no dia "..os.date("%D")..".")
setPlayerStorageValue(pid, config.storage, -1)
end
end
db.executeQuery("UPDATE player_storage SET value = -1 WHERE key = "..config.storage)
return true
end
<event type="statschange" name="mDamage" event="script" value="nome_do_arquivo.lua"/> <event type="death" name="mItems" event="script" value="nome_do_arquivo.lua"/>
registerCreatureEvent(cid, "mDamage")
<script>
<event name="mItems"/>
</script>






info
Grupo: Visconde
Registrado: 02/10/13
Posts: 320
Reputação: +22
Gênero: Masculino
Então, o script funciona assim, todos os jogadores que ajudarem a matar o monstro, ganham tal item. Mas para ganhar o item, você vai precisar ajudar o monstro, ou seja, teria que tirar no minimo 7k de life do bixo.
Outra coisa, todos que matarem o bixo, também recebem uma medalha, escrito:
You see a medal of honour.
Medalha de honra ganha por ..... por ajudar a derrotar o Monstro Doidao no dia ......