GetTypeIndexFromClothes: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
{{Needs_Checking|Required argument catalogues not present (notice red links)}} | {{Needs_Checking|Required argument catalogues not present (notice red links)}} | ||
{{Server client function}} | |||
__NOTOC__ | __NOTOC__ | ||
This function is used to get the clothes type and index from the texture and model. | This function is used to get the clothes type and index from the texture and model. | ||
Line 18: | Line 18: | ||
==Example== | ==Example== | ||
<section name="Server" class="server" show="true"> | |||
This example gets the current clothes of a certain type on a player, then swaps with the previous in the clothes list. | This example gets the current clothes of a certain type on a player, then swaps with the previous in the clothes list. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function scriptPreviousClothes ( thePlayer, key, clothesType ) | |||
function | |||
currentTexture, currentModel = getPlayerClothes ( thePlayer, clothesType ) -- get the current clothes on this slot | currentTexture, currentModel = getPlayerClothes ( thePlayer, clothesType ) -- get the current clothes on this slot | ||
clothesIndex = 1 | clothesIndex = 1 | ||
Line 31: | Line 31: | ||
setPlayerClothes ( thePlayer, texture, model, type ) | setPlayerClothes ( thePlayer, texture, model, type ) | ||
end | end | ||
addCommandHandler ( "previousClothes", scriptPreviousClothes ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Clothes and body functions}} | {{Clothes and body functions}} |
Revision as of 17:07, 10 August 2007
This article needs checking. | |
Reason(s): Required argument catalogues not present (notice red links) |
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 type).
Syntax
int int getTypeIndexFromClothes ( string clothesTexture, string clothesModel )
Required Arguments
- clothesTexture: A string determining the clothes texture that you wish to retrieve the type and index from. See clothes textures.
- clothesModel: A string determining the corresponding clothes model that you wish to retrieve the type and index from. See clothes models.
Returns
This function returns two integers, type and index respectively, false if invalid arguments were passed to the function.
Example
Click to collapse [-]
ServerThis example gets the current clothes of a certain type on a player, then swaps with the previous in the clothes list.
function scriptPreviousClothes ( thePlayer, key, clothesType ) currentTexture, currentModel = getPlayerClothes ( thePlayer, clothesType ) -- get the current clothes on this slot clothesIndex = 1 if ( currentTexture ) then -- if he had clothes of that type clothesType, clothesIndex = getTypeIndexFromClothes ( currentTexture, currentModel ) -- get the type and index of these clothes, so we can decrease and get the previous end clothesIndex = clothesIndex - 1 texture, model = getClothesByTypeIndex ( type, clothesIndex ) -- get the new texture and model setPlayerClothes ( thePlayer, texture, model, type ) end addCommandHandler ( "previousClothes", scriptPreviousClothes )
See Also
- addPedClothes
- getBodyPartName
- getClothesByTypeIndex
- getClothesTypeName
- getPedClothes
- getTypeIndexFromClothes
- removePedClothes