Jump to content
  • 0

Conversao Script Ant Mc para Revscript


Tutubarones
 Share

Question

Olá, tenho os scripts abaixo(nao testados) e gostaria de converter um deles para revscript.

Minha intenção é bloquear o login de IPs com mais de 4 characters online para coincidir com as regras do otservlist.

Obrigado

 

Citar
local config = {
                max = 3,         -- numero de players permitido com o mesmo ip
                group_id = 1  -- kikar apenas player com o group id 1
}

local accepted_ip_list = {} -- lista dos players permitidos a usar MC, exemplo: {"200.85.3.60", "201.36.5.222"}

local function antiMC(p)
    if #getPlayersByIp(getPlayerIp(p.pid)) >= p.max then
        doRemoveCreature(p.pid)
    end
    return true
end

function onLogin(cid)
    if getPlayerGroupId(cid) <= config.group_id then
        if isInArray(accepted_ip_list,doConvertIntegerToIp(getPlayerIp(cid))) == false then
            addEvent(antiMC, 1000, {pid = cid, max = config.max+1})
        end        
    end    
    return true
end

o outro é esse:

Citar
--[[ Anti Multi-Client System
 Modify but preserve credits
 Developed by Notorious
]]--


 local config = {
  msg = "Notorious Anti-MC System has detected that you are multi clienting.",
  maxMultiClients = 2,
  allowGroupId = 2,
  ignoreIps = {"ip1", "ip2"}
 }


function onLogin(cid)


    if getPlayerGroupId(cid) >= config.allowGroupId then
     return TRUE
    end


 local number
 local playersOnline = getPlayersOnline()


    for _, pid in pairs(playersOnline) do
     local pip = getPlayerIp(pid)
        if cid ~= pid and getPlayerIp(cid) == pip and not isInArray(config.ignoreIps, doConvertIntegerToIp(getPlayerIp(cid))) then
         number = (number or 0) + 1
            if number > config.maxMultiClients then
             return FALSE, doPlayerPopupFYI(cid, config.msg)
            end
        end
    end


return TRUE
end

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...