Garry's Mod Wiki

DModelPanel:SetModel

  DModelPanel:SetModel( string model )

Description

Sets the model of the rendered entity.

This function may give a different model than expected. This is not a bug, however this problem may appear with some player models which are renamed several times in a wrong way. To solve that, you can use Entity:SetModel and Entity:SetModelName on the internal panel entity. More information : https://github.com/Facepunch/garrysmod-issues/issues/4534.

Arguments

1 string model
The model to apply to the entity.

Example

Creates a new DModelPanel with the Kleiner playermodel.

local modelPanel = vgui.Create( "DModelPanel" ) modelPanel:SetPos( 0, 0 ) modelPanel:SetSize( 200, 200 ) modelPanel:SetModel( "models/player/kleiner.mdl" )
Output:
image.png