ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. getValidPedModels

Function

getValidPedModels

Server and clientPedsModified from MTA:SA

Returns a list of every valid ped model number, i.e. the skins you can pass to createPed, setElementModel or spawnPlayer. Numbers with no ped behind them in the game are left out. By default it also includes new ped models added by script with engineRequestModel. Useful for picking a random skin or building a character selection menu.

Syntax

table getValidPedModels([bool includeCustom = true])

Arguments

includeCustombool, optional = true
true includes new ped models from engineRequestModel; false returns only the game's own models.Not in MTA:SA

Differences from MTA:SA

  • Arguments in a different colour differ from MTA:SA.

In MTA:SA

getValidPedModels()

Returns

A table of numbers (model IDs) sorted ascending.

Example

local models = getValidPedModels(false)
addCommandHandler("losujskin", function(player)
    setElementModel(player, models[math.random(#models)])
end)

See also