Ped Texture Client
A powerfull module to manage the ped texture like makeup/tatoo/...
WARNING
Textures can only be apply on networked ped. If you want use it in a script with ped only visible by one player, like character selector, you have to move the player in solo routing bucket and spawn the ped as networked.
JO Variables
jo.pedTexture.categories
An object to know the on each part of the ped the layername has to be apply
Syntax
jo.pedTexture.categories[layername]
Parameters
layername
: string
The layer name of the texture
Example
local part = jo.pedTexture.categories.eyeshadow
print(part)
-- Expected output: heads
jo.pedTexture.variations
A variable with the list of existing texture for peds. The key is the layername and value the list of variations
Syntax
jo.pedTexture.variations[layername] = variations
Parameters
layername
: string
The layername of the texture
variations
: table
the list of variations
variations[x].label
: string - the label of the variationsvariations[x].value
: table - the definition of the variations
Example
local listEyeshadow = jo.pedTexture.variations.eyeshadow
for _, variation in pairs(listEyeshadow) do
print(variable.label)
print(json.encode(variation.value))
end
JO Functions
jo.pedTexture.apply()
A function to apply texture on a specific ped
Syntax
jo.pedTexture.apply(ped, layerName, _data)
Parameters
ped
: integer
The entity ID
layerName
: string
The layername of the texture
_data
: table
The data of the texture
_data.id
: integer - The ID of the texture
OR
_data.albedo
: string - The albedo of the texture
_data.sheetGrid
: integer - The sheet grid of the texture
default: 0 Optional
_data.opacity
: number - The opacity of the texture
default: 1.0 Optional
_data.blendType
: integer - The blend type of the texture
default: 1 Optional
_data.palette
: string|integer - The palette of the colors
default: "metaped_tint_makeup" Optional
_data.tint0
: string|integer - The first color Optional
_data.tint1
: string|integer - The second color Optional
_data.tint2
: string|integer - The third color Optional
Example
local ped = PlayerPedId()
local layername = "eyeshadow"
local data = jo.pedTexture.variations.eyeshadow[3].value
data.palette = "metaped_tint_makeup"
data.tint0 = 5
data.tint1 = 10
data.tint2 = 40
jo.pedTexture.apply(ped, layername, data)
jo.pedTexture.getAll()
Return the list of layers in all categories
Syntax
jo.pedTexture.getAll(ped)
Parameters
ped
: integer
The entity ID
Return Value
Type : object
Return the list of layer apply on the ped
Example
local ped = PlayerPedId()
local textures = jo.pedTexture.getAll(ped)
print(json.encode(textures))
-- Expected output: {heads = {eyeshdow = {...}, foundation = {...}}}
jo.pedTexture.getOverlayAssetFromId()
A function to get the hashname of a texture
Syntax
jo.pedTexture.getOverlayAssetFromId(isMale, category, data)
Parameters
isMale
: boolean
true
if the texture is for a male,false
otherwise
category
: string
The layername of the texture
data
: table
The texture data
⚠️ Can be either anumber
representing the texture ID or atable
with detailed configuration
data.albedo
: string - The albedo of the texture
data.sexe
: string - The sex of the texture, used for eyebrow category
default: based on isMale Optional
Return Value
Type : string
Return the hashname of the texture for this ID
Example
local isMale = true
local layername = "eyebrow"
local id = 5
local texture = jo.pedTexture.getOverlayAssetFromId(isMale, layername, id)
print(texture)
-- Expected output: mp_u_faov_eyebrow_005
jo.pedTexture.overwriteBodyPart()
A function to overwrite all the layers of a body part
Syntax
jo.pedTexture.overwriteBodyPart(ped, category, overlays, forceRemove)
Parameters
ped
: integer
The entity ID
category
: string
The category of the texture
overlays
: object
The list of layers
forceRemove
: boolean Optional
Whether to force remove existing textures even if the category doesn't exist
default: false
Example
local ped = PlayerPedId()
local category = "heads"
local overlays = {
eyeshadow = { sheetGrid = 3, tint0 = 1, tint1 = 45, tint2 = 56 },
foundation = { id = 0, palette = "metaped_tint_makeup", tint0 = 78 }
}
jo.pedTexture.overwriteBodyPart(ped, category, overlays)
jo.pedTexture.refreshAll()
A function to refresh the ped texture
Syntax
jo.pedTexture.refreshAll(ped)
Parameters
ped
: integer
The entity ID
Example
local ped = PlayerPedId()
jo.pedTexture.refreshAll(ped)
jo.pedTexture.refreshNow()
A function to apply now the ped texture modification
Syntax
jo.pedTexture.refreshNow(ped)
Example
local ped = PlayerPedId()
jo.pedTexture.refreshNow(ped)
jo.pedTexture.remove()
A function to remove a texture
Syntax
jo.pedTexture.remove(ped, layerName)
Parameters
ped
: integer
The entity ID
layerName
: string
The layer name of the texture
Example
local ped = PlayerPedId()
local layername = "eyeshadow"
jo.pedTexture.remove(ped, layername)