• 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!

Lua tfs 0.4 tp instead of death

Competitibia

Pain & Glory WHole
Joined
Apr 1, 2021
Messages
545
Solutions
3
Reaction score
210
Lua:
function onPrepareDeath(player, killer)
    if isPlayer(killer) and isPlayer(player) then
        if getPlayerLevel(killer)/2 > getPlayerLevel(player) and isInArray({SKULL_NONE, SKULL_GREEN}, getCreatureSkullType(player)) and isInArray({SKULL_NONE, SKULL_GREEN}, getCreatureSkullType(killer)) then
            if isPlayerPzLocked(player) then
                doCreateItem(getPlayerSex(player) == 1 and 3058 or 3065, 1, getThingPosition(player))
                doCreateItem(2016, 10, getThingPosition(player))
                doPlayerSendTextMessage(player,MESSAGE_EVENT_ADVANCE,"Instead of death, you got teleported but due to PZ lock experience loss still applies.")
            else
                doPlayerSendTextMessage(player,MESSAGE_EVENT_ADVANCE,"You got teleported due to the level difference.")
            end
            doCreatureAddHealth(player,getCreatureMaxHealth(player))
            doTeleportThing(player, getTownTemplePosition(getPlayerTown(player)))
            doSendMagicEffect(player,CONST_ME_TELEPORT)
            return false
        end
    end
   return true
end
made that^^

no errors in the tfs 0.4 console all in login.lua and creaturescripts however no juice :v
out of this code:
Lua:
function onPrepareDeath(player, killer)
    if killer and killer:isPlayer() and player:isPlayer() then
        if killer:getLevel()/2 > player:getLevel() and isInArray({SKULL_NONE, SKULL_GREEN}, player:getSkull()) and isInArray({SKULL_NONE, SKULL_GREEN}, player:getSkullClient(killer)) then
            if player:isPzLocked() then
                Game.createItem(player:getSex() == 1 and 3058 or 3065, 1, player:getPosition()):decay()
                Game.createItem(2016, 10, player:getPosition()):decay()
                player:removeExperience(player:getExperience()*(0.1 and not player:isPromoted() or 0.09))
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE,"Instead of death, you got teleported but due to PZ lock experience loss still applies.")
            else
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE,"You got teleported due to the level difference.")
            end
            player:addHealth(player:getMaxHealth())
            player:teleportTo(player:getTown():getTemplePosition(), true)
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            return false
        end
    end
   return true
end

however player still dies instead of being teleported to temple :v
 
Back
Top