darkshin
New old member
- Joined
- Dec 14, 2010
- Messages
- 231
- Reaction score
- 22
Hello Guys,
Ive trying to prevent a players death based on a storage, but I just can't make this work. I use TFS 1.2.
When the player dies, the print I've made to check if its being called doesn't even is showed in serv console.
How can this work?
Here is the script so far:
Ive trying to prevent a players death based on a storage, but I just can't make this work. I use TFS 1.2.
When the player dies, the print I've made to check if its being called doesn't even is showed in serv console.
How can this work?
Here is the script so far:
Code:
TRY 1:
function onPrepareDeath(cid)
print("TRIED TO SAVE")
if cid:getStorageValue(6666) == 1 then
local position = {x = 1052, y = 1465, z = 7 }
doCreatureAddHealth(cid,getCreatureMaxHealth(cid))
doTeleportThing(cid, position)
doRemoveCreature(cid)
return false
else
return true
end
end
TRY2:
function onHealthChange(cid)
print("TRIED TO SAVE")
if cid:getStorageValue(6666) == 1 then
local position = {x = 1052, y = 1465, z = 7 }
if cid:getHealth() <= 1 then
doCreatureAddHealth(cid,getCreatureMaxHealth(cid))
doTeleportThing(cid, position)
doRemoveCreature(cid)
return false
end
end
return true
end