Advertisement
LucianDevran

2B Pointshop code

Dec 6th, 2017
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.33 KB | None | 0 0
  1. ITEM.Name = '2B'
  2. ITEM.Price = 250
  3. ITEM.Model = 'models/kuma96/2b/2b_pm.mdl'
  4. ITEM.Description = "2B"
  5.  
  6. function ITEM:OnEquip(ply, modifications)
  7. if not ply._OldModel then
  8. ply._OldModel = ply:GetModel()
  9. end
  10. timer.Simple(2, function() ply:SetupHands()
  11. ply:SetModel(self.Model)
  12. --ply:SetSkin(1)
  13. ply:SetBodygroup(1, modifications.group1 or 0) --Headband
  14. ply:SetBodygroup(2, modifications.group2 or 0) --Skirt
  15. ply:SetBodygroup(3, modifications.group3 or 0) --Virtuous Contract
  16. ply:SetBodygroup(4, modifications.group4 or 0) --Beastlord
  17. end)
  18. end
  19.  
  20.  
  21.  
  22. function Derma_Query_Dropdown( strText, strTitle, ... )
  23.  
  24. local Window = vgui.Create( "DFrame" )
  25. Window:SetTitle( strTitle or "Message Title (First Parameter)" )
  26. Window:SetDraggable( true )
  27. Window:ShowCloseButton( false )
  28. Window:SetBackgroundBlur( false )
  29. Window:SetDrawOnTop( true )
  30.  
  31. local InnerPanel = vgui.Create( "DPanel", Window )
  32. InnerPanel:SetDrawBackground( false )
  33.  
  34. local Text = vgui.Create( "DLabel", InnerPanel )
  35. Text:SetText( strText or "Message Text (Second Parameter)" )
  36. Text:SizeToContents()
  37. Text:SetContentAlignment( 5 )
  38. Text:SetTextColor( color_white )
  39.  
  40. local ButtonPanel = vgui.Create( "DPanel", Window )
  41. ButtonPanel:SetTall( 50 )
  42. ButtonPanel:SetDrawBackground( false )
  43.  
  44. local NumOptions = 0
  45. local ListBox = vgui.Create( "DComboBox", ButtonPanel )
  46.  
  47. local k = 1
  48. while true do
  49.  
  50. local Text = select( k, ... )
  51. if Text == nil then break end
  52.  
  53. local Func = select( k+1, ... ) or function() end
  54.  
  55. ListBox:AddChoice(Text, Func, k == 1)
  56.  
  57. NumOptions = NumOptions + 1
  58. k = k + 2
  59.  
  60. end
  61.  
  62. ListBox:SetPos(5,25)
  63. ListBox:SetWide(100)
  64. ListBox:SetTall(20)
  65. ListBox.OnSelect = function(self, index, value, data)
  66. data()
  67. Window:Close();
  68. end
  69.  
  70.  
  71. local w, h = Text:GetSize()
  72.  
  73. w = math.max( w, ButtonPanel:GetWide() )
  74.  
  75. Window:SetSize( w + 50, h + 25 + 45 + 10 )
  76. Window:Center()
  77.  
  78. InnerPanel:StretchToParent( 5, 25, 5, 45 )
  79.  
  80. Text:SetPos(0,5)
  81. Text:CenterHorizontal()
  82.  
  83. ButtonPanel:StretchToParent( 5, 25, 5, 5 )
  84.  
  85. ListBox:SetWide(ButtonPanel:GetWide())
  86. ListBox:CenterHorizontal()
  87. ListBox:CenterVertical()
  88.  
  89. Window:MakePopup()
  90.  
  91. if ( NumOptions == 0 ) then
  92.  
  93. Window:Close()
  94. Error( "Derma_Query: Created Query with no Options!?" )
  95. return nil
  96.  
  97. end
  98.  
  99. return Window
  100.  
  101. end
  102.  
  103. function ITEM:OnHolster(ply)
  104. if ply._OldModel then
  105. ply:SetModel(ply._OldModel)
  106. end
  107. end
  108.  
  109. function ITEM:Modify(modifications)
  110. Derma_Query_Dropdown("Headband", "",
  111. "On", function()
  112. modifications.group1 = 0 -- Default Headband
  113. PS:SendModifications(self.ID, modifications) --Makes sure the pointshop knows to apply changes
  114. end,
  115. "Off", function()
  116. modifications.group1 = 1 -- No Headband
  117. PS:SendModifications(self.ID, modifications)
  118. end)
  119. Derma_Query_Dropdown("Choose Skirt", "",
  120. "Default Skirt", function()
  121. modifications.group2 = 0 -- Default Skirt
  122. PS:SendModifications(self.ID, modifications) --Makes sure the pointshop knows to apply changes
  123. end,
  124. "Broken Skirt", function()
  125. modifications.group2 = 1 -- Broken Skirt
  126. PS:SendModifications(self.ID, modifications)
  127. end,
  128. "No Skirt (Not Nude)", function()
  129. modifications.group2 = 2 -- No Skirt
  130. PS:SendModifications(self.ID, modifications)
  131. end)
  132. Derma_Query_Dropdown("Virtuous Contract", "",
  133. "Off", function()
  134. modifications.group3 = 0 -- Default Virtuous Contract Disabled
  135. PS:SendModifications(self.ID, modifications) --Makes sure the pointshop knows to apply changes
  136. end,
  137. "On", function()
  138. modifications.group3 = 1 -- Virtuous Contract
  139. PS:SendModifications(self.ID, modifications)
  140. end)
  141. Derma_Query_Dropdown("Beastlord", "",
  142. "Off", function()
  143. modifications.group4 = 0 -- Default Beastlord Disabled
  144. PS:SendModifications(self.ID, modifications) --Makes sure the pointshop knows to apply changes
  145. end,
  146. "On", function()
  147. modifications.group4 = 1 -- Beastlord enabled
  148. PS:SendModifications(self.ID, modifications)
  149. end)
  150. print("modify")
  151.  
  152. end
  153.  
  154. function ITEM:OnModify(ply, modifications)
  155. self:OnHolster(ply)
  156. self:OnEquip(ply, modifications) -- adds the item back again, with new mods
  157. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement