M MY Multiplayer: Wiki
Side
Kind

setElementModel

Server

Changes the model of a ped or player, and of its children.

bool setElementModel(element element, string model)

Parameters

NameTypeDescription
elementelementThe ped or player.
modelstringThe ped model's name.

Returns

true if the element's own model changed, false if the model is the same, is not a ped model, the element is not a ped or player, or a handler cancelled the change.

Fires onElementModelChange with the old and the new model. Cancelling the event goes back to the old model.

Example

addCommandHandler("skin", function(player, command, model)
    if model and not setElementModel(player, model) then
        outputDebugString("unknown ped model: " .. model)
    end
end)

See also