manve1 Posted September 13, 2012 Share Posted September 13, 2012 I need help of refreshing players alive, i tried different way's to fix it my own, but nothing helped. any help accepted function getAlivePlayers ( ) local players = { } for _, player in ipairs ( getElementsByType ( "player" ) ) do if ( getElementHealth ( player ) > 0 ) then table.insert ( players, player ) end end return players end setTimer( getAlivePlayers, 50, 0 ) label = guiCreateLabel ( 0, 0.9525, 1, 1, "ALIVE: ".. #getAlivePlayers ( ), true ) guiSetFont ( label, "sa-header" ) guiLabelSetColor ( label, 255, 175, 0 ) Link to comment
Castillo Posted September 13, 2012 Share Posted September 13, 2012 function getAlivePlayers ( ) local players = { } for _, player in ipairs ( getElementsByType ( "player" ) ) do if ( getElementHealth ( player ) > 0 ) then table.insert ( players, player ) end end return players end label = guiCreateLabel ( 0, 0.9525, 1, 1, "ALIVE: ".. #getAlivePlayers ( ), true ) guiSetFont ( label, "sa-header" ) guiLabelSetColor ( label, 255, 175, 0 ) setTimer ( function ( ) guiSetText ( label, "ALIVE: ".. #getAlivePlayers ( ) ) end ,3000, 0 ) That'll update it every 3 seconds. Link to comment
manve1 Posted September 13, 2012 Author Share Posted September 13, 2012 You know so much, i wounder why u ain't mta pro Link to comment
Castillo Posted September 13, 2012 Share Posted September 13, 2012 You're welcome. P.S: The "MTA Pro" group is for these who donate. Link to comment
manve1 Posted September 13, 2012 Author Share Posted September 13, 2012 someone left game, or died, it still said the number of people that where alive at start of round Link to comment
Castillo Posted September 13, 2012 Share Posted September 13, 2012 As I said, it'll update once every 3 seconds. Link to comment
manve1 Posted September 13, 2012 Author Share Posted September 13, 2012 yes, i waited 8seconds after someone left, still the same Link to comment
Castillo Posted September 13, 2012 Share Posted September 13, 2012 Copy the code again, it works now ( tested ). Link to comment
manve1 Posted September 13, 2012 Author Share Posted September 13, 2012 Another problem, someone dies, it takes the player off the alive section then puts him back on but he is still dead EDIT: im using this for race DD/DM 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