• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Disable MC

BBFalcon89

Member
Joined
Jul 1, 2010
Messages
51
Reaction score
10
Hi,

Is there anyway in 1.0 to disable multi clients? Like not allowing two of the same ip to log into the game?
I'm pretty sure it's not in config but it seems like something that would have already been done somewhere.

Thanks!
 
This script will let the player stay X amount of seconds before he is kicked off while displaying a message every X seconds

creaturescrpts.xml
Code:
<event type="login" name="MC" script="mc.lua"/>

mc.lua

Code:
local warnings = 3 -- how many times a player will get MC warning before he gets kicked
local interval = 5 -- how many seconds between each MC warning

local function mcKick(player, warnings)
    if warnings ~= 0 then
    player:sendTextMessage(MESSAGE_INFO_DESCR, "Warning: There is another player with the same IP, you will be kicked in "..warnings*interval.." seconds!")
    addEvent(mcKick, interval*1000, player, warnings-1)
    else
    player:remove()
    end
end

function onLogin(cid)
local player = Player(cid)
local allPlayers = Game.getPlayers()
for a,b in pairs(allPlayers) do
if b:getName() ~= player:getName() and b:getIp() == player:getIp() then
return addEvent(mcKick, interval*1000, player, warnings)
end
end
return true
end
 
Just an idle thought, Can you change the script to 'ignore' players with a specific IP address?
Such as players on the same home network? (server's internal network.. It's impossible to tell if two friends are trying to play on an outside network)
Let's say my internal network has the Server hosted on 192.168.2.2, and the friends machine on 192.168.2.3 and the ip for both is 72.32.52.82.

Could possibly just set before the if..
If player.getname == xikini, then
end
elseif

Not sure! Looks cool though. :p
 
Thanks, in the end i decided to go with

Code:
local warnings = 3 -- how many times a player will get MC warning before he gets kicked
local interval = 5 -- how many seconds between each MC warning

local function mcKick(player, warnings)
    if warnings ~= 0 then
    player:sendTextMessage(MESSAGE_INFO_DESCR, "Warning: There is another player with the same IP, you will be kicked in "..warnings*interval.." seconds!")
    addEvent(mcKick, interval*1000, player, warnings-1)
    else
    player:remove()
    end
end

function onLogin(cid)
local player = Player(cid)
local allPlayers = Game.getPlayers()
for a,b in pairs(allPlayers) do
if b:getName() ~= player:getName() and b:getIp() == player:getIp() and player:getAccess > 3 then
return addEvent(mcKick, interval*1000, player, warnings)
end
end
return true
end

Haven't tested it but hoping it works
 
Thanks, in the end i decided to go with

Code:
local warnings = 3 -- how many times a player will get MC warning before he gets kicked
local interval = 5 -- how many seconds between each MC warning

local function mcKick(player, warnings)
    if warnings ~= 0 then
    player:sendTextMessage(MESSAGE_INFO_DESCR, "Warning: There is another player with the same IP, you will be kicked in "..warnings*interval.." seconds!")
    addEvent(mcKick, interval*1000, player, warnings-1)
    else
    player:remove()
    end
end

function onLogin(cid)
local player = Player(cid)
local allPlayers = Game.getPlayers()
for a,b in pairs(allPlayers) do
if b:getName() ~= player:getName() and b:getIp() == player:getIp() and player:getAccess > 3 then
return addEvent(mcKick, interval*1000, player, warnings)
end
end
return true
end

Haven't tested it but hoping it works


I have tested it on my 1.0 TFS server, it works just fine :)
 
Back
Top