GetClothesTypeName: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(11 intermediate revisions by 10 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
This function is used to get the name of a certain clothes type.
This function is used to get the name of a certain clothes type.


Line 8: Line 9:


===Required Arguments===
===Required Arguments===
*'''clothesType''': An interger determining the type of clothes you want to get the clothes of.
*'''clothesType''': An integer determining the type of clothes you want to get the clothes of.
{{Clothes Textures}}


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


==Example==
==Example==
This example gets the current clothes of a certain type on a player, then swaps with the previous in the clothes list.
This example is used to output in the chatbox what clothes type the player who uses the 'clothes' command is wearing.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler ( "previousClothes", "previousClothes" )
function getClothes ( thePlayer, key, clothesType )
function previousClothes ( thePlayer, key, clothesType )
   local texture, model = getPedClothes ( source, clothesType )
   currentTexture, currentModel = getPlayerClothes ( thePlayer, clothesType ) -- get the current clothes on this slot
   if ( texture and model ) then
  clothesIndex = 1 -- the index we're going to get our new clothes from
     outputChatBox ( getPlayerName ( thePlayer ) .. " is wearing " .. texture .. " " .. model .. " on his " .. getClothesTypeName ( clothesType ) )
   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
   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
end
addCommandHandler ( "clothes", getClothes )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Clothes and body functions}}
{{Clothes and body functions}}
[[hu:getClothesTypeName]]
[[pl:GetClothesTypeName]]

Latest revision as of 02:51, 13 December 2019

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

Syntax

string getClothesTypeName ( int clothesType )

Required Arguments

  • clothesType: An integer determining the type of clothes you want to get the clothes of.
Clothing Types
  • 0: SHIRT
  • 1: HEAD
  • 2: TROUSERS
  • 3: SHOES
  • 4: TATTOOS_LEFT_UPPER_ARM
  • 5: TATTOOS_LEFT_LOWER_ARM
  • 6: TATTOOS_RIGHT_UPPER_ARM
  • 7: TATTOOS_RIGHT_LOWER_ARM
  • 8: TATTOOS_BACK
  • 9: TATTOOS_LEFT_CHEST
  • 10: TATTOOS_RIGHT_CHEST
  • 11: TATTOOS_STOMACH
  • 12: TATTOOS_LOWER_BACK
  • 13: NECKLACE
  • 14: WATCH
  • 15: GLASSES
  • 16: HAT
  • 17: EXTRA

Returns

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

Example

This example is used to output in the chatbox what clothes type the player who uses the 'clothes' command is wearing.

function getClothes ( thePlayer, key, clothesType )
  local texture, model = getPedClothes ( source, clothesType )
  if ( texture and model ) then
    outputChatBox ( getPlayerName ( thePlayer ) .. " is wearing " .. texture .. " " .. model .. " on his " .. getClothesTypeName ( clothesType ) )
  end
end
addCommandHandler ( "clothes", getClothes )

See Also