abdala ragab
Veteran OT User
Help me fix this text Every amulet doesn't get lost when you die and items don't fall if you don't have aol
I think I ruined it xD
I want this to work like a system Aol local amulets = {2173, 2138, 2218}
This amulet is forever local forevers = {2196, 7890}
@Itutorial @johnsamir
Help me with this text
I think I ruined it xD
I want this to work like a system Aol local amulets = {2173, 2138, 2218}
This amulet is forever local forevers = {2196, 7890}
Lua:
local amulets = {2173, 2138, 2218}
local forevers = {2196, 7890}
function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
if getPlayerFlagValue(player, PlayerFlag_NotGenerateLoot) then
return true
end
local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
local hasSkull = isInArray({SKULL_RED}, player:getSkull())
if amulet and (amulet and isInArray(amulets, amulet.itemid)) and (amulet and isInArray(forevers, amulet.itemid)) and not hasSkull 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
local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
if (amulet and isInArray(amulets, amulet.itemid)) then
if not isPlayer or not player:hasBlessing(6) then
amulet:remove()
elseif (amulet and isInArray(forevers, amulet.itemid)) then
return true
else
local lossPercent = player:getLossPercent()
for i = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
local item = player:getSlotItem(i)
if item then
if hasSkull or math.random(item:isContainer() and 100 or 1000) <= lossPercent then
if not item:moveTo(corpse) then
item:remove()
end
end
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
Post automatically merged:
@Itutorial @johnsamir
Help me with this text
Last edited: