So I just encountered this error related to my globalevent last man standing..........
Everything is working fine.... the teleport is appearing the broadcast is there and everything is fine..........
My only problem is that once minumum 2 players are in the waiting room... nothing happens they dont get teleported..... idk what's wrong ....
ALL MY COORDINATES ARE PERFECTLY RIGHT AND I AM 100% SURE OF THAT! (CHECKED IT LIKE 10 TIMES)
Here is my php:
REP++ FOR WHO HELPS!
Everything is working fine.... the teleport is appearing the broadcast is there and everything is fine..........
My only problem is that once minumum 2 players are in the waiting room... nothing happens they dont get teleported..... idk what's wrong ....
ALL MY COORDINATES ARE PERFECTLY RIGHT AND I AM 100% SURE OF THAT! (CHECKED IT LIKE 10 TIMES)
Here is my php:
PHP:
local t = {
tmp = {
{x = 32360, y = 32216, z = 3}, -- northwest corner of area where players must stand in order to join the event
{x = 32364, y = 32218, z = 3} -- south east corner
},
arena = {
{x = 32366, y = 32212, z = 3}, -- nw corner of arena
{x = 32378, y = 32222, z = 3}, -- se corner of arena
{x = 32372, y = 32217, z = 3} -- center of arena
},
from = {x = 32366, y = 32212, z = 3}, -- top left cornor of the playground (random players teleportation)
to = {x = 32378, y = 32222, z = 3}, -- bottom right cornor of the playground (random players teleportation)
minPlayers = 2, -- min players required to start the battle
noPlayers = 1, -- no players
prize = {12606} -- rewards
}
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 won a battle and received your reward.")
doBroadcastMessage(getCreatureName(arenaPlayers[1]) .." won a Last Man Standing battle.")
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=32369, y=32240, 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=32369, y=32240, 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
REP++ FOR WHO HELPS!