GetClothesTypeName: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 14: Line 14:


==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 ( "clothes?", "getClothes" )
function getClothes ( thePlayer, key, clothesType )
function getClothes ( source, key, clothesType )
   local texture, model = getPlayerClothes ( source, clothesType )
   texture, model = getPlayerClothes ( source, clothesType )
   if ( texture and model ) then
   if ( texture and model ) then
     outputChatBox ( getClientName ( source ) .. " is wearing " .. texture .. " " .. model .. " on his " .. getClothesTypeName ( clothesType ) )
     outputChatBox ( getClientName ( thePlayer ) .. " is wearing " .. texture .. " " .. model .. " on his " .. getClothesTypeName ( clothesType ) )
   end
   end
end
end
addCommandHandler ( "clothes?", getClothes )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Clothes and body functions}}
{{Clothes and body functions}}

Revision as of 15:42, 13 August 2007

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 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 = getPlayerClothes ( source, clothesType )
  if ( texture and model ) then
    outputChatBox ( getClientName ( thePlayer ) .. " is wearing " .. texture .. " " .. model .. " on his " .. getClothesTypeName ( clothesType ) )
  end
end
addCommandHandler ( "clothes?", getClothes )

See Also