Tente algo seguindo a seguinte lógica:
local config = { [1] = { upper_left = {x = x, y = y, z = z}, bottom_right = {x = x, y = y, z = z}, toPos = {x = x, y = y, z = z} }}for i = 1, #config do local upper, bottom = config[i].upper_left, config[i].bottom_right if #getPlayersInArea(upper, bottom) == 0 then doTeleportThing(cid, config[i].toPos) return true endenddoPlayerSendCancel(cid, "Try again later.")
Imagino que a estruturação da tabela seja bem fácil de entender, porém qualquer dúvida basta perguntar.
PS: Essa função getPlayersInArea você pode encontrar pela internet (incluindo aqui no fórum), portanto não vejo necessidade de postá-la.




info
Grupo: Infante
Registrado: 06/03/13
Posts: 1.6k
Reputação: +319
Gênero: Masculino
Char no Tibia: Lord Sorte
Olá galera eu tou criando um sistemas porém estou com dificuldades nessa parte, a qual se tiver algum player na área da tabela 1 teleportar ele para a 2, caso tenha player na 2 teleportar para a 3.
local config = {
[1] = {check = { }, teleport = {}},
[2] = {check = { }, teleport = {}},
[3] = {check = { }, teleport = {}}
}
Check é a área (superior a esquerda, inferior a direita) onde o checará se tem player, teleport é a area do player, ai se no caso as 3 áreas estiver ocupadas mandar uma mensagem para vir depois.