GetClothesTypeName: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 17: Line 17:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler ( "previousClothes", "previousClothes" )
addCommandHandler ( "previousClothes", "previousClothes" )
function nextClothes ( thePlayer, key, clothesType )
function previousClothes ( thePlayer, key, clothesType )
   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 -- the index we're going to get our new clothes from
   if ( currentTexture ) then -- if he had clothes of that type
   if ( currentTexture ) then -- if he had clothes of that type, set the index there
     clothesType, clothesIndex = getTypeIndexFromClothes ( currentTexture, currentModel ) -- get the type and index of these clothes, so we can decrease and get the previous
     clothesType, clothesIndex = getTypeIndexFromClothes ( currentTexture, currentModel ) -- get the type and index of these clothes, so we can decrease and get the previous
   end
   end
   clothesIndex = clothesIndex - 1
   clothesIndex = clothesIndex - 1 -- decrease the index to get the previous clothes
   texture, model = getClothesByTypeIndex ( type, index ) -- get the new texture and model
   texture, model = getClothesByTypeIndex ( type, index ) -- get the new texture and model
   setPlayerClothes ( thePlayer, texture, model, type )
   setPlayerClothes ( thePlayer, texture, model, type )

Revision as of 17:38, 25 July 2006

This function is used to get the name of a certain clothes type.

Syntax

string getClothesTypeName ( int clothesType )

Required Arguments

  • clothesType: An interger determining the type of clothes you want to get the clothes of.

Returns

This function returns a string (the name of the clothes type) if found, 'false' otherwise.

Example

This example gets the current clothes of a certain type on a player, then swaps with the previous in the clothes list.

addCommandHandler ( "previousClothes", "previousClothes" )
function previousClothes ( thePlayer, key, clothesType )
  currentTexture, currentModel = getPlayerClothes ( thePlayer, clothesType ) -- get the current clothes on this slot
  clothesIndex = 1 -- the index we're going to get our new clothes from
  if ( currentTexture ) then -- if he had clothes of that type, set the index there
    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 -- decrease the index to get the previous clothes
  texture, model = getClothesByTypeIndex ( type, index ) -- get the new texture and model
  setPlayerClothes ( thePlayer, texture, model, type )
end

See Also