Lua Challenge: the Catastrophes plugin
#13
I'm guessing it's in the order the player's joined.

What you can do is get the number of players, create a random number between 0 and that number, and then take player <nr> from that number.
-- NumPlayers is for example 10
local RandomPlayer = math.random(NumPlayers)
local CurrentPlayer = 0
World:ForEachPlayer(
   function()
      CurrentPlayer = CurrentPlayer + 1
      if (CurrentPlayer == RandomPlayer) then
         --- Do things
         return true -- we did what we wanted with the player
      end
   end
)

Get a random x, y, z in a loaded chunk without loading it? Whut? Assuming you meant unloaded chunk. Can't you just use:
local X = math.random(15)
local Y = math.random(255)
local Z = math.random(15)
Reply
Thanks given by:


Messages In This Thread
Lua Challenge: the Catastrophes plugin - by xoft - 05-21-2015, 09:29 PM
RE: Lua Challenge: the Catastrophes plugin - by NiLSPACE - 05-22-2015, 02:46 AM



Users browsing this thread: 2 Guest(s)