Bulk Teleport

basil60
Member
 
Posts: 54
Joined: Sat Sep 12, 2015 22:07

Bulk Teleport

by basil60 » Tue Jun 07, 2016 00:59

Hi

is there, or is there anyway, to bulk teleport a bunch of players in Minetest?

I'm think of the education sphere, where you might want to bring kids to a central point.

I believe Minecraft Edu has something similar.

Basil
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Bulk Teleport

by Krock » Tue Jun 07, 2016 16:44

If there's no mod which does this job yet, you can simply create one.
Here an example code to add a chat command, read your position and teleport all players to you:

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
minetest.register_chatcommand("tp2me", {
   params = "",
   description = "Teleports all players to you",
   privs = {teleport=true},
   func = function(name, param)
      local player_me = minetest.get_player_by_name(name)
      local pos_me = player_me:getpos()
      
      for _,player in ipairs(minetest.get_connected_players()) do
         local player_name = player:get_player_name()
         local player_privs = minetest.get_player_privs(player_name)
         
         -- Ignore players with teleport privilege (= yourself too)
         if not player_privs["teleport"] then
            player:setpos(pos_me)
         end
      end
   end
})
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

basil60
Member
 
Posts: 54
Joined: Sat Sep 12, 2015 22:07

Re: Bulk Teleport

by basil60 » Mon Jun 13, 2016 01:45

Thanks
I'll test as soon as I can.
Appreciate your help
 

basil60
Member
 
Posts: 54
Joined: Sat Sep 12, 2015 22:07

Re: Bulk Teleport

by basil60 » Thu Jun 16, 2016 00:36

Spot on - seems to work perfectly. Yet to test with larger numbers of players - but a handy tool with lots of promise.
Thanks Krock
 


Return to Minetest General

Who is online

Users browsing this forum: No registered users and 6 guests

cron