Postado Setembro 4, 2017 7 anos Solução 11 horas atrás, Mateus Santosss disse: Erro na Distro (lembrando que o servidor é 8.60) Ocultar conteúdo function onStepIn(cid, item, position, fromPosition) if not isPlayer(cid) then return false end local p, mc = getPlayersOnline(), 0 for _, pid in pairs(p) do if getPlayerIp(cid) == getPlayerIp(pid) and pid ~= cid then doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) break end end return true end movevent type="StepIn" actionid="action id desejada" event="script" value="nomedoarquivo.lua"/> O rei de seu proprio destino é aquele que luta pela gloria do amanhã! Discord : ZoR#9373
Postado Setembro 5, 2017 7 anos 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 talkactions/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 onSay(cid, words, param, channel) local total = 0 for _, v in pairs(t.areas) do total = total + removeAllMcInArea(v[1], v[2], t.kick, t.temple) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "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 talkactions.xml, adicione a tag: <talkaction words="!removeMC" access = "5" event="script" value="removeMc.lua"/> Editado Setembro 5, 2017 7 anos por Dwarfer (veja o histórico de edições) Contato: Email: [email protected] Discord: Dwarfer#2715
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.