Tenta assim :
local c = {
limit = 5, -- Limite de jogadores
msgCancel = 'Tp bloqueado. Maximo de jogadores atingido', -- Mensagem quando o limite de jogadores estiver atingido
area = {
From = {x = 1069, y = 1027, z = 6}, -- Coordenada maxima superior esquerda
To = {x = 1071, y = 1030, z = 7}, -- Coordenada minima inferior direita
},
pos = {x = 1070, y = 1030, z = 7}, -- Coordenada onde será teletransportado
}
local function getPlayersInArea(fromPos, toPos)
local t = {}
for _, cid in ipairs(getPlayersOnline()) do
if isInRange(getThingPos(cid), fromPos, toPos) then
table.insert(t, cid)
end
end
return t
end
function onStepIn(cid, item, fromPos, toPos)
if isPlayer(cid) then
if table.getn(getPlayersInArea(c.area.From, c.area.To)) < c.limit then
doSendMagicEffect(fromPos, CONST_ME_TELEPORT)
doTeleportThing(cid, c.pos)
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
else
doPlayerSendCancel(cid, c.msgCancel)
doTeleportThing(cid, toPos, false)
end
end
return true
end
faltava um "}" pra fechar a tabela.