From the reference libraryRedM

autodoc_g_client_functions

jo_libs/modules/component/autodoc/autodoc_g_client_functions.md

autodoc_g_client_functions

JO Functions > jo.component.apply()

A function to apply a component on the ped <br>

JO Functions > jo.component.apply() > Syntax

jo.component.apply(ped, category, _data)

JO Functions > jo.component.apply() > Parameters

ped : integer

The entity ID

category : string|integer

The component category

_data : table

The component data

_data.hash : integer - The component hash

_data.palette : string|integer - The color palette of the component <BadgeOptional />

_data.tint0 : integer - The first color number <BadgeOptional />

_data.tint1 : integer - The second color number <BadgeOptional />

_data.tint2 : integer - The third color number <BadgeOptional />

_data.drawable : integer - The drawable value <BadgeOptional />

_data.albedo : integer - The albedo value <BadgeOptional />

_data.normal : integer - The normal value <BadgeOptional />

_data.material : integer - The material value <BadgeOptional />

JO Functions > jo.component.apply() > Example

local ped = PlayerPedId()
local category = "hats"
local data = { hash = "CLOTHING_ITEM_F_HAT_241_PANTHER_VAR_001" }
jo.component.apply(ped, category, data)


JO Functions > jo.component.applyComponents()

A function to apply multiple components to a ped <br>

JO Functions > jo.component.applyComponents() > Syntax

jo.component.applyComponents(ped, components)

JO Functions > jo.component.applyComponents() > Parameters

ped : integer

The entity ID

components : table

Table of components indexed by category name with component data

JO Functions > jo.component.applyComponents() > Example

local ped = PlayerPedId()
local clothes = {
  hats = { hash = "CLOTHING_ITEM_F_HAT_241_PANTHER_VAR_001" },
  pants = { hash = 0x1234567 }
}
jo.component.applyComponents(ped, clothes)


JO Functions > jo.component.applySkin()

A function to apply a complete skin configuration to a ped <br>

JO Functions > jo.component.applySkin() > Syntax

jo.component.applySkin(ped, skin)

JO Functions > jo.component.applySkin() > Parameters

ped : integer

The entity ID

skin : table

The skin configuration data

skin.model : string - The model name <BadgeOptional />

skin.headHash : integer - The head component hash <BadgeOptional />

skin.headIndex : integer - The head index for skin tone <BadgeOptional />

skin.skinTone : integer - The skin tone value <BadgeOptional />

skin.bodyUpperHash : integer - The upper body component hash <BadgeOptional />

skin.bodyLowerHash : integer - The lower body component hash <BadgeOptional />

skin.bodiesIndex : integer - The body index for skin tone <BadgeOptional />

skin.bodyType : integer - The body type outfit preset <BadgeOptional />

skin.bodyWeight : integer - The body weight outfit preset <BadgeOptional />

skin.expressions : table - Table of expression values <BadgeOptional />

skin.eyesHash : integer - The eyes component hash <BadgeOptional />

skin.eyesIndex : integer - The eyes index <BadgeOptional />

skin.teethHash : integer - The teeth component hash <BadgeOptional />

skin.teethIndex : integer - The teeth index <BadgeOptional />

skin.hair : table - Hair component data <BadgeOptional />

skin.beards_complete : table - Beard component data <BadgeOptional />

skin.overlays : table - Table of overlay configurations <BadgeOptional />

skin.bodyScale : number - The body scale value <BadgeOptional />

JO Functions > jo.component.applySkin() > Example

local ped = PlayerPedId()
local skin = {
  model = "mp_male",
  headIndex = 1,
  skinTone = 1,
  bodiesIndex = 1,
}
jo.component.applySkin(ped, skin)


JO Functions > jo.component.bootsAreUnderPant()

A function to know if the boots are under the pant <br>

JO Functions > jo.component.bootsAreUnderPant() > Syntax

jo.component.bootsAreUnderPant(ped)

JO Functions > jo.component.bootsAreUnderPant() > Parameters

ped : integer

The entity ID

JO Functions > jo.component.bootsAreUnderPant() > Return Value

Type : boolean

Return true if boots are under the pant, false otherwise.

JO Functions > jo.component.bootsAreUnderPant() > Example

local ped = PlayerPedId()
local isUnder = jo.component.bootsAreUnderPant(ped)
print(isUnder)


JO Functions > jo.component.collarClose() > Syntax

jo.component.collarClose(ped, data)

JO Functions > jo.component.collarClose() > Parameters

ped : integer

The entity ID

data : table

The component data, see the structure in jo.component.apply()

JO Functions > jo.component.collarClose() > Example

local ped = PlayerPedId()
local data = { hash = "CLOTHING_ITEM_M_SHIRT_209_TINT_005" }
jo.component.collarClose(ped, data)


JO Functions > jo.component.collarIsOpened() > Syntax

jo.component.collarIsOpened(ped)

JO Functions > jo.component.collarIsOpened() > Parameters

ped : integer

The entity ID

JO Functions > jo.component.collarIsOpened() > Return Value

Type : boolean

Return true if the collar is opened, false otherwise.

JO Functions > jo.component.collarIsOpened() > Example

local ped = PlayerPedId()
local isOpened = jo.component.collarIsOpened(ped)
print(isOpened)


JO Functions > jo.component.collarOpen() > Syntax

jo.component.collarOpen(ped, data)

JO Functions > jo.component.collarOpen() > Parameters

ped : integer

The entity ID

data : table

The component data, see the structure in jo.component.apply()

JO Functions > jo.component.collarOpen() > Example

local ped = PlayerPedId()
local data = { hash = "CLOTHING_ITEM_M_SHIRT_209_TINT_005" }
jo.component.collarOpen(ped, data)


JO Functions > jo.component.getBaseLayer()

A function to get the base layer of a component <br>

JO Functions > jo.component.getBaseLayer() > Syntax

jo.component.getBaseLayer(ped, hash, inTable)

JO Functions > jo.component.getBaseLayer() > Parameters

ped : integer

The entity ID or the metaped type

hash : string|integer

The component hash

inTable : boolean <BadgeOptional />

true to get the result as a table, false to get the result as separate values<br> Default: false

JO Functions > jo.component.getBaseLayer() > Return Value

Type : table|integer,integer,integer,integer,integer,integer,integer,integer

When inTable is true: returns a table with {drawable, albedo, normal, material, palette, tint0, tint1, tint2} <br> When inTable is false: 1st: drawable <br> 2nd: albedo <br> 3rd: normal <br> 4th: material <br> 5th: palette <br> 6th: tint0 <br> 7th: tint1 <br> 8th: tint2

JO Functions > jo.component.getBaseLayer() > Example

local ped = PlayerPedId()
local componentHash = -1108325521
local baseLayer = jo.component.getBaseLayer(ped, componentHash, true)
log(baseLayer)
--expected output: {drawable = -2020229219, albedo = -1921859074, normal = 1163305928, material = 1671174462, palette = 1090645383, tint0 = 44, tint1 =  44, tint2 = 44}
local drawable, albedo, normal, mterial, palette, tint0, tint1, tint2 = jo.component.getBaseLayer(ped, componentHash, false)
print(drawable, albedo, normal, mterial, palette, tint0, tint1, tint2)
--expected output: -2020229219 -1921859074 1163305928 1671174462 1090645383 44 44 44

JO Functions > jo.component.getCategoriesEquiped()

<br> <br> <br> <br> Return the list of component categories equiped on the ped <br>

JO Functions > jo.component.getCategoriesEquiped() > Syntax

jo.component.getCategoriesEquiped(ped)

JO Functions > jo.component.getCategoriesEquiped() > Parameters

ped : integer

The entity ID

JO Functions > jo.component.getCategoriesEquiped() > Return Value

Type : table

Return an table with the category in key and data in value <br> categories[x].index : integer - the index of the component on the ped <br> categories[x].category : string - the category name if the hash is known

JO Functions > jo.component.getCategoriesEquiped() > Example

local ped = PlayerPedId()
local categories = jo.component.getCategoriesEquiped(ped)
log(categories)
-- Expected output: categories = { 539411565 = {index = 1, category = "shirts_full"}, 491541130 = { index = 2, category = "pants"} }


JO Functions > jo.component.getCategoryNameFromHash()

A function to get the category name from a hash value <br>

JO Functions > jo.component.getCategoryNameFromHash() > Syntax

jo.component.getCategoryNameFromHash(category)

JO Functions > jo.component.getCategoryNameFromHash() > Parameters

category : integer|string

The category hash

JO Functions > jo.component.getCategoryNameFromHash() > Return Value

Type : string

The category name, or "unknown" if not found

JO Functions > jo.component.getCategoryNameFromHash() > Example

local hash = 0x9925C067
local category = jo.component.getCategoryNameFromHash(hash)
print(category)
-- Expected output: `hats`


JO Functions > jo.component.getCategoryTint()

A function to get the tints of a category <br>

JO Functions > jo.component.getCategoryTint() > Syntax

jo.component.getCategoryTint(ped, category, inTable)

JO Functions > jo.component.getCategoryTint() > Parameters

ped : integer

The entity ID

category : string|integer

The category of the component

inTable : boolean

When inTable is true, returns a table with {palette, tint0, tint1, tint2} <br> When inTable is false, returns four separate values: palette, tint0, tint1, tint2

JO Functions > jo.component.getCategoryTint() > Return Value

Type : table|integer,integer,integer,integer

When inTable is true: returns a table with {palette, tint0, tint1, tint2} <br> When inTable is false: 1st: color palette <br> 2nd: tint number 0 <br> 3rd: tint number 1 <br> 4th: tint number 2

JO Functions > jo.component.getCategoryTint() > Example

local ped = PlayerPedId()
local category = "shirts_full"
local palette, tint0, tint1, tint2 = jo.component.getCategoryTint(ped, category)
print(palette, tint0, tint1, tint2)


JO Functions > jo.component.getComponentCategory()

Return the category hash of a component and if it's a MP component <br>

JO Functions > jo.component.getComponentCategory() > Syntax

jo.component.getComponentCategory(ped, hash)

JO Functions > jo.component.getComponentCategory() > Parameters

ped : integer

The entity ID

hash : integer

The component hash

JO Functions > jo.component.getComponentCategory() > Return Value

Type : integer,boolean

1st: Return hash value of the category <br> 2nd: Return true if it's a MP component, false otherwise

JO Functions > jo.component.getComponentCategory() > Example

local ped = PlayerPedId()
local hash = "CLOTHING_ITEM_F_HAT_241_PANTHER_VAR_001"
local catHash, isMp = jo.component.getComponentCategory(ped, hash)
print(catHash, isMp)
-- Expected output: -1725579161, true


JO Functions > jo.component.getComponentEquiped()

A function to get the hash of the component equiped in a category <br>

JO Functions > jo.component.getComponentEquiped() > Syntax

jo.component.getComponentEquiped(ped, category)

JO Functions > jo.component.getComponentEquiped() > Parameters

ped : integer

The entity ID

category : string|integer

The category to get the component

JO Functions > jo.component.getComponentEquiped() > Return Value

Type : table

Return the component datas

JO Functions > jo.component.getComponentEquiped() > Example

local ped = PlayerPedId()
local category = "hats"
local component = jo.component.getComponentEquiped(ped, category)
print(component)


JO Functions > jo.component.getComponentsEquiped()

A function to get all components equiped <br>

JO Functions > jo.component.getComponentsEquiped() > Syntax

jo.component.getComponentsEquiped(ped)

JO Functions > jo.component.getComponentsEquiped() > Parameters

ped : integer

The entity ID

JO Functions > jo.component.getComponentsEquiped() > Return Value

Type : table

Return the list of components equiped

JO Functions > jo.component.getComponentsEquiped() > Example

local ped = PlayerPedId()
local components = jo.component.getComponentsEquiped(ped)
log(components)


JO Functions > jo.component.getPaletteNameFromHash()

<br> <br> <br> <br> A function to get the palette name from a hash value <br>

JO Functions > jo.component.getPaletteNameFromHash() > Syntax

jo.component.getPaletteNameFromHash(hash)

JO Functions > jo.component.getPaletteNameFromHash() > Parameters

hash : integer

The palette hash

JO Functions > jo.component.getPaletteNameFromHash() > Return Value

Type : string

The palette name, or "unknown" if not found

JO Functions > jo.component.getPaletteNameFromHash() > Example

local paletteHash = 0xAA65D8A3
local palette = jo.component.getPaletteNameFromHash(paletteHash)
print(palette)
-- Expected output: `metaped_tint_generic`


JO Functions > jo.component.getWearableState()

Get the wearable state of a category <br>

JO Functions > jo.component.getWearableState() > Syntax

jo.component.getWearableState(ped, category)

JO Functions > jo.component.getWearableState() > Parameters

ped : integer

The entity ID

category : string|integer

The category name

JO Functions > jo.component.getWearableState() > Return Value

Type : integer

Return the wearable state hash of the category

JO Functions > jo.component.getWearableState() > Example

local ped = PlayerPedId()
local category = "neckwear"
local wearableState = jo.component.getWearableState(ped, category)
print(wearableState)


JO Functions > jo.component.getWearableStateNameFromHash() > Syntax

jo.component.getWearableStateNameFromHash(state)

JO Functions > jo.component.getWearableStateNameFromHash() > Example

local hash = -1539589426
local stateName = jo.component.getWearableStateNameFromHash(hash)
print(stateName)
-- Expected output: `closed_collar_rolled_sleeve`

JO Functions > jo.component.hairIsPomade()

A function to know if the hair is pomaded <br>

JO Functions > jo.component.hairIsPomade() > Syntax

jo.component.hairIsPomade(ped)

JO Functions > jo.component.hairIsPomade() > Parameters

ped : integer

The entity ID

JO Functions > jo.component.hairIsPomade() > Return Value

Type : boolean

Return true if the hair is pomaded

JO Functions > jo.component.hairIsPomade() > Example

local ped = PlayerPedId()
local isPomaded = jo.component.hairIsPomade(ped)
print(isPomaded)


JO Functions > jo.component.isCategoryEquiped()

A function to know if a specific category is equiped on the ped <br>

JO Functions > jo.component.isCategoryEquiped() > Syntax

jo.component.isCategoryEquiped(ped, category)

JO Functions > jo.component.isCategoryEquiped() > Parameters

ped : integer

The entity ID

category : string|integer

The category name

JO Functions > jo.component.isCategoryEquiped() > Return Value

Type : integer

Return the index of the category

JO Functions > jo.component.isCategoryEquiped() > Example

local ped = PlayerPedId()
local category = "pants"
local isEquiped, index = jo.component.isCategoryEquiped(ped, category)
print(isEquiped, index)


JO Functions > jo.component.isMpComponent()

A function to check if a component is an MP component (multiplayer component) <br>

JO Functions > jo.component.isMpComponent() > Syntax

jo.component.isMpComponent(ped, hash)

JO Functions > jo.component.isMpComponent() > Parameters

ped : integer

The entity ID OR the metapedType

hash : integer

The component hash

JO Functions > jo.component.isMpComponent() > Return Value

Type : boolean

Return true if it's an MP component, false otherwise

JO Functions > jo.component.isMpComponent() > Example

local ped = PlayerPedId()
local hash = 0x123456
local isMP = jo.component.isMpComponent(ped, hash)
print(isMP)


JO Functions > jo.component.loadoutIsOnRight()

A function to know if the loadout is on the right <br>

JO Functions > jo.component.loadoutIsOnRight() > Syntax

jo.component.loadoutIsOnRight(ped)

JO Functions > jo.component.loadoutIsOnRight() > Parameters

ped : integer

The entity ID

JO Functions > jo.component.loadoutIsOnRight() > Return Value

Type : boolean

Return true if the loadout in on the right, false otherwise

JO Functions > jo.component.loadoutIsOnRight() > Example

local ped = PlayerPedId()
local isRight = jo.component.loadoutIsOnRight(ped)
print(isRight)


JO Functions > jo.component.neckwearIsUp()

Return if the neckwear is on the face of the player or not <br>

JO Functions > jo.component.neckwearIsUp() > Syntax

jo.component.neckwearIsUp(ped)

JO Functions > jo.component.neckwearIsUp() > Parameters

ped : integer

The entity ID

JO Functions > jo.component.neckwearIsUp() > Return Value

Type : boolean

Return true if the neckwear is on the face, false otherwise.

JO Functions > jo.component.neckwearIsUp() > Example

local ped = PlayerPedId()
local isUp = jo.component.neckwearIsUp(ped)
print(isUp)


JO Functions > jo.component.refreshPed()

<br> <br> <br> <br> A function to refresh the ped components <br>

JO Functions > jo.component.refreshPed() > Syntax

jo.component.refreshPed(ped)

JO Functions > jo.component.refreshPed() > Parameters

ped : integer

The entity ID

JO Functions > jo.component.refreshPed() > Example

local ped = PlayerPedId()
jo.component.refreshPed(ped)


JO Functions > jo.component.remove()

A function to remove a component component <br>

JO Functions > jo.component.remove() > Syntax

jo.component.remove(ped, category)

JO Functions > jo.component.remove() > Parameters

ped : integer

The entity ID

category : integer|string

The category of component to remove

JO Functions > jo.component.remove() > Example

local ped = PlayerPedId()
local category = "hats"
jo.component.remove(ped, category)


JO Functions > jo.component.removeAllClothes()

A function to remove all clothing components from a ped <br>

JO Functions > jo.component.removeAllClothes() > Syntax

jo.component.removeAllClothes(ped)

JO Functions > jo.component.removeAllClothes() > Parameters

ped : integer

The entity ID

JO Functions > jo.component.removeAllClothes() > Example

local ped = PlayerPedId()
jo.component.removeAllClothes(ped)


JO Functions > jo.component.setWearableState()

<br> <br> <br> <br> A function to edit the wearable state of a category <br>

JO Functions > jo.component.setWearableState() > Syntax

jo.component.setWearableState(ped, category, data, state)

JO Functions > jo.component.setWearableState() > Parameters

ped : integer

The entity ID

category : integer|string

The category of the component

data : table

The component data, see the structure in jo.component.apply()

state : integer|string

The wearable state to apply on the component <br> The list of wearable state can be find in the jo_libs>module>component>client.lua file line 76

JO Functions > jo.component.setWearableState() > Example

local ped = PlayerPedId()
local category = "neckwear"
local data = { hash = "CLOTHING_ITEM_F_NECKERCHIEF_000_TINT_001" }
local state = jo.component.wearableStates.neckwear[1] --neckwear UP
jo.component.setWearableState(ped, category, data, state)


JO Functions > jo.component.sleeveIsRolled() > Syntax

jo.component.sleeveIsRolled(ped)

JO Functions > jo.component.sleeveIsRolled() > Parameters

ped : integer

The entity ID

JO Functions > jo.component.sleeveIsRolled() > Return Value

Type : boolean

Return true if the sleeve are rolled, false otherwise.

JO Functions > jo.component.sleeveIsRolled() > Example

local ped = PlayerPedId()
local isRolled = jo.component.sleeveIsRolled(ped)
print(isRolled)


JO Functions > jo.component.sleeveRoll() > Syntax

jo.component.sleeveRoll(ped, data)

JO Functions > jo.component.sleeveRoll() > Parameters

ped : integer

The entity ID

data : table

The component data, see the structure in jo.component.apply()

JO Functions > jo.component.sleeveRoll() > Example

local ped = PlayerPedId()
local data = { hash = "CLOTHING_ITEM_M_SHIRT_209_TINT_005" }
jo.component.sleeveRoll(ped, data)


JO Functions > jo.component.sleeveUnroll() > Syntax

jo.component.sleeveUnroll(ped, hash)

JO Functions > jo.component.sleeveUnroll() > Parameters

ped : integer

The entity ID

data : table

The component data, see the structure in jo.component.apply()

JO Functions > jo.component.sleeveUnroll() > Example

local ped = PlayerPedId()
local data = { hash = "CLOTHING_ITEM_M_SHIRT_209_TINT_005" }
jo.component.sleeveUnroll(ped, data)


JO Functions > jo.component.vestIsUnderPant()

A function to know if the vest is under the pant <br>

JO Functions > jo.component.vestIsUnderPant() > Syntax

jo.component.vestIsUnderPant(ped)

JO Functions > jo.component.vestIsUnderPant() > Parameters

ped : integer

The entity ID

JO Functions > jo.component.vestIsUnderPant() > Return Value

Type : boolean

Return true if the vest is in the pant, false otherwise

JO Functions > jo.component.vestIsUnderPant() > Example

local ped = PlayerPedId()
local isIn = jo.component.vestIsUnderPant(ped)
print(isIn)


JO Functions > jo.component.waitPedLoaded()

A function to wait the refresh of ped <br>

JO Functions > jo.component.waitPedLoaded() > Syntax

jo.component.waitPedLoaded(ped)

JO Functions > jo.component.waitPedLoaded() > Parameters

ped : integer

The entity ID

JO Functions > jo.component.waitPedLoaded() > Example

local ped = PlayerPedId()
local isIn = jo.component.waitPedLoaded(ped)

JO Functions > jo.component.getCategoriesEquiped()

Return the list of component categories equiped on the ped <br>

JO Functions > jo.component.getPaletteNameFromHash()

A function to get the palette name from a hash value <br>

JO Functions > jo.component.refreshPed()

A function to refresh the ped components <br>

JO Functions > jo.component.setWearableState()

A function to edit the wearable state of a category <br>

Back to documentation