• 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 Something Like ANNI

tarekwiz

Hellbot Owner
Joined
Feb 17, 2011
Messages
240
Reaction score
7
here is my code
PHP:
local starting= {x = 2086, y = 2100, z = 7} -- edit this to the top left sqm of ur battle room 
local ending= {x = 2092, y = 2107, z = 5} -- edit this to the bottom right sqm of ur battle room 

local playerPos = { -- oldPositions; positions of players before they get teleported. 
   -- {x = 1070, y = 1173, z = 6}, 
    {x = 1047, y = 936, z = 5} 
} 
  
local newPlayerPos = { -- Positions for where players should be teleported, make sure it's in the same order as oldPositions 
   -- {x = 1070, y = 1173, z = 7},  
    {x = 1046, y = 937, z = 5} 
} 
  
if(#playerPos ~= #newPlayerPos) then 
    error("Annhilator has not been properly configured.") 
end 
--- Preferably, do not edit anything below this line unless you know exactly what you are doing. 
local player = {} 
  
function onUse(cid, item, frompos, item2, topos) 
    if(item.uid == 7000) then --- change to different item.uid according to ur mapeditor 
        if(item.itemid == 1945) then 
            for i, pos in ipairs(playerPos) do -- add player id's to table 
                player[i] = getTopCreature(pos) 
            end 
            local ret, players = checkPlayers(cid) 
           -- if(ret) then 
               local ret, player = checkLevel() 
              --  if(ret) then  
                       -- summonCreatures(creaturePos) 
                        teleportPlayers(2, 10) -- 2 stands for the effect on old pos, 10 for the effect on new pos. 
                        doTransformItem(item.uid, 1946) 
                  --  else 
                   --     sendPlayersText(players, getPlayerName(player) .. " Error 1 Happened.") 
                    --end 
               --- else 
                --    sendPlayersText(players, getPlayerName(player) .. " Error 2 Happened.") 
               -- end     
   
            			
        elseif(item.itemid == 1946) then -- preferably, to be the id of the lever added by mapeditor. 
            if(cleanArea()) then 
                doTransformItem(item.uid, 1945) 
				--sendPlayersText(players, getPlayerName(player) .. " Somebody is in the Battle Already") 
            else 
                return FALSE 
            end     
        end 
        return TRUE 
    --- Chests. 
    elseif(item.uid == 5001) then -- demon armor 
        return questChestPrize(cid, 2494, 1) 
    elseif(item.uid == 5002) then -- magic sword 
        return questChestPrize(cid, 2400, 1) 
    elseif(item.uid == 5003) then -- stonecutter's axe 
        return questChestPrize(cid, 2431, 1) 
    elseif(item.uid == 5004) then -- present box 
        return questChestPrize(cid, 1990, 1)                 
    end 
end 
  
function sendPlayersText(players, text) 
    for _, player in ipairs(players) do  
        doPlayerSendCancel(player, text) 
    end 
end 
  
function questChestPrize(cid, itemid, storage) 
    if(getPlayerStorageValue(cid, storage) < TRUE) then 
		if itemid == 1990 then
			container = doPlayerAddItem(cid, itemid, 1)
			doAddContainerItem(container, 2326, 1)
		else
			doPlayerAddItem(cid, itemid, 1) 
		end
        setPlayerStorageValue(cid, storage, TRUE) 
        local item = getItemDescriptions(itemid) 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a " .. item.name .. "") 
    else 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.") 
    end 
    return TRUE 
end 
  
function checkLevel() 

end 
  
function checkStorage(storageValue) 
    for _, player in ipairs(player) do 
        if(getPlayerStorageValue(player, storageValue) ~= TRUE) then 
            return false, player 
        end 
    end     
    return true 
end 
  
function cleanArea() 
    local checking= {x = starting.x, y = starting.y, z = starting.z, stackpos = 253} 
    local monster = {} 
    while(checking.y <= ending.y) do 
        local creature = getTopCreature(checking) 
        if(isCreature(creature) == TRUE) then 
            if(isPlayer(creature) == TRUE) then 
                return false 
            else 
                table.insert(monster, creature) 
            end 
        end 
        if(checking.x == ending.x) then 
            checking.x = starting.x 
            checking.y = checking.y + 1 
        end 
        checking.x = checking.x + 1 
    end 
    for i, c in ipairs(monster) do  
        doRemoveCreature(c) 
    end     
    return true 
end 
  

  
function teleportPlayers(effect1, effect2) 
    for currentPlayer = 1, table.getn(player) do
	doTeleportThing(player[currentPlayer], newPlayerPos[currentPlayer]) 
        doSendMagicEffect(playerPos[currentPlayer], effect1) -- send animation after teleport, players teleported won't see it anyways 
        doSendMagicEffect(newPlayerPos[currentPlayer], effect2) 
    end 
end 
  
function checkPlayers(cid) 
    local ret = {} 
    table.insert(ret, cid) 
    for _, curPlayer in ipairs(player) do 
        if(isPlayer(curPlayer) == TRUE) then 
            if(curPlayer ~= cid) then  
                table.insert(ret, curPlayer) 
            end 
        else     
            return false, ret 
        end 
    end     
    return true, ret 
end

i get error " Thing Not Found " when trying to use function teleportPlayers(its included in the code
 
doubt in this part
Lua:
local playerPos = {   
    {x = 1047, y = 936, z = 5} 
}   
local newPlayerPos = {  
    {x = 1070, y = 1173, z = 7},  
    {x = 1046, y = 937, z = 5} 
}

Have Only 1 player and 2 new player pos -.^?? i go edit your script is for 1 - 2 or 1-4? how many player go to this annihilator?
and what storage have?
 
try this
--- UPDATED ----
Lua:
function onUse(cid, item, frompos, item2, topos)

starting={x=2086, y=2100, z=7, stackpos=253}
checking={x=starting.x, y=starting.y, z=starting.z, stackpos=starting.stackpos}
ending={x=2092, y=2107, z=5, stackpos=253}

if item.uid == 5000 then
 if item.itemid == 1946 then

 player1pos = {x=1070, y=1173, z=6, stackpos=253}
 player1 = getThingfromPos(player1pos)

 player2pos = {x=1047, y=936, z=6, stackpos=253}
 player2 = getThingfromPos(player2pos)

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

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

  questlevel = 100

  if player1level >= questlevel and player2level >= questlevel then

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

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

	nplayer1pos = {x=1070, y=1173, z=7}
	nplayer2pos = {x=1046, y=937, z=5}

   doSendMagicEffect(player1pos,2)
   doSendMagicEffect(player2pos,2)

   doTeleportThing(player1.uid,nplayer1pos)
   doTeleportThing(player2.uid,nplayer2pos)

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

	 doTransformItem(item.uid,1945)

	else
	 doPlayerSendCancel(cid," Error 1 Happened.")
	end
   else
	doPlayerSendCancel(cid," Error 2 Happened.")
  end
  end
  Chests. 
   elseif(item.uid == 5001) then 
        return questChestPrize(cid, 2494, 1) 
    elseif(item.uid == 5002) then 
        return questChestPrize(cid, 2400, 1) 
    elseif(item.uid == 5003) then  
        return questChestPrize(cid, 2431, 1) 
    elseif(item.uid == 5004) then  
        return questChestPrize(cid, 1990, 1)                 
    end 
end

function questChestPrize(cid, itemid, storage) 
    if(getPlayerStorageValue(cid, storage) < TRUE) then 
        if itemid == 1990 then
            container = doPlayerAddItem(cid, itemid, 1)
            doAddContainerItem(container, 2326, 1)
        else
            doPlayerAddItem(cid, itemid, 1) 
        end
        setPlayerStorageValue(cid, storage, TRUE) 
        local item = getItemDescriptions(itemid) 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a " .. item.name .. "") 
    else 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.") 
    end 
    return TRUE 
end

function cleanArea() 
    local checking= {x = starting.x, y = starting.y, z = starting.z, stackpos = 253} 
    local monster = {} 
    while(checking.y <= ending.y) do 
        local creature = getTopCreature(checking) 
        if(isCreature(creature) == TRUE) then 
            if(isPlayer(creature) == TRUE) then 
                return false 
            else 
                table.insert(monster, creature) 
            end 
        end 
        if(checking.x == ending.x) then 
            checking.x = starting.x 
            checking.y = checking.y + 1 
        end 
        checking.x = checking.x + 1 
    end 
    for i, c in ipairs(monster) do  
        doRemoveCreature(c) 
    end     
    return true 
end 
  
function checkLevel() 
if item.itemid == 1945 then
players=0
totalmonsters=0
monster = {}
repeat
creature= getThingfromPos(checking)
 if creature.itemid > 0 then
 if getPlayerAccess(creature.uid) == 0 then
 players=players+1
 end
  if getPlayerAccess(creature.uid) ~= 0 and getPlayerAccess(creature.uid) ~= 3 then
   end
 end
checking.x=checking.x+1
  if checking.x>ending.x then
  checking.x=starting.x
  checking.y=checking.y+1
 end
until checking.y>ending.y
if players==0 then
trash= {x=33193, y=31689, z=15}
current=0
repeat
doTransformItem(item.uid,1946)
end

end
end
 return 1
end
 
Last edited:
PHP:
[11/08/2012 21:12:21] [Error - Action Interface] 
[11/08/2012 21:12:21] data/actions/scripts/battle.lua:onUse
[11/08/2012 21:12:21] Description: 
[11/08/2012 21:12:21] (luaDoTeleportThing) Thing not found
[11/08/2012 21:16:09] [Error - LuaScriptInterface::loadFile] data/actions/scripts/battle.lua:35: ')' expected near 'do'
[11/08/2012 21:16:09] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/battle.lua)
[11/08/2012 21:16:09] data/actions/scripts/battle.lua:35: ')' expected near 'do
 
Lua:
function onUse(cid, item, frompos, item2, topos)
 
starting={x=2086, y=2100, z=7, stackpos=253}
checking={x=starting.x, y=starting.y, z=starting.z, stackpos=starting.stackpos}
ending={x=2092, y=2107, z=5, stackpos=253}
 
if item.uid == 5000 then
 if item.itemid == 1946 then
 
 player1pos = {x=1070, y=1173, z=6, stackpos=253}
 player1 = getThingfromPos(player1pos)
 
 player2pos = {x=1047, y=936, z=6, stackpos=253}
 player2 = getThingfromPos(player2pos)
 
	 if player1.itemid > 0 and player2.itemid > 0 then
 
  player1level = getPlayerLevel(player1.uid)
  player2level = getPlayerLevel(player2.uid)
 
  questlevel = 100
 
  if player1level >= questlevel and player2level >= questlevel then
 
	  queststatus1 = getPlayerStorageValue(player1.uid,5000)
	  queststatus2 = getPlayerStorageValue(player2.uid,5000)
 
	  if queststatus1 == -1 and queststatus2 == -1 then
 
 
	nplayer1pos = {x=1070, y=1173, z=7}
	nplayer2pos = {x=1046, y=937, z=5}
 
   doSendMagicEffect(player1pos,2)
   doSendMagicEffect(player2pos,2)
 
   doTeleportThing(player1.uid,nplayer1pos)
   doTeleportThing(player2.uid,nplayer2pos)
 
	 doSendMagicEffect(nplayer1pos,10)
	 doSendMagicEffect(nplayer2pos,10)
 
	 doTransformItem(item.uid,1945)
 
	else
	 doPlayerSendCancel(cid," Error 1 Happened.")
	end
   else
	doPlayerSendCancel(cid," Error 2 Happened.")
  end
  end
  Chests. 
   elseif(item.uid == 5001) then 
        return questChestPrize(cid, 2494, 1) 
    elseif(item.uid == 5002) then 
        return questChestPrize(cid, 2400, 1) 
    elseif(item.uid == 5003) then  
        return questChestPrize(cid, 2431, 1) 
    elseif(item.uid == 5004) then  
        return questChestPrize(cid, 1990, 1)                 
    end 
end
 
function questChestPrize(cid, itemid, storage) 
    if(getPlayerStorageValue(cid, storage) < TRUE) then 
        if itemid == 1990 then
            container = doPlayerAddItem(cid, itemid, 1)
            doAddContainerItem(container, 2326, 1)
        else
            doPlayerAddItem(cid, itemid, 1) 
        end
        setPlayerStorageValue(cid, storage, TRUE) 
        local item = getItemDescriptions(itemid) 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a " .. item.name .. "") 
    else 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.") 
    end 
    return TRUE 
end
 
function cleanArea() 
    local checking= {x = starting.x, y = starting.y, z = starting.z, stackpos = 253} 
    local monster = {} 
    while(checking.y <= ending.y) do 
        local creature = getTopCreature(checking) 
        if(isCreature(creature) == TRUE) then 
            if(isPlayer(creature) == TRUE) then 
                return false 
            else 
                table.insert(monster, creature) 
            end 
        end 
        if(checking.x == ending.x) then 
            checking.x = starting.x 
            checking.y = checking.y + 1 
        end 
        checking.x = checking.x + 1 
    end 
    for i, c in ipairs(monster) do  
        doRemoveCreature(c) 
    end     
    return true 
end 
 
function checkLevel() 
if item.itemid == 1945 then
players=0
totalmonsters=0
monster = {}
repeat
creature= getThingfromPos(checking)
 if creature.itemid > 0 then
 if getPlayerAccess(creature.uid) == 0 then
 players=players+1
 end
  if getPlayerAccess(creature.uid) ~= 0 and getPlayerAccess(creature.uid) ~= 3 then
   end
 end
checking.x=checking.x+1
  if checking.x>ending.x then
  checking.x=starting.x
  checking.y=checking.y+1
 end
until checking.y>ending.y
if players==0 then
trash= {x=33193, y=31689, z=15}
current=0
repeat
doTransformItem(item.uid,1946)
end
 
end
end
 return 1
end
 
PHP:
local starting= {x = 2016, y = 1984, z = 9}  
local ending= {x = 2027, y = 1990, z = 9}
 
 player1pos = {x=2015, y=1985, z=8, stackpos=253}
 player1 = getThingfromPos(player1pos)
 
 player2pos = {x=2015, y=1988, z=8, stackpos=253}
 player2 = getThingfromPos(player2pos)
 
 if player1.itemid > 0 and player2.itemid > 0 then
 
  player1level = getPlayerLevel(player1.uid)
  player2level = getPlayerLevel(player2.uid)
 
  questlevel = 100
 
  if player1level >= questlevel and player2level then
 
	  queststatus1 = getPlayerStorageValue(player1.uid,5000) -- Edit Storage..
	  queststatus2 = getPlayerStorageValue(player2.uid,5000) -- Edit Storage..
 
	  if queststatus1 == -1 and queststatus2 == -1 then
 
        nplayer1pos = {x=1070, y=1173, z=7}
        nplayer2pos = {x=1046, y=937, z=7}
 
if #player1pos ~= #nplayer1pos and #player2pos ~= #nplayer2pos  then 
    error("Arena has not been properly configured.") 
end  
local player = {}
 
function onUse(cid, item, frompos, item2, topos) 
    if(item.uid == 7000) then  
        if(item.itemid == 1945) then 
            for i, pos in ipairs(player1pos do)
            for i, pos in ipairs(player2pos do) 
                player[i] = getTopCreature(player1pos)
                player[i] = getTopCreature(player2pos)  
            end 
            local ret, players = checkPlayers(cid) 
           if(ret) then 
               local ret, player = checkLevel() 
                if(ret) then   
                    doTeleportThing(player1.uid,nplayer1pos)
                    doTeleportThing(player2.uid,nplayer2pos)
                    doSendMagicEffect(nplayer1pos,10)
                    doSendMagicEffect(nplayer2pos,10) 
                        doTransformItem(item.uid, 1946) 
                      else 
                        sendPlayersText(players, getPlayerName(player) .. " Error 1 Happened.") 
                    end 
                    else 
                  sendPlayersText(players, getPlayerName(player) .. " Error 2 Happened.") 
                 end     
 
 
        elseif(item.itemid == 1946) then  
            if(cleanArea()) then 
                doTransformItem(item.uid, 1945) 
                sendPlayersText(players, getPlayerName(player) .. " Somebody is in the Battle Already") 
            else 
                return FALSE 
            end     
        end 
        return TRUE 
    --- Chests. 
    elseif(item.uid == 5001) then  
        return questChestPrize(cid, 2494, 1) 
    elseif(item.uid == 5002) then  
        return questChestPrize(cid, 2400, 1) 
    elseif(item.uid == 5003) then  
        return questChestPrize(cid, 2431, 1) 
    elseif(item.uid == 5004) then  
        return questChestPrize(cid, 1990, 1)                 
    end 
end 
 
function sendPlayersText(players, text) 
    for _, player in ipairs(players) do  
        doPlayerSendCancel(player, text) 
    end 
end 
 
function questChestPrize(cid, itemid, storage) 
    if(getPlayerStorageValue(cid, storage) < TRUE) then 
        if itemid == 1990 then
            container = doPlayerAddItem(cid, itemid, 1)
            doAddContainerItem(container, 2326, 1)
        else
            doPlayerAddItem(cid, itemid, 1) 
        end
        setPlayerStorageValue(cid, storage, TRUE) 
        local item = getItemDescriptions(itemid) 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a " .. item.name .. "") 
    else 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.") 
    end 
    return TRUE 
end 
 
function checkLevel() 
 
end 
 
function checkStorage(storageValue) 
    for _, player in ipairs(player) do 
        if(getPlayerStorageValue(player, storageValue) ~= TRUE) then 
            return false, player 
        end 
    end     
    return true 
end 
 
function cleanArea() 
    local checking= {x = starting.x, y = starting.y, z = starting.z, stackpos = 253} 
    local monster = {} 
    while(checking.y <= ending.y) do 
        local creature = getTopCreature(checking) 
        if(isCreature(creature) == TRUE) then 
            if(isPlayer(creature) == TRUE) then 
                return false 
            else 
                table.insert(monster, creature) 
            end 
        end 
        if(checking.x == ending.x) then 
            checking.x = starting.x 
            checking.y = checking.y + 1 
        end 
        checking.x = checking.x + 1 
    end 
    for i, c in ipairs(monster) do  
        doRemoveCreature(c) 
    end     
    return true 
end 
 
function checkPlayers(cid) 
    local ret = {} 
    table.insert(ret, cid) 
    for _, curPlayer in ipairs(player) do 
        if(isPlayer(curPlayer) == TRUE) then 
            if(curPlayer ~= cid) then  
                table.insert(ret, curPlayer) 
            end 
        else     
            return false, ret 
        end 
    end     
    return true, ret 
end
































function onUse(cid, item, frompos, item2, topos)
 
starting={x = 2016, y = 1984, z = 9, stackpos=253}
checking={x=starting.x, y=starting.y, z=starting.z, stackpos=starting.stackpos}
ending={x = 2027, y = 1990, z = 9, stackpos=253}
 
if item.uid == 7000 then
 if item.itemid == 1946 then

 player1pos = {x=2015, y=1985, z=8, stackpos=253}
 player1 = getThingfromPos(player1pos)
 
 player2pos = {x=2015, y=1988, z=8, stackpos=253}
 player2 = getThingfromPos(player2pos)
 
	 if player1.itemid > 0 and player2.itemid > 0 then
 
  player1level = getPlayerLevel(player1.uid)
  player2level = getPlayerLevel(player2.uid)
 
  questlevel = 100
 
  if player1level >= questlevel and player2level >= questlevel then
 
	  queststatus1 = getPlayerStorageValue(player1.uid,5000)
	  queststatus2 = getPlayerStorageValue(player2.uid,5000)
 
	  if queststatus1 == -1 and queststatus2 == -1 then
 
  
        nplayer1pos = {x=1070, y=1173, z=7}
        nplayer2pos = {x=1046, y=937, z=7}
		
   doSendMagicEffect(player1pos,2)
   doSendMagicEffect(player2pos,2)
 
   doTeleportThing(player1.uid,nplayer1pos)
   doTeleportThing(player2.uid,nplayer2pos)
 
	 doSendMagicEffect(nplayer1pos,10)
	 doSendMagicEffect(nplayer2pos,10)
 
	 doTransformItem(item.uid,1945)
 
	else
	 doPlayerSendCancel(cid," Error 1 Happened.")
	end
   else
	doPlayerSendCancel(cid," Error 2 Happened.")
  end
  end
  Chests. 
   elseif(item.uid == 5001) then 
        return questChestPrize(cid, 2494, 1) 
    elseif(item.uid == 5002) then 
        return questChestPrize(cid, 2400, 1) 
    elseif(item.uid == 5003) then  
        return questChestPrize(cid, 2431, 1) 
    elseif(item.uid == 5004) then  
        return questChestPrize(cid, 1990, 1)                 
    end 
end
 
function questChestPrize(cid, itemid, storage) 
    if(getPlayerStorageValue(cid, storage) < TRUE) then 
        if itemid == 1990 then
            container = doPlayerAddItem(cid, itemid, 1)
            doAddContainerItem(container, 2326, 1)
        else
            doPlayerAddItem(cid, itemid, 1) 
        end
        setPlayerStorageValue(cid, storage, TRUE) 
        local item = getItemDescriptions(itemid) 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a " .. item.name .. "") 
    else 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.") 
    end 
    return TRUE 
end
 
function cleanArea() 
    local checking= {x = starting.x, y = starting.y, z = starting.z, stackpos = 253} 
    local monster = {} 
    while(checking.y <= ending.y) do 
        local creature = getTopCreature(checking) 
        if(isCreature(creature) == TRUE) then 
            if(isPlayer(creature) == TRUE) then 
                return false 
            else 
                table.insert(monster, creature) 
            end 
        end 
        if(checking.x == ending.x) then 
            checking.x = starting.x 
            checking.y = checking.y + 1 
        end 
        checking.x = checking.x + 1 
    end 
    for i, c in ipairs(monster) do  
        doRemoveCreature(c) 
    end     
    return true 
end 
 
function checkLevel() 
if item.itemid == 1945 then
players=0
totalmonsters=0
monster = {}
repeat
creature= getThingfromPos(checking)
 if creature.itemid > 0 then
 if getPlayerAccess(creature.uid) == 0 then
 players=players+1
 end
  if getPlayerAccess(creature.uid) ~= 0 and getPlayerAccess(creature.uid) ~= 3 then
   end
 end
checking.x=checking.x+1
  if checking.x>ending.x then
  checking.x=starting.x
  checking.y=checking.y+1
 end
until checking.y>ending.y
if players==0 then
trash= {x=2000, y=2000, z=7}
current=0
repeat
doTransformItem(item.uid,1946)
end
 
end
end
 return 1
end
when i used /\ it crashed ( i changes positions cuz the one i made at the first time was wrong)

- - - Updated - - -

and can you remove the quest part???
 
yeaah i updated script.. for this error
see try this:
Lua:
function onUse(cid, item, frompos, item2, topos)
 
starting={x=2086, y=2100, z=7, stackpos=253}
checking={x=starting.x, y=starting.y, z=starting.z, stackpos=starting.stackpos}
ending={x=2092, y=2107, z=5, stackpos=253}
 
if item.uid == 5000 then
 if item.itemid == 1946 then
 
 player1pos = {x=1070, y=1173, z=6, stackpos=253}
 player1 = getThingfromPos(player1pos)
 
 player2pos = {x=1047, y=936, z=6, stackpos=253}
 player2 = getThingfromPos(player2pos)
 
	 if player1.itemid > 0 and player2.itemid > 0 then
 
  player1level = getPlayerLevel(player1.uid)
  player2level = getPlayerLevel(player2.uid)
 
  questlevel = 100
 
  if player1level >= questlevel and player2level >= questlevel then
 
	  queststatus1 = getPlayerStorageValue(player1.uid,5000)
	  queststatus2 = getPlayerStorageValue(player2.uid,5000)
 
	  if queststatus1 == -1 and queststatus2 == -1 then
 
 
	nplayer1pos = {x=1070, y=1173, z=7}
	nplayer2pos = {x=1046, y=937, z=5}
 
   doSendMagicEffect(player1pos,2)
   doSendMagicEffect(player2pos,2)
 
   doTeleportThing(player1.uid,nplayer1pos)
   doTeleportThing(player2.uid,nplayer2pos)
 
	 doSendMagicEffect(nplayer1pos,10)
	 doSendMagicEffect(nplayer2pos,10)
 
	 doTransformItem(item.uid,1945)
 
	else
	 doPlayerSendCancel(cid," Error 1 Happened.")
	end
   else
	doPlayerSendCancel(cid," Error 2 Happened.")
  end
  end
  Chests. 
   elseif(item.uid == 5001) then 
        return questChestPrize(cid, 2494, 1) 
    elseif(item.uid == 5002) then 
        return questChestPrize(cid, 2400, 1) 
    elseif(item.uid == 5003) then  
        return questChestPrize(cid, 2431, 1) 
    elseif(item.uid == 5004) then  
        return questChestPrize(cid, 1990, 1)                 
    end 
end
 
function questChestPrize(cid, itemid, storage) 
    if(getPlayerStorageValue(cid, storage) < TRUE) then 
        if itemid == 1990 then
            container = doPlayerAddItem(cid, itemid, 1)
            doAddContainerItem(container, 2326, 1)
        else
            doPlayerAddItem(cid, itemid, 1) 
        end
        setPlayerStorageValue(cid, storage, TRUE) 
        local item = getItemDescriptions(itemid) 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a " .. item.name .. "") 
    else 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.") 
    end 
    return TRUE 
end
 
function cleanArea() 
    local checking= {x = starting.x, y = starting.y, z = starting.z, stackpos = 253} 
    local monster = {} 
    while(checking.y <= ending.y) do 
        local creature = getTopCreature(checking) 
        if(isCreature(creature) == TRUE) then 
            if(isPlayer(creature) == TRUE) then 
                return false 
            else 
                table.insert(monster, creature) 
            end 
        end 
        if(checking.x == ending.x) then 
            checking.x = starting.x 
            checking.y = checking.y + 1 
        end 
        checking.x = checking.x + 1 
    end 
    for i, c in ipairs(monster) do  
        doRemoveCreature(c) 
    end     
    return true 
end 
 
function checkLevel() 
if item.itemid == 1945 then
players=0
totalmonsters=0
monster = {}
repeat
creature= getThingfromPos(checking)
 if creature.itemid > 0 then
 if getPlayerAccess(creature.uid) == 0 then
 players=players+1
 end
  if getPlayerAccess(creature.uid) ~= 0 and getPlayerAccess(creature.uid) ~= 3 then
   end
 end
checking.x=checking.x+1
  if checking.x>ending.x then
  checking.x=starting.x
  checking.y=checking.y+1
 end
until checking.y>ending.y
if players==0 then
trash= {x=33193, y=31689, z=15}
current=0
repeat
doTransformItem(item.uid,1946)
end
 
end
end
 return 1
end
 
nope nothin

- - - Updated - - -

this script works but there is an error and i dont understand it
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local firstPlayerPosition = {x = 2015, y = 1986, z = 8, stackpos = STACKPOS_TOP_CREATURE}
	local getFirstPlayer = getThingFromPos(firstPlayerPosition)
	local secondPlayerPosition = {x = 2015, y = 1988, z = 8, stackpos = STACKPOS_TOP_CREATURE}
	local getSecondPlayer = getThingFromPos(secondPlayerPosition)
	local arenaLevel = 100
	local newFirstPlayerPosition = {x = 2018, y = 1987, z = 9}
	local newSecondPlayerPosition = {x = 2025, y = 1987, z = 9}
	if(item.uid == 7001) then
		if(getFirstPlayer.itemid > 0 and getSecondPlayer.itemid > 0) then
			if(getPlayerLevel(getFirstPlayer.uid) >= arenaLevel and getPlayerLevel(getSecondPlayer.uid) >= 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 100.")
			end
		else
			doPlayerSendCancel(cid, "You need 2 players for a duel.")
		end
	end
	return TRUE
end
error
PHP:
[11/08/2012 21:57:12] [Error - Action Interface] 
[11/08/2012 21:57:12] data/actions/scripts/battle.lua:onUse
[11/08/2012 21:57:12] Description: 
[11/08/2012 21:57:12] (luaGetThingFromPos) Tile not found
 
My script for me its works i tested.. hmm ok use this:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local firstPlayerPosition = {x = 1070, y = 1173, z = 6, stackpos = STACKPOS_TOP_CREATURE}
    local getFirstPlayer = getThingFromPos(firstPlayerPosition)
    local secondPlayerPosition = {x = 1047, y = 936, z = 5, stackpos = STACKPOS_TOP_CREATURE}
    local getSecondPlayer = getThingFromPos(secondPlayerPosition)
    local arenaLevel = 100
    local newFirstPlayerPosition = {x = 1070, y = 1173, z = 7}
    local newSecondPlayerPosition = {x = 1046, y = 937, z = 5}
    if(item.uid == 7001) then
        if(getFirstPlayer.itemid > 0 and getSecondPlayer.itemid > 0) then
            if(getPlayerLevel(getFirstPlayer.uid) >= arenaLevel and getPlayerLevel(getSecondPlayer.uid) >= 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 100.")
            end
        else
            doPlayerSendCancel(cid, "You need 2 players for a duel.")
        end
    end
    return TRUE
end

Remember in your script edit this:
Lua:
    local firstPlayerPosition = {x = 1070, y = 1173, z = 6, stackpos = STACKPOS_TOP_CREATURE}
    local getFirstPlayer = getThingFromPos(firstPlayerPosition)
    local secondPlayerPosition = {x = 1047, y = 936, z = 5, stackpos = STACKPOS_TOP_CREATURE}
    local getSecondPlayer = getThingFromPos(secondPlayerPosition)
    local arenaLevel = 100
    local newFirstPlayerPosition = {x = 1070, y = 1173, z = 7}
    local newSecondPlayerPosition = {x = 1046, y = 937, z = 5}

positions x y z for your positions..
 
the positions are right , the first ones are wrong

- - - Updated - - -

i think the error is in here
PHP:
for arenax = 1041, 1052 do
                    for arenay = 985, 991 do
 
edit.. ??
Lua:
local firstPlayerPosition = {x = 1070, y = 1173, z = 6, stackpos = STACKPOS_TOP_CREATURE}
for your position quest :p?
 
Back
Top