How to change models with derma ?

Hello !

I have this code

[lua]
function NPCShopMenu()

local models = {
[“models/Humans/Group01/Female_02.mdl”] = {},
[“models/Humans/Group01/Female_06.mdl”] = {},
[“models/Humans/Group01/Male_04.mdl”] = {},
[“models/Humans/Group01/male_07.mdl”] = {}

}

local frame = vgui.Create( “DFrame” )
frame:SetSize( 220, 220 )
frame:SetTitle( “Vendeur de vetements” )
frame:MakePopup()
frame:Center()

local mselect = vgui.Create( “DModelSelect”, frame )
mselect:SetModelList( models, “”, false, true )
mselect:SetSize( 150, 150 )
mselect:Center()

end

usermessage.Hook(“ShopNPCUsed”, NPCShopMenu) --Hook to messages from the server so we know when to display the menu.
[/lua]

And i want when i choose a models, The player models change.

Thanks you.

use [lua.] [/lua.] tags without the dots

any ideas ?

instead of making the models having a table as value, make them have true as value instead, also, make an for loop, that loops through the models & add an button to an DScrollPanel, with its DoClick you send a netmessage to the server containing the model, and then set the model of the sender.

Firstly, DModelSelect is deprecated so you should use DModelPanel instead. Secondly, you must network the selected model to the server so you can call PLAYER/SetModel.