Ambos (lasthitkiller / mostdamagekiller) recebem um item?
Se for:
bossreward.lua (data\creaturescripts\scripts):
local lasthit = {5432, 1} -- lasthitkiller = {itemid, amount}
local mostdmg = {5432, 1} -- mostdamagekiller = {itemid, amount}
function doPlayerAddDepotItems(pid, item, count) -- function by magus - modified by vodkart
local item, count = {item}, {(count or 1)}
for k, v in ipairs(item) do
local ls = db.getResult("SELECT `sid` FROM `player_depotitems` WHERE `player_id` = "..pid.." ORDER BY `sid` DESC LIMIT 1")
return db.executeQuery("INSERT INTO `player_depotitems` (`player_id`, `sid`, `pid`, `itemtype`, `count`, `attributes`) VALUES ("..pid..", "..(ls:getDataInt("sid")+1)..", 101, "..v..", "..count[k]..", '')") or false
end
end
function onDeath(cid, corpse, deathList)
local last, most = deathList[1], deathList[2]
if isPlayer(last) then
if getPlayerFreeCap(last) > getItemWeightById(lasthit[1], lasthit[2]) then
doPlayerAddItem(last, lasthit[1], lasthit[2])
doPlayerSendTextMessage(last, MESSAGE_INFO_DESCR, 'You have received a reward for being the player that gave the last hit on the BOSS.')
else
doPlayerAddDepotItems(last, lasthit[1], lasthit[2])
doPlayerSendTextMessage(last, MESSAGE_STATUS_CONSOLE_BLUE, 'You have received a reward for being the player that gave the last hit on the BOSS. But you don\'t have enought cap, so it was sent to your depot.')
end
end
if isPlayer(most) then
if getPlayerFreeCap(most) > getItemWeightById(mostdmg[1], mostdmg[2]) then
doPlayerAddItem(most, mostdmg[1], mostdmg[2])
doPlayerSendTextMessage(most, MESSAGE_INFO_DESCR, 'You have received a reward for being the player that gave the most damage on the BOSS.')
else
doPlayerAddDepotItems(most, mostdmg[1], mostdmg[2])
doPlayerSendTextMessage(most, MESSAGE_STATUS_CONSOLE_BLUE, 'You have received a reward for being the player that gave the most damage on the BOSS. But you don\'t have enought cap, so it was sent to your depot.')
end
end
return true
end
Tag - creaturescripts.xml (data\creaturescripts):
<event type="death" name="BOSSReward" event="script" value="bossreward.lua"/>
Registre o creature event no XML do monster:
<script>
<event name="BOSSReward"/>
</script>