<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Shortybsd</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Shortybsd"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Shortybsd"/>
	<updated>2026-05-17T09:13:58Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetPlayersInTeam&amp;diff=39202</id>
		<title>GetPlayersInTeam</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetPlayersInTeam&amp;diff=39202"/>
		<updated>2014-03-31T20:41:38Z</updated>

		<summary type="html">&lt;p&gt;Shortybsd: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function retrieves all the players of the specified team.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getPlayersInTeam ( team theTeam )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Arguments=== &lt;br /&gt;
*'''theTeam:''' The team you wish to retrieve all the players from.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[table]] of all the players in the team, or an empty one if there are none else false if invalid arguments are passed.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Find and kill all the players in the specified team (for example 'killTeam Red').&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function killTeamFunction ( thePlayer, command, teamName )&lt;br /&gt;
	-- Find and kill all the players in the team that was specified with the console command&lt;br /&gt;
	local theTeam = getTeamFromName ( teamName )&lt;br /&gt;
	if ( theTeam ) then&lt;br /&gt;
		local players = getPlayersInTeam ( theTeam )&lt;br /&gt;
		-- Loop through the player table&lt;br /&gt;
		for playerKey, playerValue in ipairs ( players ) do&lt;br /&gt;
			-- kill the player&lt;br /&gt;
			killPlayer ( playerValue )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler ( &amp;quot;killTeam&amp;quot;, killTeamFunction )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example will show all players in a team when a player types the 'showTeam TeamName' command.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function showTeamFunction ( command, teamName )&lt;br /&gt;
        -- Find and show all the players in the team that was specified with the console command&lt;br /&gt;
        local theTeam = getTeamFromName ( teamName )&lt;br /&gt;
        if ( theTeam ) then&lt;br /&gt;
                local players = getPlayersInTeam ( theTeam ) &lt;br /&gt;
                -- Loop through the player table&lt;br /&gt;
                for playerKey, playerValue in ipairs ( players ) do&lt;br /&gt;
                        outputChatBox ( getPlayerName(playerValue) )&lt;br /&gt;
                end&lt;br /&gt;
        end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler ( &amp;quot;showTeam&amp;quot;, showTeamFunction )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Team functions}}&lt;/div&gt;</summary>
		<author><name>Shortybsd</name></author>
	</entry>
</feed>