kikos500 Posted June 7, 2016 Posted June 7, 2016 well i want to change a name of a specified team without A player in it ex /changename oldteamname/or/id newname setTeamName uses player teams is there a function for some use like this?
Castillo Posted June 7, 2016 Posted June 7, 2016 https://wiki.multitheftauto.com/wiki/GetTeamFromName You can use that function to get a team from it's name.
kikos500 Posted June 7, 2016 Author Posted June 7, 2016 Thank You it worked I have Another question can i set a player automatically in a team if a part of the team name matches his name
Castillo Posted June 7, 2016 Posted June 7, 2016 You can use this function: function getTeamFromPartOfName ( teamName ) if ( teamName and type ( teamName ) == "string" ) then local teamsFound = { } local teamFound = getTeamFromName ( teamName ) if ( teamFound ) then return teamFound end for _, team in ipairs ( getElementsByType ( "team" ) ) do if ( getTeamName ( team ):lower ( ):find ( teamName:lower ( ), 1, true ) ) then table.insert ( teamsFound, team ) end end if ( #teamsFound == 1 ) then return teamsFound [ 1 ] end end return false end
kikos500 Posted June 7, 2016 Author Posted June 7, 2016 hmm should i just add it to the script or there is some kind of syntax
Castillo Posted June 7, 2016 Posted June 7, 2016 Add the function to the end of your script and then use getTeamFromPartOfName instead of getTeamFromName.
kikos500 Posted June 7, 2016 Author Posted June 7, 2016 I want it to work like an autoteam when the player joins and any part of the name matches the tag he gets placed in
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