GetTeamFromName

From Multi Theft Auto: Wiki
Revision as of 22:01, 1 August 2007 by Sintax (talk | contribs) (→‎Example)
Jump to navigation Jump to search

This function is for finding a team object from its name.

Syntax

team getTeamFromName ( string teamName )

Required Arguments

  • teamName: A string determining the name of the team you wish to find.

Returns

Returns the team object if it was found, 'false' otherwise.

Example

This example destroys a team named "Red", if it is found.

function joinRedTeam ( source )
 	-- Try to find the team named 'Red'
	team = getTeamFromName ( "Red" )
	
	if ( team ) then -- If it was found (not false)
		addPlayerToTeam ( source, team )
	end
end

--Add console command to join the team when 'joinTeam' is typed.
addCommandHandler ( "joinTeam", joinRedTeam )

See Also