<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/HU/getTypeIndexFromClothes?action=history&amp;feed=atom</id>
	<title>HU/getTypeIndexFromClothes - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/HU/getTypeIndexFromClothes?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=HU/getTypeIndexFromClothes&amp;action=history"/>
	<updated>2026-05-17T08:07:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=HU/getTypeIndexFromClothes&amp;diff=59284&amp;oldid=prev</id>
		<title>Surge: Created page with &quot;{{Server client function}} __NOTOC__ This function is used to get the clothes type and index from the texture and model. (Scans through the list of clothes for the specific ty...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=HU/getTypeIndexFromClothes&amp;diff=59284&amp;oldid=prev"/>
		<updated>2018-09-22T10:49:58Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Server client function}} __NOTOC__ This function is used to get the clothes type and index from the texture and model. (Scans through the list of clothes for the specific ty...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function is used to get the clothes type and index from the texture and model.&lt;br /&gt;
(Scans through the list of clothes for the specific type).&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int int getTypeIndexFromClothes ( string clothesTexture, string clothesModel )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''clothesTexture''': A string determining the clothes texture that you wish to retrieve the type and index from. See the [[CJ Clothes|clothes catalog]].&lt;br /&gt;
*'''clothesModel''': A string determining the corresponding clothes model that you wish to retrieve the type and index from. See the [[CJ Clothes|clothes catalog]].&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
This function returns two integers, type and index respectively, ''false'' if invalid arguments were passed to the function.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example gets the current clothes of a certain type on a player, then swaps with the previous in the clothes list.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function scriptPreviousClothes ( thePlayer, key, clothesType )&lt;br /&gt;
  local currentTexture, currentModel = getPedClothes ( thePlayer, clothesType ) -- get the current clothes on this slot&lt;br /&gt;
  local clothesIndex = 1&lt;br /&gt;
  if ( currentTexture ) then -- if he had clothes of that type&lt;br /&gt;
    local tempA, tempB = getTypeIndexFromClothes ( currentTexture, currentModel ) -- get the type and index for these clothes, so we can decrease and get the previous in the list&lt;br /&gt;
    if ( tempA and tempB ) then -- if we found them&lt;br /&gt;
      clothesType, clothesIndex = tempA, tempB&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  clothesIndex = clothesIndex - 1&lt;br /&gt;
  local texture, model = getClothesByTypeIndex ( clothesType, clothesIndex ) -- get the new texture and model&lt;br /&gt;
  if ( texture == false ) then -- if we've reached the end of the list&lt;br /&gt;
    removePedClothes ( thePlayer, clothesType )&lt;br /&gt;
  else addPedClothes ( thePlayer, texture, model, clothesType )&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;previousClothes&amp;quot;, scriptPreviousClothes )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Clothes and body functions}}&lt;br /&gt;
&lt;br /&gt;
[[en:getTypeIndexFromClothes]]&lt;/div&gt;</summary>
		<author><name>Surge</name></author>
	</entry>
</feed>