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

[b]Can some one fix that script?[/b]

nips

Da.Nb
Joined
Oct 15, 2009
Messages
152
Reaction score
0
Location
Germany
Code:
local arena = {
	frompos = {x=121, y=36, z=9}, -- Top Left Corner
	topos = {x=131, y=43, z=9}, -- Bottom Right Corner
	exit = {x=126, y=33, z=9} -- Where loser goes
}
local tpPos = {x=126, y=36, z=9} -- Create Teleport Here
local exit = {x=126, y=33, z=9} -- Where Tele Takes You

local function remTp(pos)
	local tp = getTileItemById(pos, 1387).uid 
		if tp >0 then 
		doRemoveItem(tp) 
	end 
end

function onPrepareDeath(cid, deathList)
	for i = 1, cid do
        if isPlayer(cid) == TRUE then
                if isInArea(getCreaturePosition(cid), arena.frompos, arena.topos) then
                        if doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid) ) then
							if doCreatureCheck(cid, getCreatureHealth(cid) < 0 ) then
							doTeleportThing(cid, arena.exit)
							doSendMagicEffect(arena.exit, 10)
							doCreateTeleport(1387, exit, tpPos)
							addEvent(remTp, 10 * 1000, exit)
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE ,'[ARENA] Round over!')
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, '[ARENA] Come in again!')
							return TREU
							end
						return TRUE	
						end
                return TRUE
        end
		return TRUE
	end	
	end
end

When player 1 or 2 has 0 HP normaly will be kicked to exitPos.
But it dont work and stay in arena with 0 HP.

This error appears in console:

Code:
[28/11/2009 17:23:06] data/creaturescripts/scripts/arena3.lua:21: attempt to call global 'doCreatureCheck' (a nil value)
[28/11/2009 17:23:06] stack traceback:
[28/11/2009 17:23:06] 	data/creaturescripts/scripts/arena3.lua:21: in function <data/creaturescripts/scripts/arena3.lua:16>

[28/11/2009 17:23:07] Lua Script Error: [CreatureScript Interface] 
[28/11/2009 17:23:07] data/creaturescripts/scripts/arena3.lua:onPrepareDeath

[28/11/2009 17:23:07] data/creaturescripts/scripts/arena3.lua:21: attempt to call global 'doCreatureCheck' (a nil value)
[28/11/2009 17:23:07] stack traceback:
[28/11/2009 17:23:07] 	data/creaturescripts/scripts/arena3.lua:21: in function <data/creaturescripts/scripts/arena3.lua:16>

[28/11/2009 17:23:07] Lua Script Error: [CreatureScript Interface] 
[28/11/2009 17:23:07] data/creaturescripts/scripts/arena3.lua:onPrepareDeath

[28/11/2009 17:23:07] data/creaturescripts/scripts/arena3.lua:21: attempt to call global 'doCreatureCheck' (a nil value)
[28/11/2009 17:23:08] stack traceback:
[28/11/2009 17:23:08] 	data/creaturescripts/scripts/arena3.lua:21: in function <data/creaturescripts/scripts/arena3.lua:16>

Ah... and the created tpPos wont dissappear.
pls fix :)
 
hehe yea xd
i took from demon helmet quest :)

bzw.... exit and tpPos are the same ...


Still same error:

Code:
[03/12/2009 17:06:48] Lua Script Error: [CreatureScript Interface] 
[03/12/2009 17:06:48] in a timer event called from: 
[03/12/2009 17:06:48] data/creaturescripts/scripts/arena3.lua:onPrepareDeath

[03/12/2009 17:06:49] attempt to index a number value
[03/12/2009 17:06:49] stack traceback:
[03/12/2009 17:06:49] 	[C]: in function 'getTileItemById'
[03/12/2009 17:06:49] 	data/creaturescripts/scripts/arena3.lua:10: in function <data/creaturescripts/scripts/arena3.lua:9>

Using this function:

Code:
  local time = 30 -- Seconds
local function deleteTeleport()
local tpCheck = getTileItemById(1387, arena.tpPos)
    if (tpCheck.uid > 0) then
        doRemoveItem(tpCheck.uid)
        doSendMagicEffect(arena.tpPos, CONST_ME_POFF)
    end
end

Code:
          addEvent(deleteTeleport, time * 1000)
 
Last edited:
Code:
  local arena = {
  fromPos = { x=120, y=32, z=9 }, -- Top Left Corner of Arena
  toPos = { x=132, y=43, z=9 }, -- Bottom Right Corner of Arena
  exit = { x=126, y=33, z=9 }, -- Kick
  tpPos = { x=126, y=36, z=9 } -- Tele
}

  local time = 30 -- Seconds
local function deleteTeleport()
local tpCheck = getTileItemById(1387, arena.tpPos)
    if (tpCheck.uid > 0) then
        doRemoveItem(tpCheck.uid)
        doSendMagicEffect(arena.tpPos, CONST_ME_POFF)
    end
end 

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
  if (isPlayer(cid) == true) then
    if (isInArea(getCreaturePosition(cid), arena.fromPos, arena.toPos)) then
		  doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE)
		  doTeleportThing(cid, arena.exit)
          doSendMagicEffect(arena.exit, CONST_ME_ENERGYAREA)
          doCreateTeleport(1387, arena.exit, arena.tpPos)
          addEvent(deleteTeleport, time * 1000)
    end
  end
end

here it is :)
 
Code:
local arena = {
	fromPos = { x=120, y=32, z=9 }, -- Top Left Corner of Arena
	toPos = { x=132, y=43, z=9 }, -- Bottom Right Corner of Arena
	exit = { x=126, y=33, z=9 }, -- Kick
	tpPos = { x=126, y=36, z=9 } -- Tele
}
local time = 30 -- Seconds
local function deleteTeleport()
	local tpCheck = getTileItemById(arena.tpPos, 1387).uid
	if(tpCheck > 0) then
		doRemoveItem(tpCheck)
		doSendMagicEffect(arena.tpPos, CONST_ME_POFF)
	end
end 
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if(isPlayer(cid)) then
		if(isInArea(getCreaturePosition(cid), arena.fromPos, arena.toPos)) then
			doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), TRUE)
			doTeleportThing(cid, arena.exit)
			doSendMagicEffect(arena.exit, CONST_ME_ENERGYAREA)
			doCreateTeleport(1387, arena.exit, arena.tpPos)
			addEvent(deleteTeleport, time * 1000)
		end
	end
end
 
Back
Top