• 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 PVP Arena ! How can I do that players doesn't die!

Redox

New Member
Joined
Aug 10, 2008
Messages
11
Reaction score
0
Hi everybody. I have PVP Arena on my server and I want do that player doesn't die on arena. When he die, arena teleports him to x position and do nothing else. Now, I have that when he died it's like he was killed by a normal creature/pk. In such a situation PVP Arena is no needed. How can I do that players doesn't die on arena, but only teleports to a enter by me position? I hope you understood me. This is my file pvplever.lua in actions:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local firstPlayerPosition = {x = 1040, y = 987, z = 8, stackpos = STACKPOS_TOP_CREATURE}
	local getFirstPlayer = getThingFromPos(firstPlayerPosition)
	local secondPlayerPosition = {x = 1040, y = 989, z = 8, stackpos = STACKPOS_TOP_CREATURE}
	local getSecondPlayer = getThingFromPos(secondPlayerPosition)
	local arenaLevel = 30
	local firstPlayerLevel = getPlayerLevel(getFirstPlayer.uid)
	local secondPlayerLevel = getPlayerLevel(getSecondPlayer.uid)
	local newFirstPlayerPosition = {x = 1043, y = 988, z = 9}
	local newSecondPlayerPosition = {x = 1050, y = 988, z = 9}
	if(item.uid == 7001) then
		if(getFirstPlayer.itemid > 0 and getSecondPlayer.itemid > 0) then
			if(firstPlayerLevel >= arenaLevel and secondPlayerLevel >= arenaLevel) then
				for arenax = 1041, 1052 do
					for arenay = 985, 991 do
						local arenaPosition = {x=arenax, y=arenay, z=9, stackpos=253}
						local arenaCreature = getThingFromPos(arenaPosition)
						if(arenaCreature.itemid > 0 and isPlayer(arenaCreature.uid) == FALSE) then
							if(isMonster(arenaCreature.uid) == TRUE) then
								doRemoveCreature(arenaCreature.uid)
							end
						elseif(arenaCreature.itemid > 0 and isPlayer(arenaCreature.uid) == TRUE) then
							doPlayerSendCancel(cid, "Wait for current duel to end.")
							return TRUE
						end
					end
				end
				if(item.itemid == 1945) then
					doTransformItem(item.uid, 1946)
				elseif(item.itemid == 1946) then
					doTransformItem(item.uid, 1945)
				end
				doSendMagicEffect(firstPlayerPosition, 2)
				doSendMagicEffect(secondPlayerPosition, 2)
				doTeleportThing(getFirstPlayer.uid, newFirstPlayerPosition)
				doTeleportThing(getSecondPlayer.uid, newSecondPlayerPosition)
				doSendMagicEffect(newFirstPlayerPosition, 10)
				doSendMagicEffect(newSecondPlayerPosition, 10)
				doPlayerSendTextMessage(getFirstPlayer.uid, 18, "FIGHT!")
				doPlayerSendTextMessage(getSecondPlayer.uid, 18, "FIGHT!")
			else
				doPlayerSendCancel(cid, "Both fighters must have level 30.")
			end
		else
			doPlayerSendCancel(cid, "You need 2 players for a duel.")
		end
	end
	return TRUE
end
 
CYKO IS `WORNG` LOL! We actually are able to use custom position.

This is the `demo` version of the script I am using (I won't release entire one okej :C)
Code:
local arena = {
	from = {x = 560, y = 301, z = 11},
	to = {x = 571, y = 307, z = 11},
	exit = {x = 556, y = 303, z = 10}
}
function onPrepareDeath(cid, deathList)
	if(not isPlayer(cid)) then
		return true
	end

	local tmp = getCreaturePosition(cid)
	if(not isInArea(tmp, arena.from, arena.to)) then
		return true
	end

	doCreatureAddHealth(cid, getCreatureMaxHealth(cid), MAGIC_EFFECT_UNKNOWN, COLOR_UNKNOWN, true)
	doPlayerRemoveLethalConditions(cid)
	doTeleportThing(cid, arena.exit, true)
	return false
end

doPlayerRemoveLethalConditions(cid) - I am using it in many scripts so it was better to create a global function:
Code:
function doPlayerRemoveLethalConditions(cid)
	local tmp = {1, 2, 4, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 32768, 65536}
	for i = 1, #tmp do
		if(hasCondition(cid, tmp[i])) then doRemoveCondition(cid, tmp[i]) end
	end
	return true
end

Peace.

@down
it'll teleport anyone who dies to their home temple. you can't use a custom pos
I can't find the `can't with an action script` part. Nevermind though, problem solved?
 
Last edited:
Possible to create a Arena where you won't die normally but just getting teleported back, it's working with War-system. Each time someone is getting killed (teleported) it will count as a war frag?
 

Similar threads

Back
Top