• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Level - Teleport into Arena, on death; teleport out.

Extrodus

|| Blazera.net ||
Joined
Dec 22, 2008
Messages
2,691
Solutions
7
Reaction score
549
Location
Canada
I need a basic script.. think Thais Knight Guildhall, I'm turning it into an arena for pvp. I need up to 6 people configuration. So 3 v 3, but I want it to be allowed that you can have just 1 v 1, or 2 v 2 or 3 v 3. On death, they get tp'd out, if the entire other team gets killed; the winners get tp'd out. Doesn't need rewards, but you can throw an option for some crystal coins, or an itemid (like a medal or trophy).

If anyone can simply script this out I'd be so thankful, I'll shoot ya some rep if that gets you hard, otherwise just do it out of the kindness of your heart and helping a serious RPG project.
 
BUMP! Any help would be great, even the basics to create the script and I might be able to test some stuff. I know it would be, onuse teleport player to x,y,z (setcreatureSOMETHING) so on death they get tped back with no loss.
 
Made this fast, and havn't scripted in a long long long time (:
Missing onDeath shiet and globalStorages, someone should fix it though, pretty sure it has plenty of bugs (:
LUA:
--config--
local positions = { 
                    red = { 
                        {x=XXX,y=YYY,z=Z},
                        {x=XXX,y=YYY,z=Z},
                        {x=XXX,y=YYY,z=Z}
                    },
                    -----------------
                    blue = {
                         {x=XXX,y=YYY,z=Z},
                         {x=XXX,y=YYY,z=Z},
                         {x=XXX,y=YYY,z=Z}
                    }
}


local destinations = {
                    red = { 
                        {x=XXX,y=YYY,z=Z},
                        {x=XXX,y=YYY,z=Z},
                        {x=XXX,y=YYY,z=Z}
                    },
                    -----------------
                    blue = {
                         {x=XXX,y=YYY,z=Z},
                         {x=XXX,y=YYY,z=Z},
                         {x=XXX,y=YYY,z=Z}
                    }
}


local vars = {
a = 0,
b = 0,
storages = {
             red = 75633,
             blue = 75634
             }
}

--/config/--
function onUse(cid, item, fromPosition, itemEx, toPosition)
--loops--
for i = 1, #positions.red do
    if getTopCreature(positions.red[i]).type == 1 and isPlayer(positions.red[i]) then
       vars.a = vars.a + 1
    else
        if vars.a > 0 then
           vars.a = vars.a - 1
        end
    end
end

for i = 1, #positions.blue do
    if getTopCreature(positions.blue[i]).type == 1 and isPlayer(positions.blue[i]) then
       vars.b = vars.b + 1
    else
        if vars.b > 0 then
           vars.b = vars.b - 1
        end
    end
end
--/loops/--

--cancels--
total = vars.a + vars.b 
if vars.a < 1 and vars.b < 1 then
   return doPlayerSendCancel(cid, "There are no players")
end
if (vars.a < 1 and vars.b > 0) or (vars.a > 0 and vars.b < 1) then
   return doPlayerSendCancel(cid, "There are no players in the " .. vars.a < 1 and "first" or "second" .. " team")
end
if isInArray(total,{1,3,5}) then
   return doPlayerSendCancel(cid, "The players in both teams must be equal")
end
--/cancels/--

--script--
if isInArray(total,{2,4,6}) then
   --red--
   if vars.a == 1 then
      if getTopCreature(positions.red[1]).type == 1 then
         doTeleportThing(positions.red[1],destinations.red[1])
         setPlayerStorageValue(positions.red[1], vars.storages.red, 1)
      end
   elseif vars.a == 2 then
          for i = 1, 2 do
              if getTopCreature(positions.red[i]).type == 1 then
                 doTeleportThing(positions.red[i], destinations.red[i])
                 setPlayerStorageValue(positions.red[i], vars.storages.red, 1)
              end
          end
   elseif vars.a == 3 then
          for i = 1, 3 do
              if getTopCreature(positions.red[i]).type == 1 then
                 doTeleportThing(positions.red[i], destinations.red[i])
                 setPlayerStorageValue(positions.red[i], vars.storages.red, 1)
              end
          end
   end
   --blue--
   if vars.b == 1 then
      if getTopCreature(positions.blue[1]).type == 1 then
         doTeleportThing(positions.blue[1],destinations.blue[1])
         setPlayerStorageValue(positions.blue[1], vars.storages.blue, 1)
      end
   elseif vars.b == 2 then
          for i = 1, 2 do
              if getTopCreature(positions.blue[i]).type == 1 then
                 doTeleportThing(positions.blue[i], destinations.blue[i])
                 setPlayerStorageValue(positions.blue[i], vars.storages.blue, 1)
              end
          end
   elseif vars.b == 3 then
          for i = 1, 3 do
              if getTopCreature(positions.blue[i]).type == 1 then
                 doTeleportThing(positions.blue[i], destinations.blue[i])
                 setPlayerStorageValue(positions.blue[i], vars.storages.blue, 1)
              end
          end
   end
end
--/script/--
return true
end
 
So.. from what I see; there are storages used; but your saying they dont work properly? Do you remember the errors you were getting with it?
 
So.. from what I see; there are storages used; but your saying they dont work properly? Do you remember the errors you were getting with it?

The storages are already added for the onDeath script(if storages then tp), as Bogart said this is just the arena lever script, you should add globalStorages to make the reward thingy.
It won't work properly though, but try it if you want.
 
Oh okay, I looked over the script and yea.. when they die.. they die, theres no teleport out. I gotcha, alright well my friend is going to take a look and hopefully help me with this so thank you for giving me the base for the script! Much appreciated <3 And is it just my luck or has no one else requested this here, because I've searched everywhere (since ive seen it in plenty of other servers) and its no where to be found. Luls, anyways; thank you sir.. have a good day/night :)
 
Back
Top