John Smith Posted October 4, 2014 Author 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
John Smith Posted October 4, 2014 Author Posted October 4, 2014 give me an example please i dont know how would code look like with the argument in function
King12 Posted October 4, 2014 Posted October 4, 2014 function DeleteTeam () local delteam = getTeamFromName("Team Name") if (delteam) then destroyElement(delteam) else return end end)
darhal Posted October 4, 2014 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)
Anubhav Posted October 4, 2014 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
darhal Posted October 4, 2014 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')
Anubhav Posted October 4, 2014 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
Gr0x Posted October 5, 2014 Posted October 5, 2014 Why would you loop through all teams? function deleteTeam(teamName) if getTeamFromName(teamName) then destroyElement(getTeamFromName(teamName)) end end
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