Hello, I have the scripts below (not tested) and I would like to convert one of them to revscript.
My intention is to block the login of IPs with more than 4 characters online to match the otservlist rules.
Thanks
My intention is to block the login of IPs with more than 4 characters online to match the otservlist rules.
Thanks
Lua:
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
Lua:
--[[ 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