John Smith Posted October 4, 2014 Share Posted October 4, 2014 which function do i need to remove team? Link to comment
John Smith Posted October 4, 2014 Author Share Posted October 4, 2014 umm something like this? function deleteTeam() for i,team in ipairs(getElementsByType("team")) do if getTeamName(team) == "Team Name" then destroyElement(team) else return end end end Link to comment
darhal Posted October 4, 2014 Share Posted October 4, 2014 You should pass the team name as an argument ! Link to comment
John Smith Posted October 4, 2014 Author Share Posted October 4, 2014 give me an example please i dont know how would code look like with the argument in function Link to comment
King12 Posted October 4, 2014 Share Posted October 4, 2014 function DeleteTeam () local delteam = getTeamFromName("Team Name") if (delteam) then destroyElement(delteam) else return end end) Link to comment
darhal Posted October 4, 2014 Share Posted October 4, 2014 Its simple function deleteTeam(teamName) for i, team in ipairs(getElementsByType('team') do if getTeamName(team) == teamName then destroyElement(team) end end end also you can use getTeamFromName(teamName) Link to comment
Anubhav Posted October 4, 2014 Share Posted October 4, 2014 Dude it will return all team names o-O are you doing? function deleteTeam(teamName) for i, team in ipairs(getElementsByType('team') do if team == teamName then destroyElement(team) end end end Link to comment
darhal Posted October 4, 2014 Share Posted October 4, 2014 It will work whats the problem but i said he can use getTeamFromName to delte team copy my code and use it like this outside the code eg : deleteTeam('Police') Link to comment
Anubhav Posted October 4, 2014 Share Posted October 4, 2014 Do you even know what is the loop returning? Link to comment
darhal Posted October 4, 2014 Share Posted October 4, 2014 I think team userdata not ? Link to comment
Anubhav Posted October 4, 2014 Share Posted October 4, 2014 You edited the post. I was wrong, it should be like this. function deleteTeam(teamName) for i, team in ipairs(getElementsByType('team') do if team == getTeamName(teamName) then destroyElement(team) end end end Link to comment
darhal Posted October 4, 2014 Share Posted October 4, 2014 I dont edit anything i swear Link to comment
Gr0x Posted October 5, 2014 Share Posted October 5, 2014 Why would you loop through all teams? function deleteTeam(teamName) if getTeamFromName(teamName) then destroyElement(getTeamFromName(teamName)) 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