Postado Outubro 12, 2023 1 ano Se não funcionar para você, tenho esse que fica na área. Essa será a área From = {x = 1069, y = 1027, z = 6}, -- Area Left To = {x = 1071, y = 1030, z = 7}, -- Area Corner local c = { limit = 5, -- Limit players msgCancel = "Nao pode entrar mais.", area = { From = {x = 1069, y = 1027, z = 6}, -- Area Left To = {x = 1071, y = 1030, z = 7}, -- Area Corner }, pos = {x = 1070, y = 1030, z = 7}, -- TPS Players } 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 Editado Outubro 12, 2023 1 ano por Fabi Marzan (veja o histórico de edições)
Postado Outubro 14, 2023 1 ano Autor Solução Em 12/10/2023 em 11:53, Fabi Marzan disse: Se não funcionar para você, tenho esse que fica na área. Essa será a área From = {x = 1069, y = 1027, z = 6}, -- Area Left To = {x = 1071, y = 1030, z = 7}, -- Area Corner local c = { limit = 5, -- Limit players msgCancel = "Nao pode entrar mais.", area = { From = {x = 1069, y = 1027, z = 6}, -- Area Left To = {x = 1071, y = 1030, z = 7}, -- Area Corner }, pos = {x = 1070, y = 1030, z = 7}, -- TPS Players } 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 Desse jeitinho ai mesmo q eu queria, agradeço aos envolvidos ! *-*
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.