-stolka- Posted October 11, 2014 Share Posted October 11, 2014 hi i found this function on the wiki that get a random player 'getRandomPlayer' is it possible to make a function that do the same thing but cannot get the player i'm using... for exaple if i use the command /random can i get a random player exept myself? Link to comment
Anubhav Posted October 11, 2014 Share Posted October 11, 2014 _get = getRandomPlayer function getRandomPlayer(expect) if isElement(expect) and getElementType(expect) == "player" then local p = _get() if p == expect and getPlayerCount() == 1 then return false else return p end end end Link to comment
TAPL Posted October 11, 2014 Share Posted October 11, 2014 Try (Not tested), getRandomPlayer_ = getRandomPlayer function getRandomPlayer(arg) if getPlayerCount() == 1 then return false else local p = getRandomPlayer_() while p == arg do p = getRandomPlayer_() end return p end end Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now