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

Function

isValidPedModel

Server and clientPedsTrilogy Hub only

Checks whether a model number is a real ped model that can be used in createPed, setElementModel or spawnPlayer. It accepts the game's models (0-311 except empty numbers) and new peds added with engineRequestModel. Call it before applying a skin a player typed into a command.

Syntax

bool isValidPedModel(int model)

Arguments

modelint
The model number to check.

Returns

true when it is a valid ped model, otherwise false.

Example

addCommandHandler("skin", function(player, _, id)
    id = tonumber(id)
    if not id or not isValidPedModel(id) then
        outputChatBox("Nie ma takiego skina.", player, 255, 80, 80)
        return
    end
    setElementModel(player, id)
end)

See also