Alguem altera esse script para que o item va dentro de uma bp porfavor ! >.<
Citarlocal config = {
monsters = {"The Mega Boss Rox"},
rewards = {
{itemID = 2160, chanceToGainInPercent = 3, quantity = 100},
{itemID = 2148, chanceToGainInPercent = 3, quantity = 100},
},
effect = 27,
}-- Função para selecionar um item com base na porcentagem
function selectRandomItem()
local totalChance = 0for _, reward in pairs(config.rewards) do
totalChance = totalChance + reward.chanceToGainInPercent
endlocal randomValue = math.random(1, totalChance)
local cumulativeChance = 0for _, reward in pairs(config.rewards) do
cumulativeChance = cumulativeChance + reward.chanceToGainInPercentif randomValue <= cumulativeChance then
return reward
end
end
end
function onKill(cid, target, lastHit)
if isPlayer(cid) and isMonster(target) then
if getCreatureMaster(target) ~= nil then
return true
endlocal monsterNameKilled = getCreatureName(target)
if isInArray(config.monsters, monsterNameKilled) then
local selectedItem = selectRandomItem()
doPlayerAddItem(cid, selectedItem.itemID, selectedItem.quantity)
doSendMagicEffect(getCreaturePosition(cid), config.effect)
doBroadcastMessage("Mataram o boss.", 19)
end
end
return true
endfunction onLogin(cid)
registerCreatureEvent(cid, "killTheBoss")
return true
end