~DarkRacer~ Posted March 7, 2013 Posted March 7, 2013 is there a function returns an integer of the active players in the map(RACE)?
Castillo Posted March 7, 2013 Posted March 7, 2013 You mean the alive players? if so, I'm not sure, but you can make one really easy. function getRaceAlivePlayers ( ) local players = 0 for _, player in ipairs ( getElementsByType ( "player" ) ) do if ( getElementData ( player, "state" ) == "alive" ) then players = ( players + 1 ) end end return players end
~DarkRacer~ Posted March 7, 2013 Author Posted March 7, 2013 Yes i mean the alive player thanks. the for loop is really difficult to understand
PaiN^ Posted March 7, 2013 Posted March 7, 2013 You mean the alive players? if so, I'm not sure, but you can make one really easy. function getRaceAlivePlayers ( ) local players = 0 for _, player in ipairs ( getElementsByType ( "player" ) ) do if ( getElementData ( player, "state" ) == "alive" ) then players = ( players + 1 ) end end return players end You should add that to the wiki Useful Functions
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