Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. function PANEL:EquipButton()
  2. local item = STORE_ITEMS[self:GetParent().CurItem]
  3. local itemType = item.Type
  4. local command
  5. local text
  6.  
  7. if (itemType == "Hat") then
  8. command = "iv_changehat"
  9. elseif (itemType == "Trail") then
  10. command = "iv_changetrail"
  11. elseif (itemType == "Model") then
  12. command = "iv_changemodel"
  13. elseif (itemType == "Power-Up") then
  14. command = "iv_changepower"
  15. elseif (itemType == "Gesture") then
  16. text = "Use"
  17. command = "iv_usegesture"
  18. end
  19.  
  20. local parent = self:GetParent()
  21. local parentparent = parent:GetParent()
  22.  
  23. self.EquipButton = vgui.Create("DButton", self)
  24. self.EquipButton:SetSize(65, 22)
  25. self.EquipButton:SetPos(self:GetWide() - 75, 8)
  26. self.EquipButton:SetText(text or "Equip")
  27. self.EquipButton.DoClick = function()
  28. RunConsoleCommand(command, item.ID)
  29.  
  30. if (item.Type == "Hat") then
  31. LocalPlayer():SetHat(item.Model)
  32. end
  33.  
  34. if (parentparent) then
  35. parentparent.PlayerImage:SetModel(LocalPlayer():GetModel())
  36. end
  37. end
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement