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 
  

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

Posted

You should pass the team name as an argument !

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

Posted

give me an example please i dont know how would code look like with the argument in function

If you find my post useful or if it helped you, please like my post :)
Ingame name: ZoeN

560x95_FFFFFF_FF9900_000000_000000.png

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

560x95_FFFFFF_FF9900_000000_000000.png

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)

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

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

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

Posted

I think team userdata not ?

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

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

I dont edit anything i swear

#include <iostream>

int main() {

    std::cout << "C++ is amazing <3" << std::endl;

    return 0;

}

I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please

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...