• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Prevent death amulet

Paulix

Active Member
Joined
Sep 13, 2012
Messages
129
Solutions
7
Reaction score
26
I'm trying to make an amulet, that will prevent the player death once. it should remove the item and set the player full hp. but for some reason, its not removing the amulet nor healing the player, but the effect is showing up. No error on console and I'm using tfs 0.4.3.


Lua:
function onPrepareDeath(cid, deathList)
        necklace = getPlayerSlotItem(cid, CONST_SLOT_NECKLACE)
        if necklace.itemid == 2354 then
            doCreatureAddHealth(cid, 99999)
            doSendMagicEffect(getThingPosition(cid), 49)
            doPlayerRemoveItem(cid, necklace.uid, 1)
            return false
        end
end
 
test with for remove amulet:
Code:
doRemoveItem(necklace.uid)
register on the login the prepareDeath event.
it is removing the amulet now, but its not "preventing" the death, my character glitches and I can't move nor die and my hp still 0.
It was registered on login already

EDIT: its working now, thanks for the help
Lua:
function onPrepareDeath(cid, deathList)
    necklace = getPlayerSlotItem(cid, CONST_SLOT_NECKLACE)
    if necklace.itemid == 2354 then
        doSendMagicEffect(getThingPosition(cid), 49)
        doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
        doRemoveConditions(cid, false)
        doSendAnimatedText(getThingPosition(cid), 'Restore!', 210)
        doRemoveItem(necklace.uid)
        return false
    end
    return true
end
 
Last edited:
Back
Top