Hi, I'm trying to pick two random players from the server using a concommand. After looking here, I figured out that using [CODE]table.Random(Player.GetAll())[/CODE] was the option. So, I have this code in shared.lua (tried it in init.lua, also):
[CODE]function GameStart(ply)
pl1 = table.Random(ply.GetAll())
pl2 = table.Random(ply.GetAll())
print(pl1:Nick() .. " is the first random player")
print(pl2:Nick() .. " is the second random player")
end[/CODE]
And it says that ply.GetAll() is nil value. Is there something I'm missing?
Here's the ConCommand hook:
[code]concommand.Add( "con_debug", GameStart )[/code]
Thanks!
player.GetAll(), it's all case sensitive.
[editline]12th October 2013[/editline]
Not ply.GetAll() or Player.GetAll(), but [B]p[/B]layer.GetAll()
Wow, that fixed it. Thanks a lot!
Sorry, you need to Log In to post a reply to this thread.