GetPlayerClothes: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Changed "DeprecatedWithAlt" template to "Deprecated")
 
(7 intermediate revisions by 7 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Deprecated|getPedClothes|}}
This function is used to get the current clothes texture and model of a certain type on a [[player]].
This function is used to get the current clothes texture and model of a certain type on a [[player]].


Line 8: Line 11:


===Required Arguments===
===Required Arguments===
*'''thePlayer''': The [[player]] whose clothes you want to retrieve.
*'''thePlayer:''' The [[player]] whose clothes you want to retrieve.
*'''clothesType''': The type/slot of clothing you want to get.
*'''clothesType:''' The type/slot of clothing you want to get.
{{Clothes Textures}}


==Returns==
===Returns===
This function returns 2 strings, the clothes texture and model, the first var will be filled with 'false' if this player's clothes type is empty.
This function returns 2 ''strings'', the clothes texture and model. The first return value will be ''false'' if this player's clothes type is empty or an invalid player was specified.


==Example==
==Example==
This example prints the model and texture of the current clothing on a player's torso.
This example prints the model and texture of the current clothing on the player who calls the 'clothes' command. For example: 'clothes 3' for the shoes.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler ( "clothes?", "getClothes" )
function getClothes ( source, key, clothesType )
function getClothes ( source, key, clothesType )
  texture, model = getPlayerClothes ( source, clothesType )
    local 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(source) .. " is wearing " .. texture .. " " .. model ..
  end
                        " on his " .. getClothesTypeName(clothesType), source )
    else
        outputChatBox ( "Invalid input.", source )
    end
end
end
addCommandHandler ( "clothes", getClothes )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Player functions}}
{{Player functions}}

Latest revision as of 16:17, 13 February 2015

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use getPedClothes instead.


This function is used to get the current clothes texture and model of a certain type on a player.

Syntax

string string getPlayerClothes ( player thePlayer, int clothesType )

Required Arguments

  • thePlayer: The player whose clothes you want to retrieve.
  • clothesType: The type/slot of clothing you want to get.
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 2 strings, the clothes texture and model. The first return value will be false if this player's clothes type is empty or an invalid player was specified.

Example

This example prints the model and texture of the current clothing on the player who calls the 'clothes' command. For example: 'clothes 3' for the shoes.

function getClothes ( source, key, clothesType )
    local texture, model = getPlayerClothes ( source, clothesType )
    if ( texture and model ) then
        outputChatBox ( getClientName(source) .. " is wearing " .. texture .. " " .. model ..
                        " on his " .. getClothesTypeName(clothesType), source )
    else
        outputChatBox ( "Invalid input.", source )
    end
end
addCommandHandler ( "clothes", getClothes )

See Also