• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved 0.3.1pl2 tp on death

Cornwallis

Member
Joined
Jan 3, 2010
Messages
480
Reaction score
16
SOLVED;
PHP:
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
local newpos = { x = 2023, y = 2036, z = 7 }
local health = getCreatureMaxHealth(cid)

    if (getPlayerSkullType(cid) <= 2) then
		doCreatureAddHealth(cid, health, TRUE)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
		doCreatureSay(cid, "No Skull!", TALKTYPE_ORANGE_1)
		doTeleportThing(cid, newpos)
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You have died without a white or red skull, meaning you do not get punished.")
	return FALSE
	end
	
	if (getPlayerSkullType(cid) >= 3) then
		registerCreatureEvent(cid, "PlayerDeath")
	return TRUE
	end
end
 
Last edited:
Ok, so I revised it to this, but The healing and monster damage thing is still happening, I have no clue what to do.
PHP:
local newpos = {x = 2023, y = 2036, z = 7} 

function onStatsChange(cid, attacker, type, combat, value)
	if(getCreatureHealth(cid) <= value and isPlayer(cid) and getPlayerSkullType(cid) <= 2) == true then   
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
		doTeleportThing(cid, newpos)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have died without having a white skull or red skull, meaning you lose no experience.")
	end
return true
end
 
Ok, so I revised it to this, but The healing and monster damage thing is still happening, I have no clue what to do.
LUA:
local newpos = {x = 2023, y = 2036, z = 7} 

function onStatsChange(cid, attacker, type, combat, value)
	if(getCreatureHealth(cid) <= value and isPlayer(cid) and getPlayerSkullType(cid) <= 2) == true then   
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
		doTeleportThing(cid, newpos)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have died without having a white skull or red skull, meaning you lose no experience.")
        return false
	end
return true
end

Why return false within that statement? it needs to return false in order to negate the damage that it is trying to make in effect when he is about to die.
 
alright, i started using this one. the only problem now is it is not adding the health like i want it to... i tried doCreatureAddHealh(cid, getCreatureMaxHealth(cid)) but it wouldn't work, anyways.
PHP:
local newpos = { x = 2023, y = 2036, z = 7 }

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
    if (getPlayerSkullType(cid) <= 2) then
		doCreatureAddHealth(cid, 1)
        doTeleportThing(cid, newpos)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
		doCreatureSay(cid, "No Skull!", TALKTYPE_ORANGE_1)
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You have died without a white or red skull, meaning you do not get punished.")
	return true
	end
end
 
Last edited:
Back
Top