DR

[Resolvido] Torneio GlobalEvents

Por DrewMarques, 06 de ago. de 2017 em Resolvidos

6
1.9k
DrewMarquesD
06 de agosto de 2017 às 02:37

hi pessoal preciso de ajuda com meu script, to com system de torneio, porem ele quando puxa pra area de combate ele puxa os player em 1 lugar so caindo todos os player no mesmo lugar causando debugs, eu queria q esse scritp puxa-se os player em lugares diferente da area,

 

alguem pode me ajudar?

 

SCRIPT:

Spoiler

function onTimer()
if #getPlayersInArea(torneio.area) > 1 then
return true
end
for _, pid in ipairs(getPlayersInArea(torneio.waitArea)) do
doTeleportThing(pid, torneio.tournamentFight)

end
doBroadcastMessage("O torneio de johto 150+ começou!")
return true
end

 

LIB DO TORNEIO SE FOR PRECISO

Spoiler

torneio = {
awardTournament = 2152,
awardAmount = 150,
playerTemple = {x = 1227, y = 1755, z = 7},
tournamentFight = {x = 931, y = 1724, z = 6},
area = {fromx = 896, fromy = 1704, fromz = 6, tox = 961, toy = 1751, toz= 6},
waitPlace = {x = 925, y = 1759, z = 6},  
waitArea = {fromx = 914, fromy = 1753, fromz = 6, tox = 937, toy = 1767, toz= 6},
startHour1 = "08:45:00",
endHour1 = "09:00:00",
startHour2 = "12:15:00",
endHour2 = "12:30:00",
startHour3 = "18:45:00",
endHour3 = "19:00:00",
startHour4 = "22:45:00",
endHour4 = "23:00:00",

price = 200000,
revivePoke = 12344,
}
function getPlayersInArea(area)
local players = {}
for x = area.fromx,area.tox do
for y = area.fromy,area.toy do
for z = area.fromz,area.toz do
local m = getTopCreature({x=x, y=y, z=z}).uid
if m ~= 1 and isPlayer(m) then
table.insert(players, m)
end
end
end
end
return players
end

 

LeoxtibiaL
06 de agosto de 2017 às 09:23
function onTimer()if #getPlayersInArea(torneio.area) > 1 thenreturn trueendfor _, pid in ipairs(getPlayersInArea(torneio.waitArea)) domath.randomseed(os.time())rand = math.random(-2, 2)doTeleportThing(pid, {x = torneio.tournamentFight.x + rand, y = torneio.tournamentFight.y + rand, z = torneio.tournamentFight.z})enddoBroadcastMessage("O torneio de johto 150+ começou!")return trueend

 

DrewMarquesD
06 de agosto de 2017 às 12:59
3 horas atrás, Leoxtibia disse:
function onTimer()if #getPlayersInArea(torneio.area) > 1 thenreturn trueendfor _, pid in ipairs(getPlayersInArea(torneio.waitArea)) domath.randomseed(os.time())rand = math.random(-2, 2)doTeleportThing(pid, {x = torneio.tournamentFight.x + rand, y = torneio.tournamentFight.y + rand, z = torneio.tournamentFight.z})enddoBroadcastMessage("O torneio de johto 150+ começou!")return trueend

 

Continua puxando juntos

LeoxtibiaL
06 de agosto de 2017 às 13:19
Melhor resposta
19 minutos atrás, DrewMarques disse:

Continua puxando juntos

 

Tinha colocado uma linha a mais:

 

function onTimer()if #getPlayersInArea(torneio.area) > 1 thenreturn trueendfor _, pid in ipairs(getPlayersInArea(torneio.waitArea)) dorand = math.random(-2, 2)doTeleportThing(pid, {x = torneio.tournamentFight.x + rand, y = torneio.tournamentFight.y + rand, z = torneio.tournamentFight.z})enddoBroadcastMessage("O torneio de johto 150+ começou!")return trueend

 

 

DrewMarquesD
06 de agosto de 2017 às 13:25
5 minutos atrás, Leoxtibia disse:

 

Tinha colocado uma linha a mais:

 

function onTimer()if #getPlayersInArea(torneio.area) > 1 thenreturn trueendfor _, pid in ipairs(getPlayersInArea(torneio.waitArea)) dorand = math.random(-2, 2)doTeleportThing(pid, {x = torneio.tournamentFight.x + rand, y = torneio.tournamentFight.y + rand, z = torneio.tournamentFight.z})enddoBroadcastMessage("O torneio de johto 150+ começou!")return trueend

 

 

Funcionou Obg man

3 meses depois...
StigalS
29 de novembro de 2017 às 15:01
A questão neste tópico de suporte foi respondida e/ou o autor do tópico resolveu o problema. Este tópico está fechado e foi movido para Suporte - Resolvidos. Se você tiver outras dúvidas, crie um novo tópico.