Ban players connected through multiple accounts at the same time
Ban players connected through multiple accounts at the same time
Hello, some people on my server like to open multiple minetest instances and log in with different accounts at the same time. I wouldn't mind this if it weren't because it produces more load on the network and results in bandwidth wasted. I was wondering if there is a mod to prevent this ? I searched around and found mods to ban players but not one for this scenario
- Festus1965
- Member
- Posts: 1632
- Joined: Sun Jan 03, 2016 11:58
- In-game: Thomas Thailand Explorer
- Location: Thailand ChiangMai
- Contact:
Re: Ban players connected through multiple accounts at the same time
Last edited by Festus1965 on Wed Feb 10, 2021 11:37, edited 1 time in total.
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)
If urgend, you find me in Roblox (as CNXThomas)
- sorcerykid
- Member
- Posts: 1537
- Joined: Fri Aug 26, 2016 15:36
- GitHub: sorcerykid
- In-game: Nemo
- Location: Illinois, USA
Re: Ban players connected through multiple accounts at the same time
The following script should do what you need.
Code: Select all
local addrs = { }
minetest.register_privilege( "bypass_addr", {
description = "Permit multiple sessions from the same IP address.",
} )
minetest.register_on_joinplayer( function ( player )
local name = player:get_player_name( )
local ip = minetest.get_player_information( name ).address
if addrs[ ip ] and not minetest.check_player_privs( name, { bypass_addr = true } ) then
minetest.kick_player( name, "Multiple sessions from the same IP address are not permitted." )
else
addrs[ ip ] = name
end
end )
minetest.register_on_leaveplayer( function ( player )
local name = player:get_player_name( )
for k, v in pairs( addrs ) do
if v == name then
addrs[ k ] = nil
return
end
end
end )
- joe7575
- Member
- Posts: 541
- Joined: Mon Apr 24, 2017 20:38
- GitHub: joe7575
- In-game: JoSto wuffi
- Location: Germany, in the deep south
Re: Ban players connected through multiple accounts at the same time
But two or more siblings behind a router/gateway/modem will then have problems...
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, Iron Age, Minecart, Signs Bot.
- Festus1965
- Member
- Posts: 1632
- Joined: Sun Jan 03, 2016 11:58
- In-game: Thomas Thailand Explorer
- Location: Thailand ChiangMai
- Contact:
Re: Ban players connected through multiple accounts at the same time
This often lie I know well already, but
* it is possible to set exceptions for some ip for this, AFTER
* the siblings can proof that they are active with all accounts same time (admin keep checking this ! after also)
(as often a second account is used for home-stay and activating machines, gardening, ...)
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)
If urgend, you find me in Roblox (as CNXThomas)
Re: Ban players connected through multiple accounts at the same time
Great that's exactly what I needed, thank you !
I added a minetest.after with a delay of 1 second to wait for the client to be fully initialized because it was crashing the server every time it kicked someone.
For other people: create a folder named multi_ip (or the name you want really), then inside that folder create an empty file called init.lua and copy the code in it, after that copy that folder to your server's mods folder and restart.
Yes, multiple people connecting from inside the same network would be kicked as well, but admins can grant them bypass_addr
I added a minetest.after with a delay of 1 second to wait for the client to be fully initialized because it was crashing the server every time it kicked someone.
Code: Select all
local addrs = { }
minetest.register_privilege( "bypass_addr", {
description = "Permit multiple sessions from the same IP address.",
} )
minetest.register_on_joinplayer( function ( player )
local name = player:get_player_name( )
local ip = minetest.get_player_information( name ).address
if addrs[ ip ] and not minetest.check_player_privs( name, { bypass_addr = true } ) then
minetest.after(1.0, minetest.kick_player, name, "Multiple sessions from the same IP address are not permitted.")
else
addrs[ ip ] = name
end
end )
minetest.register_on_leaveplayer( function ( player )
local name = player:get_player_name( )
for k, v in pairs( addrs ) do
if v == name then
addrs[ k ] = nil
return
end
end
end )
Yes, multiple people connecting from inside the same network would be kicked as well, but admins can grant them bypass_addr
Who is online
Users browsing this forum: No registered users and 2 guests