Diablomta Posted April 20, 2017 Share Posted April 20, 2017 Hola ire directo a la pregunta, cree un script de que en say salga un jugador random, pero casi siempre me sale repetido , necesito una función para que los jugadores random no se repitan esto lo saque de la wiki de mta pero con este me guié para hacer el script local randomPlayer = getRandomPlayer ( ) outputChatBox ( getPlayerName ( randomPlayer ).." is now the fugitive!" ) Link to comment
Castillo Posted April 21, 2017 Share Posted April 21, 2017 _getRandomPlayer = getRandomPlayer local lastPlayer function getRandomPlayer ( ) local player = _getRandomPlayer ( ) if ( isElement ( lastPlayer ) and lastPlayer ~= player ) then repeat player = _getRandomPlayer ( ) until ( lastPlayer ~= player ) end lastPlayer = player return player end Esta funcion deberia hacer lo que vos queres, el jugar nunca sera el mismo que la ultima vez. 1 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