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

LMS players cant win

Sweetlove

Member
Joined
Jun 22, 2009
Messages
270
Reaction score
14
Location
Sverige
Hey, like the ^ goes, players can't win in LMs arena, the tp to the arena and everything goes smooth and the tp out from arena when u get killed works fiine..
 
People can't win inside the arena , if u get killed you will be teleported to temple but if you're last in the arena " winner " nothing happens , just stands there forever....

I'll post when i get back from work.
 
Arena.lua
Code:
local t = {
tmp = {
{x = 982, y = 963, z = 7}, -- North west corner of Area where players must stand in order to join the event
{x = 988, y = 969, z = 7} -- South east corner of Area
},
arena = {
{x = 1016, y = 954, z = 7}, -- North west Corner of Arena
{x = 1024, y = 962, z = 7}, -- South East corner of Arena
{x = 1020, y = 958, z = 7} -- Center of Arena
},

from = {x = 1016, y = 954, z = 7}, -- Top left cornor of the playground (random players teleportation)
to = {x = 1024, y = 962, z = 7}, -- Bottom right cornor of the playground (random players teleportation)

minPlayers = 2, -- min players required to start the battle
noPlayers = 1, -- Leave it as it is
prize = {6527} -- Reward that player recives
}
local kick = 0

function onThink()
local arenaPlayers = {}

for x = t.arena[1].x, t.arena[2].x do
for y = t.arena[1].y, t.arena[2].y do
for z = t.arena[1].z, t.arena[2].z do
local pos = {x = x, y = y, z = z}
local n = getTileInfo(pos).creatures
if n ~= 0 then
pos.stackpos = 1
local c = getThingfromPos(pos)
while c.uid ~= 0 do
if c.itemid == 1 and c.type == 1 then
table.insert(arenaPlayers, c.uid)
if #arenaPlayers == n then
break
end
end
pos.stackpos = pos.stackpos + 1
c = getThingfromPos(pos)
end
end
end
end
end

if #arenaPlayers == 1 then
local p = getPlayerMasterPos(arenaPlayers[1])
doTeleportThing(arenaPlayers[1], p)
doSendMagicEffect(p, CONST_ME_TELEPORT)
doPlayerSendTextMessage(arenaPlayers[1], MESSAGE_STATUS_CONSOLE_BLUE, "You have won the event and received your reward.")
doBroadcastMessage(getCreatureName(arenaPlayers[1]) .." won a Last Man Standing Event.")
doPlayerAddItem(arenaPlayers[1], t.prize[math.random(#t.prize)], 10)
kick = 0
elseif #arenaPlayers > 1 then
if kick == 0 then
kick = os.time()
else
if os.time() - kick >= 840 then
kick = 0
for i = 1, #arenaPlayers do
doTeleportThing(arenaPlayers[i], {x=1071, y=1059, z=7})
doPlayerSendTextMessage(arenaPlayers[i], MESSAGE_STATUS_WARNING, "Too even, try harder next time.")
end
end
end
elseif #arenaPlayers == 0 then
kick = 0

local players = {}
for x = t.tmp[1].x, t.tmp[2].x do
for y = t.tmp[1].y, t.tmp[2].y do
for z = t.tmp[1].z, t.tmp[2].z do
local c = getTopCreature({x = x, y = y, z = z})
if c.type == 1 then
table.insert(players, c.uid)
end
end
end
end

if #players >= t.minPlayers then
for i = 1, #players do
local p = {x = math.random(t.from.x, t.to.x), y = math.random(t.from.y, t.to.y), z = math.random(t.from.z, t.to.z)}
doTeleportThing(players[i], p)
doSendMagicEffect(p, CONST_ME_TELEPORT)
doPlayerSendTextMessage(players[i], MESSAGE_STATUS_WARNING, "The battle begins. Survive for glory!")
end
else
for i = 1, #players do
doTeleportThing(players[i], {x=1071, y=1059, z=7})
doPlayerSendTextMessage(players[i], MESSAGE_STATUS_WARNING, "The event didn't start because there isn't enough players in area!")
end
end
end
return true
end

Lastman.lua

Code:
local createpos = {x=986,y=1041,z=4} -- Every 2h where will the Teleport Appear
local topos = {x=985,y=966,z=7} -- Where will the Teleport take you
local msg = "Last man standing event TP has now been closed! It will open again in 2 hours! All participants get Ready for a Fight!"
local timetoclose = 120 -- in second

local function remove()
local tp = getTileItemById(createpos,1387).uid
if tp ~= 0 then
doRemoveItem(tp)
doBroadcastMessage(msg)
end
end

function onThink(interval)
doCreateTeleport(1387, topos, createpos)
doBroadcastMessage("Last man standing event TP is now open!\nCatch the teleport within "..timetoclose.." seconds! Teleport is Located in Events Room.")
addEvent(remove,timetoclose*1000)
return true
end

Login.lua

Code:
    registerCreatureEvent(cid, "pvparena")

Creaturescript/scripts/pvparena.lua

Code:
local arena = {
  frompos = {x=1016, y=954, z=7},
  topos = {x=1024, y=962, z=7},
  exitpos = {x=1071, y=1059, z=7}
}
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
  if isPlayer(cid) then
  if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
  doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), true)
    doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"[Arena]: You lost the duel.")
    doTeleportThing(cid, arena.exitpos)
  end
  end
  return true
end

@Ray Rewind

bump

Bump
 
Last edited by a moderator:
Back
Top