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

Solved Remove item which has been created in 10 minutes

Ray Rewind

Doctor
Joined
Jun 6, 2009
Messages
1,348
Reaction score
75
Location
Germany
Heya :)

I got this Action script

Code:
function onUse(cid, item, frompos, item2, topos)
local portal_quest01_pos = {x = 1152, y = 845, z = 2, stackpos = 2}
if item.uid == 32145 then
 if item.itemid == 1946 then

 player1pos = {x=1153, y=845, z=2, stackpos=253}
 player1 = getThingfromPos(player1pos)

 player2pos = {x=1154, y=845, z=2, stackpos=253}
 player2 = getThingfromPos(player2pos)


  if player1.itemid > 0 and player2.itemid > 0 then

  player1level = getPlayerLevel(player1.uid)
  player2level = getPlayerLevel(player2.uid)


  questlevel = 120

  if player1level >= questlevel then

     queststatus1 = getPlayerStorageValue(player1.uid,6300)
     queststatus2 = getPlayerStorageValue(player2.uid,6300)
     

     if queststatus1 == -1 and queststatus2 == -1 then

    if 1==1 then
    demon1pos = {x=1141, y=863, z=3}
        demon2pos = {x=1141, y=865, z=3}
   

   doSummonCreature("Baron Brute", demon1pos)
   doSummonCreature("The Axeorcist", demon2pos)

    nplayer1pos = {x=1129, y=865, z=3}
    nplayer2pos = {x=1129, y=866, z=3}
   

   doSendMagicEffect(player1pos,2)
   doSendMagicEffect(player2pos,2)
   doPlayerSendTextMessage(cid,22,"FIGHT!")
   

   doTeleportThing(player1.uid,nplayer1pos)
   doTeleportThing(player2.uid,nplayer2pos)
   doCreateItem(9772,1,portal_quest01_pos)
 
   

    doSendMagicEffect(nplayer1pos,10)
    doSendMagicEffect(nplayer2pos,10)


    doTransformItem(item.uid,1945)

    else
    doPlayerSendCancel(cid,"Sorry, not possible.")
    end
   else
    doPlayerSendCancel(cid,"Sorry, not possible.")
   end
  else
  doPlayerSendCancel(cid,"Sorry, not possible.")
  end
  end
 if item.uid == 32145 then
 if item.itemid == 1945 then
doTransformItem(item.uid,1946) 




end
end
 return 1
end
end
end

is it possible to remove the item


doCreateItem(9772,1,portal_quest01_pos)


after 10 minutes??
 
Yeahp, sorry I been busy, just been checking crap on my phone, if someone hasn't helped when I get a chance I will do my best, all I can say for now is to make sure all coordinates are properly set.
 
When you pull the lever does it say you cannot use this object?

I believe I found the issue. Give her a try.

this
Code:
player = getTopCreature(t.pedestals).uid
should be
this
Code:
player = getTopCreature(t.pedestals[i]).uid

New code.
Code:
local t, player = {
    pedestals = {
        {x=1153, y=845, z=2},
        {x=1154, y=845, z=2}
    },
    newPos = {
        {x=1128, y=865, z=3},
        {x=1128, y=866, z=3}
    },
    area = {
        fromX = 1151, toX = 1155,
        fromY = 845, toY = 847,
        z = 2
    },
    storageDone = 4746,
    level = 120
}, {0, 0}

function getCreaturesInRange(position, radiusx, radiusy, showMonsters, showPlayers, showSummons)
    local creaturesList = {}
    for x = -radiusx, radiusx do
        for y = -radiusy, radiusy do
            if not (x == 0 and y == 0) then
                creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z, stackpos = 253})
                if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
                    table.insert(creaturesList, creature.uid)
                end
            end
        end
    end

    local creature = getTopCreature(position)
    if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
        if not(table.find(creaturesList, creature.uid)) then
            table.insert(creaturesList, creature.uid)
        end
    end
    return creaturesList
end

function Wave1()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Baron Brute', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('The Axeorcist', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave2, 30 * 1000)
end

function Wave2()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Menace', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Fatality', {x= 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave3, 35 * 1000)
end

function Wave3()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Incineron', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Coldheart', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave4, 40 * 1000)
end

function Wave4()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Dreadwing', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Doomhowl', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave5, 40 * 1000)
end

function Wave5()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Haunter', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('The Dreadorian', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave6, 40 * 1000)
end

function Wave6()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Rocko', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Tremorak', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave7, 40 * 1000)
end

function Wave7()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Tirecz', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local failed = false
    for i = 1, #t.pedestals do
        player = getTopCreature(t.pedestals[i]).uid
        if(not(player > 0 and isPlayer(player) == TRUE and getPlayerStorageValue(player, t.storageDone) < 1 and getPlayerLevel(player) >= t.level)) then
            failed = true
            break
        end
    end
    if not failed then
        if #getCreaturesInRange({x=1137, y=864,z=3}, 10, 9, FALSE, TRUE) > 0 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT, "Another Team is fighting in the Arena.")
            return true
        end
        for i = 1, #player do
            doTeleportThing(player, t.newPos)
        end
        Wave1()
        doTransformItem(item.uid, 1946)
    else
        doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTUSETHISOBJECT)
    end
    return true
end
 
Now getting this error hehe


Code:
[22/03/2014 18:36:34] [Error - Action Interface]
[22/03/2014 18:36:34] data/actions/scripts/quests/zao/zaonew.lua:onUse
[22/03/2014 18:36:34] Description:
[22/03/2014 18:36:34] data/actions/scripts/quests/zao/zaonew.lua:95: attempt to get length of upvalue 'player' (a number value)
[22/03/2014 18:36:34] stack traceback:
[22/03/2014 18:36:34]    data/actions/scripts/quests/zao/zaonew.lua:95: in function <data/actions/scripts/quests/zao/zaonew.lua:81>
 
okay try this
Code:
local t, player = {
    pedestals = {
        {x=1153, y=845, z=2},
        {x=1154, y=845, z=2}
    },
    newPos = {
        {x=1128, y=865, z=3},
        {x=1128, y=866, z=3}
    },
    area = {
        fromX = 1151, toX = 1155,
        fromY = 845, toY = 847,
        z = 2
    },
    storageDone = 4746,
    level = 120
}, {0, 0}

function getCreaturesInRange(position, radiusx, radiusy, showMonsters, showPlayers, showSummons)
    local creaturesList = {}
    for x = -radiusx, radiusx do
        for y = -radiusy, radiusy do
            if not (x == 0 and y == 0) then
                creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z, stackpos = 253})
                if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
                    table.insert(creaturesList, creature.uid)
                end
            end
        end
    end

    local creature = getTopCreature(position)
    if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
        if not(table.find(creaturesList, creature.uid)) then
            table.insert(creaturesList, creature.uid)
        end
    end
    return creaturesList
end

function Wave1()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Baron Brute', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('The Axeorcist', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave2, 30 * 1000)
end

function Wave2()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Menace', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Fatality', {x= 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave3, 35 * 1000)
end

function Wave3()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Incineron', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Coldheart', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave4, 40 * 1000)
end

function Wave4()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Dreadwing', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Doomhowl', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave5, 40 * 1000)
end

function Wave5()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Haunter', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('The Dreadorian', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave6, 40 * 1000)
end

function Wave6()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Rocko', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Tremorak', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave7, 40 * 1000)
end

function Wave7()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Tirecz', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local failed = false
    for i = 1, #t.pedestals do
        player = getTopCreature(t.pedestals[i]).uid
        if(not(player > 0 and isPlayer(player) == TRUE and getPlayerStorageValue(player, t.storageDone) < 1 and getPlayerLevel(player) >= t.level)) then
            failed = true
            break
        end
    end
    if not failed then
        if #getCreaturesInRange({x=1137, y=864,z=3}, 10, 9, FALSE, TRUE) > 0 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT, "Another Team is fighting in the Arena.")
            return true
        end
        for i = 1, #t.pedestals do
            player = getTopCreature(t.pedestals[i]).uid
            doTeleportThing(player, t.newPos)
        end
        Wave1()
        doTransformItem(item.uid, 1946)
    else
        doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTUSETHISOBJECT)
    end
    return true
end
 
Nothing happends when pulling lever lever does not even move







Code:
[23/03/2014 12:33:48] [Error - Action Interface] 
[23/03/2014 12:33:48] In a timer event called from: 
[23/03/2014 12:33:48] data/actions/scripts/quests/zao/zaonew.lua:onUse
[23/03/2014 12:33:48] Description: 
[23/03/2014 12:33:48] (luaDoCreateMonster) Cannot create monster: Fatality

[23/03/2014 12:33:48] [Error - Action Interface] 
[23/03/2014 12:33:48] In a timer event called from: 
[23/03/2014 12:33:48] data/actions/scripts/quests/zao/zaonew.lua:onUse
[23/03/2014 12:33:48] Description: 
[23/03/2014 12:33:48] (luaGetThingPosition) Thing not found

[23/03/2014 12:33:48] [Error - Action Interface] 
[23/03/2014 12:33:48] In a timer event called from: 
[23/03/2014 12:33:48] data/actions/scripts/quests/zao/zaonew.lua:onUse
[23/03/2014 12:33:48] Description: 
[23/03/2014 12:33:48] (luaDoCreateMonster) Cannot create monster: Menace

[23/03/2014 12:33:48] [Error - Action Interface] 
[23/03/2014 12:33:48] In a timer event called from: 
[23/03/2014 12:33:48] data/actions/scripts/quests/zao/zaonew.lua:onUse
[23/03/2014 12:33:48] Description: 
[23/03/2014 12:33:48] (luaGetThingPosition) Thing not found

[23/03/2014 12:33:48] [Error - Action Interface] 
[23/03/2014 12:33:48] In a timer event called from: 
[23/03/2014 12:33:48] data/actions/scripts/quests/zao/zaonew.lua:onUse
[23/03/2014 12:33:48] Description: 
[23/03/2014 12:33:48] (luaDoCreateMonster) Cannot create monster: Fatality
 
Okay sorry I forgot something for teleport, some of those errors are a monster file error, unless maybe it's location of monster creation error.

This should teleport players fine, the monster thing you will have to make sure of proper caps and name and such.
Code:
local t, player = {
    pedestals = {
        {x=1153, y=845, z=2},
        {x=1154, y=845, z=2}
    },
    newPos = {
        {x=1128, y=865, z=3},
        {x=1128, y=866, z=3}
    },
    area = {
        fromX = 1151, toX = 1155,
        fromY = 845, toY = 847,
        z = 2
    },
    storageDone = 4746,
    level = 120
}, {0, 0}

function getCreaturesInRange(position, radiusx, radiusy, showMonsters, showPlayers, showSummons)
    local creaturesList = {}
    for x = -radiusx, radiusx do
        for y = -radiusy, radiusy do
            if not (x == 0 and y == 0) then
                creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z, stackpos = 253})
                if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
                    table.insert(creaturesList, creature.uid)
                end
            end
        end
    end

    local creature = getTopCreature(position)
    if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
        if not(table.find(creaturesList, creature.uid)) then
            table.insert(creaturesList, creature.uid)
        end
    end
    return creaturesList
end

function Wave1()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Baron Brute', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('The Axeorcist', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave2, 30 * 1000)
end

function Wave2()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Menace', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Fatality', {x= 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave3, 35 * 1000)
end

function Wave3()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Incineron', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Coldheart', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave4, 40 * 1000)
end

function Wave4()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Dreadwing', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Doomhowl', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave5, 40 * 1000)
end

function Wave5()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Haunter', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('The Dreadorian', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave6, 40 * 1000)
end

function Wave6()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Rocko', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Tremorak', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave7, 40 * 1000)
end

function Wave7()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Tirecz', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local failed = false
    for i = 1, #t.pedestals do
        player = getTopCreature(t.pedestals[i]).uid
        if(not(player > 0 and isPlayer(player) == TRUE and getPlayerStorageValue(player, t.storageDone) < 1 and getPlayerLevel(player) >= t.level)) then
            failed = true
            break
        end
    end
    if not failed then
        if #getCreaturesInRange({x=1137, y=864,z=3}, 10, 9, FALSE, TRUE) > 0 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT, "Another Team is fighting in the Arena.")
            return true
        end
        for i = 1, #t.pedestals do
            player = getTopCreature(t.pedestals[i]).uid
            doTeleportThing(player, t.newPos[i])
        end
        Wave1()
        doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
    else
        doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTUSETHISOBJECT)
    end
    return true
end
 
you can make it so if the lever is pulled again it clears, that would be easier, but if you want on death, you have to set a storage for entering arena, then read storage onDeath, then clean area.

This code will check the area, if there is a player, then tell the one pulling the lever it is occupied, but if there isn't a player it will remove all monsters and fields.
Code:
local t, player = {
    pedestals = {
        {x=1153, y=845, z=2},
        {x=1154, y=845, z=2}
    },
    newPos = {
        {x=1128, y=865, z=3},
        {x=1128, y=866, z=3}
    },
    area = {
        fromX = 1151, toX = 1155,
        fromY = 845, toY = 847,
        z = 2
    },
    storageDone = 4746,
    level = 120
}, {0, 0}

function getCreaturesInRange(position, radiusx, radiusy, showMonsters, showPlayers, showSummons)
    local creaturesList = {}
    for x = -radiusx, radiusx do
        for y = -radiusy, radiusy do
            if not (x == 0 and y == 0) then
                creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z, stackpos = 253})
                if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
                    table.insert(creaturesList, creature.uid)
                end
            end
        end
    end

    local creature = getTopCreature(position)
    if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
        if not(table.find(creaturesList, creature.uid)) then
            table.insert(creaturesList, creature.uid)
        end
    end
    return creaturesList
end

function Wave1()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Baron Brute', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('The Axeorcist', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave2, 30 * 1000)
end

function Wave2()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Menace', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Fatality', {x= 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave3, 35 * 1000)
end

function Wave3()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Incineron', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Coldheart', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave4, 40 * 1000)
end

function Wave4()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Dreadwing', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Doomhowl', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave5, 40 * 1000)
end

function Wave5()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Haunter', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('The Dreadorian', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave6, 40 * 1000)
end

function Wave6()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Rocko', {x = 1139, y = 864, z = 3})), CONST_ME_TELEPORT)
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Tremorak', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
    addEvent(Wave7, 40 * 1000)
end

function Wave7()
    doSendMagicEffect(getCreaturePosition(doCreateMonster('Tirecz', {x = 1139, y = 866, z = 3})), CONST_ME_TELEPORT)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local failed = false
    for i = 1, #t.pedestals do
        player = getTopCreature(t.pedestals[i]).uid
        if(not(player > 0 and isPlayer(player) == TRUE and getPlayerStorageValue(player, t.storageDone) < 1 and getPlayerLevel(player) >= t.level)) then
            failed = true
            break
        end
    end
    if not failed then
        local arenaCreatures, arenaItems = {}, {}
        for x = 1127, 1147 do
            for y = 855, 873 do
                local arenaC = getTopCreature({x=x, y=y, z=3}).uid
                if arenaC ~= 0 then
                    if isPlayer(arenaC) then
                        doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT, "Another Team is fighting in the Arena.")
                        return true
                    end
                    table.insert(arenaCreatures, arenaC)
                end
                local arenaI = getThingfromPos({x=x, y=y, z=3, stackpos=254}).uid
                if arenaI ~= 0 then
                    table.insert(arenaItems, arenaI)
                end
            end
        end
        for i = 1, #arenaCreatures do
            doRemoveCreature(arenaCreatures[i])
        end
        for i = 1, #arenaItems do
            doRemoveItem(arenaItems[i])
        end
        for i = 1, #t.pedestals do
            player = getTopCreature(t.pedestals[i]).uid
            doTeleportThing(player, t.newPos[i])
        end
        Wave1()
        doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
    else
        doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTUSETHISOBJECT)
    end
    return true
end
 
Last edited:
Back
Top