Page 1 of 1

reserved slots

PostPosted: Sun Aug 31, 2014 11:51
by mike
As known from other Games, there should be a reserved slots feature.
People with the priv "reservedslot" should be able to connect, even if the playerlimit is reached.

This could be solved by a mod which kicks the latest joining players when maxplayers-2 is reached.
Engine support would be better.

So the admin (and his friends) can always connect.

Alternative:
Kick last 2 Players or 2 Random Players when a privileged player connects.

Re: reserved slots

PostPosted: Sun Aug 31, 2014 12:28
by Jordach
Nobody actually uses the max players in the conf file, so this is redundant as Minetest supports a near infinite players at once.

Provided you have a good network connection.

Re: reserved slots

PostPosted: Sun Aug 31, 2014 13:43
by mike
i actually do and its necessary to keep the cpu load low enough, so it does not lag.
so you cant run more than i think 10-15 players on a p4.

Re: reserved slots

PostPosted: Sun Aug 31, 2014 14:34
by rubenwardy
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
MAX_PLAYERS = 6
minetest.register_privilege("reserved_slot")

minetest.register_on_prejoinplayer(function(name, ip)
    if #minetest.get_connected_players() >= MAX_PLAYERS - 2 and
            not minetest.check_player_privs(name, {reserved_slot = true}) then
        return "Too many users on this server"
    end
end)

Re: reserved slots

PostPosted: Sun Aug 31, 2014 17:08
by mike
Thanks! That was very quick and good!

Re: reserved slots

PostPosted: Sun Aug 31, 2014 17:57
by Minetestforfun
It's a very good idea !
Reserved slots is activable for other games...

@rubenwardy
Can you make a quick guide step by step for implement your commands code ?

Re: reserved slots

PostPosted: Sun Aug 31, 2014 18:19
by rubenwardy
  • Create a folder called "reserved" in your mod folder. (ie: ~/.minetest/mods)
  • Paste the code into a new file in that folder called init.lua. Modify MAX_PLAYERS to suit your needs
  • Enable the mod.
  • /grant player reserved_slot

Re: reserved slots

PostPosted: Sun Aug 31, 2014 18:38
by Minetestforfun
Thank you rubenwardy