Jump to content

function to remove team?


John Smith

Recommended Posts

Posted

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 
  

Posted
 function DeleteTeam () 
    local delteam = getTeamFromName("Team Name") 
    if (delteam) then 
    destroyElement(delteam) 
    else return end 
end) 

Posted

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)

Posted

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 
  

Posted

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')

Posted

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 
  

Posted

Why would you loop through all teams?

function deleteTeam(teamName) 
    if getTeamFromName(teamName) then 
        destroyElement(getTeamFromName(teamName)) 
    end 
end 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...