I added 3 new necklaces on my server, but even with them players lose loot, most of the time they lose the entire backpack.
I already tried to use
<attribute key="preventDrop" value="1" />
it still won't lose, then I saw a topic that says that in a 1.x+ server they use a code for aol, it doesn't lose anything, and in my code I found it called "droploot" but there's no way to put the item ID or something, I tried modifying but it gave error, if someone can modify or pass some code that these 3 paste works like aol and is unlimited thank you.
I'll pass the id and names of the items in case you need it.
18402 Ceifadora Sombria Colar
10220 Radiante da Virtude Colar
18407 Arcanum Celeste Colar
These are the 3 necklaces. Please, can someone help me
I already tried to use
<attribute key="preventDrop" value="1" />
it still won't lose, then I saw a topic that says that in a 1.x+ server they use a code for aol, it doesn't lose anything, and in my code I found it called "droploot" but there's no way to put the item ID or something, I tried modifying but it gave error, if someone can modify or pass some code that these 3 paste works like aol and is unlimited thank you.
function onDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
if player:hasFlag(PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
return true
end
local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
local isRedOrBlack = table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull())
if amulet and amulet.itemid == ITEM_AMULETOFLOSS and not isRedOrBlack then
local isPlayer = false
if killer then
if killer:isPlayer() then
isPlayer = true
else
local master = killer:getMaster()
if master and master:isPlayer() then
isPlayer = true
end
end
end
if not isPlayer or not player:hasBlessing(6) then
player:removeItem(ITEM_AMULETOFLOSS, 1, -1, false)
end
else
for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
local item = player:getSlotItem(i)
local lossPercent = player:getLossPercent()
if item then
if isRedOrBlack or math.random(item:isContainer() and 100 or 1000) <= lossPercent then
if (isRedOrBlack or lossPercent ~= 0) and not item:moveTo(corpse) then
item:remove()
end
end
end
end
end
if not player:getSlotItem(CONST_SLOT_BACKPACK) then
player:addItem(ITEM_BAG, 1, false, CONST_SLOT_BACKPACK)
end
return true
end
if player:hasFlag(PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
return true
end
local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
local isRedOrBlack = table.contains({SKULL_RED, SKULL_BLACK}, player:getSkull())
if amulet and amulet.itemid == ITEM_AMULETOFLOSS and not isRedOrBlack then
local isPlayer = false
if killer then
if killer:isPlayer() then
isPlayer = true
else
local master = killer:getMaster()
if master and master:isPlayer() then
isPlayer = true
end
end
end
if not isPlayer or not player:hasBlessing(6) then
player:removeItem(ITEM_AMULETOFLOSS, 1, -1, false)
end
else
for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
local item = player:getSlotItem(i)
local lossPercent = player:getLossPercent()
if item then
if isRedOrBlack or math.random(item:isContainer() and 100 or 1000) <= lossPercent then
if (isRedOrBlack or lossPercent ~= 0) and not item:moveTo(corpse) then
item:remove()
end
end
end
end
end
if not player:getSlotItem(CONST_SLOT_BACKPACK) then
player:addItem(ITEM_BAG, 1, false, CONST_SLOT_BACKPACK)
end
return true
end
I'll pass the id and names of the items in case you need it.
18402 Ceifadora Sombria Colar
10220 Radiante da Virtude Colar
18407 Arcanum Celeste Colar
These are the 3 necklaces. Please, can someone help me