Postado Março 10, 2018 7 anos Solução Opa, é mesmo, tinha me esquecido disso, vou arrumar, quando editar esse post aqui eu te marco. Edit: @poko360 function onSay(cid, words, param, channel) function getAllPlayersInArea(fromPosition, toPosition) local players = {} for _, pid in ipairs(getPlayersOnline()) do local f = {x = fromPosition.x, y = fromPosition.y, z = fromPosition.z} local t = {x = toPosition.x, y = toPosition.y, z = toPosition.z} local min = (fromPosition.z > toPosition.z and toPosition.z or fromPosition.z) for index = 0, math.abs(toPosition.z - fromPosition.z) do f.z = min + index t.z = min + index if isInRange(getPlayerPosition(pid), f, t) then table.insert(players, pid) end end end return players end local function doTeleportToOnlinePlayers(cid) local trainerArea = {{x = 1022, y = 1026, z = 7}, {x = 1025, y = 1029, z = 7}} --- {canto superior direito}, {canto inferior direito} - pegando a area toda local playersTrainer = getAllPlayersInArea(trainerArea[1], trainerArea[2]) local ons = getPlayersOnline() if #ons < 2 then return doPlayerSendCancel(cid, "Don't have any player online, beyond you.") end for index, jogador in ipairs(ons) do for index2, jogador2 in ipairs(playersTrainer) do if (ons[index] == playersTrainer[index2]) then table.remove(ons, index) end end end local player_rand = ons[math.random(#ons)] if (player_rand == cid) then return false end local pos = getClosestFreeTile(cid, getThingPos(player_rand), true, false) if(not pos or isInArray({pos.x, pos.y}, 0)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.") return true end local tmp = getThingPos(cid) if(doTeleportThing(cid, pos, true) and (not isPlayerGhost(cid))) then doSendMagicEffect(tmp, CONST_ME_POFF) doSendMagicEffect(pos, CONST_ME_TELEPORT) end return true end doTeleportToOnlinePlayers(cid) return true end Editado Março 10, 2018 7 anos por lordzetros (veja o histórico de edições)
Postado Março 10, 2018 7 anos 47 minutos atrás, poko360 disse: agora sim 100%, mt obrigado, REP+ Opa, que bom que resolveu, fiz uma pequena modificação numa verificação que se tornava inútil, se quiser copiar o novo código, ^^. Abç.
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.