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

Solved problem in this script

Elgenady

Veteran OT User
Joined
Aug 5, 2011
Messages
1,683
Solutions
36
Reaction score
388
im use tfs 0.4

i did this script but the problem is when player get hp 0 target player still attack him and items like donation boots can add hp so player never die how i can fix this
8ys10h.jpg

Code:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
          if getCreatureHealth(cid) <= 0 then
           setPlayerStorageValue(cid, 40902)
            doCreatureSetNoMove(cid, cid, true)
             addEvent(doCreatureSetNoMove, 2000, cid, false)          
             doSetItemOutfit(cid, 3058, 5000) 
for x = 1, 2 do
        local n = 2 - x
            addEvent(doSendAnimatedText, x * 1000, getCreaturePosition(cid), n > 0 and tostring(n), TEXTCOLOR_TEAL)
        end     
        end
             return false
     end

i use this storge "40902" for block damge but no work

i hope someone can help me and understand me
or some one gave me script for player will stay 5 second be4 get msg when die
 
Code:
local seconds = 5
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
    if getCreatureHealth(cid) <= 0 then
        setPlayerStorageValue(cid, 40902)
        doCreatureSetNoMove(cid, cid, true)
        addEvent(doCreatureSetNoMove, 2000, cid, false)          
        doSetItemOutfit(cid, 3058, 5000) 
        for x = 1, 5 do
            addEvent(doSendAnimatedText, x * 1000, getCreaturePosition(cid), tostring(seconds), TEXTCOLOR_TEAL)
            seconds = seconds - x
        end    
    end
    return false
end
 
what this ????

sorry for dubble post but really i need this when player get hp 0 block all damge for 5 sec
 
Last edited by a moderator:
Unsure how to help, however I do understand the problem.
The script seems to make the player 'die' but shows a different death animation. (allowing the player to watch for 5 seconds after their death?)
The problem seems to be if the player is healed in anyway, through passive regeneration, or from another player, they are able to live indefinitely.

What @heba wishes is to edit the script so that the player will actually die, instead of being immortal because of the bug.

Unsure of a solution.

Xikini
 
there cod to can make player change to gm in onPrepareDeath for 5 sec and then change to player again

----------------------------
script i need ... revive from death when player die w8 5 sec and then check if he have x items and exhuast 0 add hp and riviv from death if don't have x items die im use tfs 0.4 client
--------- i know its my problem but i try to explain my english not good------sorry
 
What happens if you addhealth on preparedeath?
If character doesn't die then give HP with if statements.
I'm uncertain how to give character immunity for 5 sec though
 
Code:
local arena = {
  frompos = {x=266, y=246, z=11},
  topos = {x=275, y=251, z=11},
  exitpos = {x=278, y=249, z=10}
}

local arena2 = {
  frompos = {x = 934, y = 773, z = 9},
  topos = {x = 941, y = 777, z = 9},
  exitpos = {x = 938, y = 771, z = 9}
}

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
   if isPlayer(cid) then
     if isInRange(getPlayerPosition(cid), arena.frompos, arena.topos) or isInRange(getPlayerPosition(cid), arena2.frompos, arena2.topos) then
       doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
       addEvent(doCreatureAddHealth, 100, cid, getCreatureMaxHealth(cid))
       doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"[Arena]: You lost the duel.")
     end
     if isInRange(getPlayerPosition(cid), arena.frompos, arena.topos) then
       doTeleportThing(cid, arena.exitpos)
       return true
     elseif isInRange(getPlayerPosition(cid), arena2.frompos, arena2.topos) then
       doTeleportThing(cid, arena2.exitpos)
       return true
     end
    end
  return true
end

you may use storage to avoid executing it twice and reset it by onLogin or onDeath event
 
Code:
local arena = {
  frompos = {x=266, y=246, z=11},
  topos = {x=275, y=251, z=11},
  exitpos = {x=278, y=249, z=10}
}

local arena2 = {
  frompos = {x = 934, y = 773, z = 9},
  topos = {x = 941, y = 777, z = 9},
  exitpos = {x = 938, y = 771, z = 9}
}

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
   if isPlayer(cid) then
     if isInRange(getPlayerPosition(cid), arena.frompos, arena.topos) or isInRange(getPlayerPosition(cid), arena2.frompos, arena2.topos) then
       doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
       addEvent(doCreatureAddHealth, 100, cid, getCreatureMaxHealth(cid))
       doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"[Arena]: You lost the duel.")
     end
     if isInRange(getPlayerPosition(cid), arena.frompos, arena.topos) then
       doTeleportThing(cid, arena.exitpos)
       return true
     elseif isInRange(getPlayerPosition(cid), arena2.frompos, arena2.topos) then
       doTeleportThing(cid, arena2.exitpos)
       return true
     end
    end
  return true
end

you may use storage to avoid executing it twice and reset it by onLogin or onDeath event
first thx for ur help but i have nice reviv system its work fine but i need edite it with this cod block all damge for 5 sec in onPrepareDeath
 
Back
Top