Postado Outubro 5, 2017 7 anos Queria um Scripts para Teleport Teleport que levaria a lugar X e ninguém pode entrar até a pessoa que entrou no teleport sair da area OBS: A pessoa que entrou sera kikada da area em para lugar X. Depois de 12 minutos.
Postado Outubro 6, 2017 7 anos Solução Em movements/scripts, crie um arquivo.lua: Spoiler local t = { time = {12, "min"}, -- tempo para ser kikado new_pos = Position(1,1,1), -- posição para onde o teleporte levará kick_pos = Position(1,1,1), -- posição quando o player for kikado area = {Position(1,1,1), Position(2,2,2)} -- canto superior esquerdo, canto inferior direito da área } function onStepIn(creature, item, position, fromPosition) if not creature:isPlayer() then return false end local players = getPlayersInArea(t.area[1], t.area[2]) if #players > 0 then creature:teleportTo(fromPosition) creature:sendCancelMessage("There is a player on the room. Wait a moment.") return false end creature:say("You will be kicked from the room in " .. t.time[1] .. " " .. t.time[2] .. ".", TALKTYPE_MONSTER_YELL) creature:teleportTo(t.new_pos) t.new_pos:sendMagicEffect(CONST_ME_TELEPORT) addEvent(kickFromRoom, mathtime(t.time) * 1000, Player(creature):getId(), Position(t.kick_pos)) return true end function getPlayersInArea(fromPos, toPos) local players = {} for _, pid in ipairs(Game.getPlayers()) do if isInRange(pid:getPosition(), fromPos, toPos) then table.insert(players, pid) end end return players end function kickFromRoom(uid, out) local player = Player(uid) if player:isPlayer() then player:teleportTo(out) out:sendMagicEffect(CONST_ME_TELEPORT) end end function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1) end end return error("Bad declaration in mathtime function.") end Em movements.xml adicione a tag: <movevent event="StepIn" actionid="ACTION_ID_DO_TELEPORT" script="NOMEDOSEUARQUIVO.lua" /> Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Outubro 6, 2017 7 anos Autor 3 horas atrás, Dwarfer disse: Em movements/scripts, crie um arquivo.lua: Ocultar conteúdo local t = { time = {12, "min"}, -- tempo para ser kikado new_pos = Position(1,1,1), -- posição para onde o teleporte levará kick_pos = Position(1,1,1), -- posição quando o player for kikado area = {Position(1,1,1), Position(2,2,2)} -- canto superior esquerdo, canto inferior direito da área } function onStepIn(creature, item, position, fromPosition) if not creature:isPlayer() then return false end local players = getPlayersInArea(t.area[1], t.area[2]) if #players > 0 then creature:teleportTo(fromPosition) creature:sendCancelMessage("There is a player on the room. Wait a moment.") return false end creature:say("You will be kicked from the room in " .. t.time[1] .. " " .. t.time[2] .. ".", TALKTYPE_MONSTER_YELL) creature:teleportTo(t.new_pos) t.new_pos:sendMagicEffect(CONST_ME_TELEPORT) addEvent(kickFromRoom, mathtime(t.time) * 1000, Player(creature):getId(), Position(t.kick_pos)) return true end function getPlayersInArea(fromPos, toPos) local players = {} for _, pid in ipairs(Game.getPlayers()) do if isInRange(pid:getPosition(), fromPos, toPos) then table.insert(players, pid) end end return players end function kickFromRoom(uid, out) local player = Player(uid) if player:isPlayer() then player:teleportTo(out) out:sendMagicEffect(CONST_ME_TELEPORT) end end function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1) end end return error("Bad declaration in mathtime function.") end Em movements.xml adicione a tag: <movevent event="StepIn" actionid="ACTION_ID_DO_TELEPORT" script="NOMEDOSEUARQUIVO.lua" /> Só não funciono a parte de não poder entrar com outro player ja na area o resto ta funcionando Tenho uma duvida se não fiz errado ja que não modifiquei a area = {Position(1,1,1), Position(2,2,2)} -- canto superior esquerdo, canto inferior direito da área Acho que isso é posição da mensagem? ou deveria ter modificado? @Dwarfer Link do erro no Distro é uma foto https://drive.google.com/file/d/0B4pC903wnF42RGdLV0EzaHhTSWM/view?usp=sharing Editado Outubro 6, 2017 7 anos por joaobenhur (veja o histórico de edições)
Postado Outubro 6, 2017 7 anos Tem que modificar sim. É só pegar as duas posições como está descrito. Se for a versão do TFS for 1.x e configurar certinho, vai funcionar. Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Outubro 6, 2017 7 anos Autor @Dwarfer Mudei e agora fala que ja tem alguem la dentro da area X time = {1, "min"}, -- tempo para ser kikado new_pos = Position(37677,37363,7), -- posição para onde o teleporte levará kick_pos = Position(37679,37353,7), -- posição quando o player for kikado area = {Position(37677,37359,7), Position(37679,37360,7)} -- canto superior esquerdo, canto inferior direito da área
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.