Postado Setembro 5, 2017 7 anos 9 horas atrás, Thayguroficial disse: Opa amigo pode me ajudar, esse script ta 100% funcionando mas eu quero um sem hora determinada pra ser ativado, quero que fique sempre ativo, pois quero por na sala de quest e no evento castle do meu servidor. Outra coisa, ali a parte de frompos/topos como faz pra contar também uma area subterranea ao mesmo tempo, ex: se tiver 1 player no terreo com mesmo ip de outro player em uma montanha ou no subsolo ele joga para o templo. Grato desde já Fiz um mais completo aqui. Nesse caso, vai verificar todos os andares configurados e vai deixar somente um player de cada ip na área, ou seja, removerá todos os MC's. Além disso, é possível fazer a verificação para mais de uma área. Você pode escolher se vai kickar e/ou teleportar o player para o templo. Em globalevents/scripts, crie um arquivo: removeMC.lua Spoiler local t = {kick = true, temple = true, -- kick = false - não kicka o player, temple = false não teleporta o player para o templo areas = { [1] = {{x = 1, y = 1, z = 7}, {x = 1, y = 1, z = 5}}, [2] = {{x = 1, y = 1, z = 7}, {x = 1, y = 1, z = 7}}, [3] = {{x = 1, y = 1, z = 6}, {x = 1, y = 1, z = 8}} }} function onThink(interval, lastExecution) local total = 0 for _, v in pairs(t.areas) do total = total + removeAllMcInArea(v[1], v[2], t.kick, t.temple) end print("Multi Clients removed: " .. total) return true end function removeAllMcInArea(fromPosition, toPosition, kick, toTemple) -- by dwarfer local players, check, freq, remove, removeall = {}, {}, {}, {}, {} 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 if #players > 0 then for _, player in pairs(players) do table.insert(check, getPlayerIp(player)) end end for _, v in pairs(check) do freq[v] = (freq[v] or 0) + 1 end for ip, ip_freq in pairs(freq) do if ip_freq > 1 then local text = "" local mc = getPlayersByIp(ip) for i = 1, #mc do if isInArray(players, mc[i]) and getPlayerAccess(mc[i]) < 3 then text = text .. "" .. mc[i] .. "," end end remove[ip] = text end end for ip, players in pairs(remove) do ret = string.explode(players, ",") for i = 1, (#ret-2) do removeall[#removeall + 1] = ret[i] end end for _, tid in pairs(removeall) do if kick then if toTemple == false then doRemoveCreature(tid) else doTeleportThing(tid, getTownTemplePosition(getPlayerTown(tid))) doRemoveCreature(tid) end else doTeleportThing(tid, getTownTemplePosition(getPlayerTown(tid))) end end return #removeall end Em globalevents.xml, adicione a tag: <globalevent name="RemoveAllMc" interval="30000" event="script" value="removeMC.lua"/> Edite o intervalo para o desejo, coloquei como exemplo 30 segundos. Editado Setembro 5, 2017 7 anos por Dwarfer (veja o histórico de edições) Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Setembro 5, 2017 7 anos 56 minutos atrás, Dwarfer disse: Fiz um mais completo aqui. Nesse caso, vai verificar todos os andares configurados e vai deixar somente um player de cada ip na área, ou seja, removerá todos os MC's. Além disso, é possível fazer a verificação para mais de uma área. Você pode escolher se vai kickar e/ou teleportar o player para o templo. Em globalevents/scripts, crie um arquivo: removeMC.lua Ocultar conteúdo local t = {kick = true, temple = true, -- kick = false - não kicka o player, temple = false não teleporta o player para o templo areas = { [1] = {{x = 1, y = 1, z = 7}, {x = 1, y = 1, z = 5}}, [2] = {{x = 1, y = 1, z = 7}, {x = 1, y = 1, z = 7}}, [3] = {{x = 1, y = 1, z = 6}, {x = 1, y = 1, z = 8}} }} function onThink(interval, lastExecution) local total = 0 for _, v in pairs(t.areas) do total = total + removeAllMcInArea(v[1], v[2], t.kick, t.temple) end print("Multi Clients removed: " .. total) return true end function removeAllMcInArea(fromPosition, toPosition, kick, toTemple) -- by dwarfer local players, check, freq, remove, removeall = {}, {}, {}, {}, {} 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 if #players > 0 then for _, player in pairs(players) do table.insert(check, getPlayerIp(player)) end end for _, v in pairs(check) do freq[v] = (freq[v] or 0) + 1 end for ip, ip_freq in pairs(freq) do if ip_freq > 1 then local text = "" local mc = getPlayersByIp(ip) for i = 1, #mc do if isInArray(players, mc[i]) and getPlayerAccess(mc[i]) < 3 then text = text .. "" .. mc[i] .. "," end end remove[ip] = text end end for ip, players in pairs(remove) do ret = string.explode(players, ",") for i = 1, (#ret-2) do removeall[#removeall + 1] = ret[i] end end for _, tid in pairs(removeall) do if kick then if toTemple == false then doRemoveCreature(tid) else doTeleportThing(tid, getTownTemplePosition(getPlayerTown(tid))) doRemoveCreature(tid) end else doTeleportThing(tid, getTownTemplePosition(getPlayerTown(tid))) end end return #removeall end Em globalevents.xml, adicione a tag: <globalevent name="RemoveAllMc" interval="30000" event="script" value="removeMC.lua"/> Edite o intervalo para o desejo, coloquei como exemplo 30 segundos. Não funcionou aqui, eu coloque a area certinho mas não leva pro templo e também não kicka. Não deu nenhum erro na distro, só aparece Multi Clients removed: 0 que é normal
Postado Setembro 5, 2017 7 anos Se não tiver acesso maior que 3, vai funcionarEnviado de meu GT-S7582L usando Tapatalk Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Setembro 7, 2017 7 anos Em 05/09/2017 em 19:28, Dwarfer disse: Se não tiver acesso maior que 3, vai funcionar Enviado de meu GT-S7582L usando Tapatalk Desculpa a demora pra responder, não chegou notificação da resposta. Cara muito obrigado, funcionou perfeitamente, eu estava testando com o adm
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.