ULX

Author Topic: Removing a derma object  (Read 2867 times)

0 Members and 2 Guests are viewing this topic.

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Removing a derma object
« on: December 29, 2014, 11:37:16 AM »
Hey I'm working on a small script and part of it is a window that shows a player's playermodel
I've got that part working, but I have a button underneath it that "refreshes" it
Which really just means that it gets the model the player is using again and sets the window to show that

The problem is, when the model switches, the model in the window looks all weird

For example, if the window starts showing the Alyx model
It'll look like this

But when I switched my model, it looked like this


So I was thinking, what if instead of just switching the model it's using, I delete the DModelPanel and create a new one with lua
I was looking through the GMod Wiki and I couldn't find anything that would delete a DModelPanel so that I could recreate it
So I figured I would check here to see if any of you know how I would do it, or if there's another way and I'm just not thinking of it

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Removing a derma object
« Reply #1 on: December 29, 2014, 01:26:32 PM »
when you create it you'll have named it.

name = vgui.Create("blah")

just call name:Remove()

You might want to do a check first though.

if IsValid( name ) then name:Remove() end

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given