• 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 :)
 
The problem is that your server does not have the function "doCreatureCheck".

Thus we cannot fix it without knowing exactly what this "doCreatureCheck" function does.

It might be that you've forgotten to include a secondary script file which contains this function.
 
i will tell u something about the scipt ...
im a beginnger in .lua files, and i dont want to spamm the forum for every small problem that i got ...

but now i have to ask cuz i was tryining to fixit for mor than 4 hrs. or sth.

ok go ahead:

1.Arena pos from, to, exit.
2.Kicker loser to exit.
3.After kick looser create tp on tpPos.
4.After entering tp on created tpPos the tp have to dissappear after 30 second ...


the scipt is a pice of my litte lua fantasy ... so dont wonder if its build messy.
 
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 event = 0

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, #deathlist do
        if isPlayer(deathlist[i]) and isInArea(getCreaturePosition(cid), arena.frompos, arena.topos) then
			if doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid) ) then
				doTeleportThing(cid, arena.exit)
				doSendMagicEffect(arena.exit, 10)
				doCreateTeleport(1387, exit, tpPos)
				stopEvent(event)
				event = 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 false
			end
		end
	end
	return true
end
What errors do you get with this one?
 
Last edited:
nothing happens

Code:
[28/11/2009 18:18:24] Lua Script Error: [CreatureScript Interface] 
[28/11/2009 18:18:24] data/creaturescripts/scripts/arena3.lua:onPrepareDeath

[28/11/2009 18:18:24] data/creaturescripts/scripts/arena3.lua:18: attempt to get length of global 'deathlist' (a nil value)
[28/11/2009 18:18:24] stack traceback:
[28/11/2009 18:18:24] 	data/creaturescripts/scripts/arena3.lua:18: in function <data/creaturescripts/scripts/arena3.lua:17>
 
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 event = 0

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, #deathlist do
        if isPlayer(deathlist[i]) and isInArea(getCreaturePosition(cid), arena.frompos, arena.topos) then
			if doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid) ) then
				doTeleportThing(cid, arena.exit)
				doSendMagicEffect(arena.exit, 10)
				doCreateTeleport(1387, exit, tpPos)
				stopEvent(event)
				event = 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 false
			end
		end
	end
	return true
end

this srcipt is still not working,
i use tfs 0.3.5...
can somebody fix it ??
 
Lua:
local arena = {
  fromPos = { x=100, y=100, z=7 }, -- Top Left Corner of Arena
  toPos = { x=100, y=100, z=7 }, -- Bottom Right Corner of Arena
  exit = { x=100, y=100, z=7 }, -- Kick
  tpPos = { x=100, y=100, z=7 } -- Tele
}

local time = 30 -- Seconds
local function removeTeleport()
local tp = getTileItemById(1387, arena.tpPos)
	if tp > 0 then
		doRemoveItem(tp.uid)
	end
end

function onDeath(cid, lastHitKiller, mostDamageKiller)
  if (isPlayer(cid) == true) then
    if (isInArea(getCreaturePosition(cid), arena.fromPos, arena.toPos)) then
      if (doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), true) == true) then
        if (doTeleportThing(cid, arena.exit) == true) then
          doSendMagicEffect(arena.exit, CONST_ME_ENERGYAREA)
          doCreateTeleport(1387, arena.exit, arena.tpPos)
          doPlayerSendTextMessage(mostDamageKiller,MESSAGE_STATUS_CONSOLE_ORANGE,'[ARENA] You have defeated '..getCreatureName(cid)..'!')
          doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'[ARENA] You where defeated by '..getCreatureName(mostDamageKiller)..'!')
	  addEvent(removeTeleport, time * 1000)
        end
	return true
      end
    end
  end
end
 
As I said, there might be something wrong with onPrepareDeath, or we're using table deathlist in a wrong way.
 
okay ....
thats the working script :

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.exit)
    if (tpCheck.uid > 0) then
        doRemoveItem(tpCheck.uid)
        doSendMagicEffect(exit, 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)
		  doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_RED,'[ARENA] You where defeated!')
		  doTeleportThing(cid, arena.exit)
          doSendMagicEffect(arena.exit, CONST_ME_ENERGYAREA)
          doCreateTeleport(1387, arena.exit, arena.tpPos)
          addEvent(callback, deleteTeleport, time * 1000)
    end
  end
end

Just the teleporter don't dissappear :s
 
Last edited:
Lol, you used my script, but your checking the wrong spot.

Replace with this.
Lua:
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:
-- cykestyled lol
return getTileItemById(1387, arena.tpPos).uid > 0 and doRemoveItem(getTileItemById(1387, arena.tpPos).uid), doSendMagicEffect(arena.tpPos, CONST_ME_POFF)
 
Back
Top