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

ffa-pvparena.lua:20: attempt to call global 'isInPosition' (a nil value)

ins13

New Member
Joined
Jul 12, 2007
Messages
51
Reaction score
0
I'm using the pvp arena script included in the forgotten 0.2.4 and I keep getting this error message?

ffa-pvparena.lua:20: attempt to call global 'isInPosition' (a nil value)

Can anyone help? Thanks!

Code:
local pvpArena =
{
	-- PVP Arena #1:
	{
		fromPosition = {x = 693, y = 693, z = 11},
		toPosition = {x = 713, y = 713, z = 11},
		positionToTeleportToOnDeath = {x = 704, y = 694, z = 11}
	},

	-- PVP Arena #2:
	{
		fromPosition = {x = 20000, y = 20000, z = 4},
		toPosition = {x = 20020, y = 20023, z = 10},
		positionToTeleportToOnDeath = {x = 20025, y = 20025, z = 7}
	}
}

function onPrepareDeath(cid, killer)
	for i, v in ipairs(pvpArena) do
		if isInPosition(getCreaturePosition(cid), v.fromPosition, v.toPosition) then
			while getCreatureHealth(cid) < getCreatureMaxHealth(cid) do
				doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
			end
			doTeleportThing(cid, v.positionToTeleportToOnDeath, TRUE)
			break
		end
	end
end
 
Mate you are at the wrong place Please post this al lua sections =)

Mod's please move this thread to lua secion


anywais add ths in global.lua
Code:
function isInRange(pos, fromPos, toPos)
	if pos.x >= fromPos.x and pos.y >= fromPos.y and pos.z >= fromPos.z and pos.x <= toPos.x and pos.y <= toPos.y and pos.z <= toPos.z then
		return TRUE
	end
	return FALSE
end


and use this arena script.
Code:
local pvpArena =
{
	-- PVP Arena #1:
	{
		fromPosition = {x = 693, y = 693, z = 11},
		toPosition = {x = 713, y = 713, z = 11},
		positionToTeleportToOnDeath = {x = 704, y = 694, z = 11}
	},

	-- PVP Arena #2:
	{
		fromPosition = {x = 20000, y = 20000, z = 4},
		toPosition = {x = 20020, y = 20023, z = 10},
		positionToTeleportToOnDeath = {x = 20025, y = 20025, z = 7}
	}
}

function onPrepareDeath(cid, killer)
	for i, v in ipairs(pvpArena) do
		if isInRange (getCreaturePosition(cid), v.fromPosition, v.toPosition) then
			while getCreatureHealth(cid) < getCreatureMaxHealth(cid) do
				doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
			end
			doTeleportThing(cid, v.positionToTeleportToOnDeath, TRUE)
			break
		end
	end
end
 
Last edited:
Back
Top