Infernus Posted May 11, 2011 Share Posted May 11, 2011 Hi Guys ,, I have A simple Question How Can Get Alive Players In Team ?? i Want make script Calculate the points of teams it's benefit? local myteam = createTeam("mtasa.com") local players = getPlayersInTeam(myteam) local aliveplayers = getAlivePlayers(players) >>> i don't think >>> noob sorry i'am noob ,, and sorry for my english LoL Link to comment
Castillo Posted May 11, 2011 Share Posted May 11, 2011 local myteam = createTeam("mtasa.com") function getAlivePlayersInTeam(theTeam) local players = getPlayersInTeam(theTeam) for i,v in pairs(players) do if getElementHealth(v) >= 1 then end end return players end With that function you can do getAlivePlayersInTeam(myteam) and it should return a table with the alive players in the desired team. Link to comment
karlis Posted May 12, 2011 Share Posted May 12, 2011 local myteam = createTeam("mtasa.com") function getAlivePlayersInTeam(theTeam) local players = getPlayersInTeam(theTeam) for i,v in pairs(players) do if getElementHealth(v) >= 1 then end end return players end With that function you can do getAlivePlayersInTeam(myteam) and it should return a table with the alive players in the desired team. clearly needs some fixes, also imo tis better to use built in functions if aviable. local myteam = createTeam("mtasa.com") function getAlivePlayersInTeam(theTeam) local table = { } local players = getPlayersInTeam(theTeam) for i,v in pairs(players) do if not isPedDead(v) then table[#table+1]=v end end return table 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