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

prepareDeath

richux

Tibera.org
Joined
Aug 18, 2008
Messages
3,666
Reaction score
26
Location
---------
Everything works just fine with this script, except you see yourself in temple when you are dead and I don't like it ;s Is there any way to avoid it?

LUA:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if (isPlayer(cid)) then
		if getPlayerLevel(cid) <= 150 then
			doCreatureSetDropLoot(cid, false)   						
		end
	end
	return true  
end

 
Code:
function onPrepareDeath(cid, deathList)
	if getPlayerLevel(cid) <= 150 then
		doCreatureSetDropLoot(cid, false)
	end
	return doTeleportThing(cid, getCreatureLastPosition(cid))
end
 
use onstatschange, works perfect for me;
Code:
function onStatsChange(cid, attacker, type, combat, value)
	if type == 1 then
		if getCreatureHealth(cid) <= value then
			if isPlayer(cid) and isCreature(attacker) then
				if getPlayerLevel(cid) <= 150 then
					doCreatureAddHealth(cid, getCreatureMaxHealth(cid), true)
					doCreatureAddMana(cid, getCreatureMaxMana(cid), true)
					doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
				end
			end
			return false
		end
	end
	return true
end
anyways u shud use (deathList[1]) instead of "cid" <- cid is the attacker not the player who is dieing or am i wrong?
 
^^
if ill use ur script, player will not die, but just get tped back to temple.
ok.
Code:
local function CykotitansFunction(cid, v)
	if v == "health" then
		return isKnight(cid) and getPlayerLevel(cid) * 15 + 65 or isPaladin(cid) and getPlayerLevel(cid) * 10 + 105 or (isSorcerer(cid) or isDruid(cid)) and getPlayerLevel(cid) * 5 + 145
	elseif v == "mana" then
		return isKnight(cid) and getPlayerLevel(cid) * 5 - 5 or isPaladin(cid) and getPlayerLevel(cid) * 15 - 85 or (isSorcerer(cid) or isDruid(cid)) and getPlayerLevel(cid) * 30 - 205
	end
end
function onStatsChange(cid, attacker, type, combat, value)
	if type == 1 then
		if getCreatureHealth(cid) <= value then
			if isPlayer(cid) and isCreature(attacker) then
				if getPlayerLevel(cid) <= 150 then
					local loss = getConfigValue('deathLostPercent')
					doPlayerAddExp(cid, -loss * 10)
					setCreatureMaxHealth(cid, CykotitansFunction(cid, "health"))
					setCreatureMaxMana(cid, CykotitansFunction(cid, "mana"))
					doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), false)
					doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid), false)
				end
				doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
			end
			return false
		end
	end
	return true
end
 
Last edited:
Back
Top