- Documentation
- Shared functions
- isValidPedModel
Function
isValidPedModel
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
getValidPedModelsReturns a list of every valid ped model number, i.e. the skins you can pass tocreatePed,setElementModelorspawnPlayer. Numbers with no ped behind them in the game are left out. By default it also includes new ped models added by script withengineRequestModel. Useful for picking a random skin or building a character selection menu.createPedCreates a new NPC ped on the server (a pedestrian driven by the game, not by a player) and shows it right away to every player nearby. The ped gets 100 health, a random appearance variant (clothes and skin tone, seesetPedVariant) and belongs to the resource that created it, so it disappears together with that resource onstop. Optionally it can be made aggressive straight away or told to attack a chosen target.