Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.75 KB | None | 0 0
  1. include('shared.lua')
  2.  
  3. surface.CreateFont( "HUDNumber5", {
  4. font = "HudNumbers",
  5. size = 13,
  6. weight = 500,
  7. } )
  8.  
  9. function pubano ()
  10.  
  11. local DermaFrame = vgui.Create( "DFrame" )
  12. DermaFrame:SetPos( ScrW()/2-150, ScrH()/2-150 )
  13. DermaFrame:SetSize( 375, 375 )
  14. DermaFrame:SetTitle( "NPC AYPUB" )
  15. DermaFrame:SetVisible( true )
  16. DermaFrame:MakePopup()
  17. DermaFrame:ShowCloseButton( false )
  18. local MainPanel = vgui.Create("DPanel", DermaFrame)
  19. MainPanel:SetSize(DermaFrame:GetWide(), DermaFrame:GetTall())
  20. MainPanel.Paint = function(self)
  21.  
  22. draw.RoundedBox( 0, 0, 0, MainPanel:GetWide(), MainPanel:GetTall(), Color( 255, 255, 255, 250))
  23.  
  24. end
  25.  
  26. local CloseBtn = vgui.Create("DButton", DermaFrame)
  27. CloseBtn:SetSize(MainPanel:GetWide() / 8,MainPanel:GetTall() / 9)
  28. CloseBtn:AlignRight(0)
  29. CloseBtn:AlignTop(0)
  30. CloseBtn:SetText("")
  31. CloseBtn.Paint = function(self)
  32.  
  33. draw.RoundedBox( 0, 0, 0, MainPanel:GetWide(), MainPanel:GetTall(), Color( 255, 0, 0, 225) )
  34. draw.SimpleText("X","Trebuchet24",MainPanel:GetWide() / 23,MainPanel:GetTall() / 45,Color(255,255,255,255),TEXT_ALIGN_LEFT)
  35.  
  36. if CloseBtn:IsHovered() then
  37.  
  38. draw.RoundedBox( 0, 0, 0, MainPanel:GetWide(), MainPanel:GetTall(), Color( 45, 0, 0, 225))
  39. draw.SimpleText("X","Trebuchet24",MainPanel:GetWide() / 23,MainPanel:GetTall() / 45,Color(255,255,255,255),TEXT_ALIGN_LEFT)
  40.  
  41. end
  42.  
  43. end
  44. CloseBtn.DoClick = function(self)
  45.  
  46. DermaFrame:Close()
  47. end
  48. DButtonAdvert = vgui.Create("DButton",DermaFrame)
  49. DButtonAdvert:SetText("Advert")
  50. DButtonAdvert:SetParent( DermaFrame )
  51. DButtonAdvert:SetPos(100,100)
  52. DButtonAdvert:SetTextColor( Color( 255, 255, 255, 255 ) )
  53. DButtonAdvert:SetFont("Trebuchet24")
  54. DButtonAdvert:SetSize(175,75)
  55. DButtonAdvert.Paint = function( self, w, h )
  56. draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 225 ) )
  57. end
  58. DButtonAdvert.DoClick = function()
  59. local FrameAdvert = vgui.Create( "DFrame" )
  60. FrameAdvert:SetSize( 400, 200 )
  61. FrameAdvert:SetTitle( "Advert" )
  62. FrameAdvert:Center()
  63. FrameAdvert:MakePopup()
  64. FrameAdvert.Paint = function( self, w, h )
  65. draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 255 ) )
  66. end
  67. local TextEntryAdvert = vgui.Create( "DTextEntry", FrameAdvert )
  68. TextEntryAdvert:SetPos( 25, 50 )
  69. TextEntryAdvert:SetSize( 300, 25 )
  70. TextEntryAdvert:SetText("Taper votre Advert puis faite entrer")
  71. TextEntryAdvert.OnEnter = function( self )
  72. text = self:GetValue()
  73.  
  74. net.Start( "npcayz" )
  75. net.WriteString( text )
  76. net.SendToServer()
  77.  
  78. end
  79. DButtonpub = vgui.Create("DButton",DermaFrame)
  80. DButtonpub:SetText("100€")
  81. DButtonpub:SetParent( FrameAdvert )
  82. DButtonpub:SetPos(100,100)
  83. DButtonpub:SetTextColor( Color( 255, 255, 255, 255 ) )
  84. DButtonpub:SetFont("Trebuchet24")
  85. DButtonpub:SetSize(100,50)
  86. DButtonpub.Paint = function( self, w, h )
  87. draw.RoundedBox( 0, 0, 0, w, h, Color( 234, 255, 0, 225 ) )
  88. end
  89. DButtonpub.DoClick = function()
  90. TextEntryAdvert:GetValue()
  91. end
  92. end
  93. DermaButtonAno = vgui.Create("DButton",DermaFrame)
  94. DermaButtonAno:SetText("Anonyme")
  95. DermaButtonAno:SetParent( DermaFrame )
  96. DermaButtonAno:SetPos(100,200)
  97. DermaButtonAno:SetTextColor( Color( 255, 255, 255, 255 ) )
  98. DermaButtonAno:SetFont("Trebuchet24")
  99. DermaButtonAno:SetSize(175,75)
  100. DermaButtonAno.Paint = function( self, w, h )
  101. draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 225 ) )
  102. end
  103. DermaButtonAno.DoClick = function()
  104. local FrameAno = vgui.Create( "DFrame" )
  105. FrameAno:SetSize( 400, 200 )
  106. FrameAno:SetTitle( "Anonyme" )
  107. FrameAno:Center()
  108. FrameAno:MakePopup()
  109. FrameAno.Paint = function( self, w, h )
  110. draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 255 ) )
  111. end
  112. local TextEntryAno = vgui.Create( "DTextEntry", FrameAno )
  113. TextEntryAno:SetPos( 25, 50 )
  114. TextEntryAno:SetSize( 300, 25 )
  115. TextEntryAno:SetText("Taper votre message Anonyme puis faite entrer")
  116. TextEntryAno.OnEnter = function( self )
  117. text = self:GetValue()
  118.  
  119. net.Start( "npcayzano" )
  120. net.WriteString( text )
  121. net.SendToServer()
  122.  
  123. end
  124. DermaFrame:Close()
  125. end
  126.  
  127. end
  128.  
  129. usermessage.Hook("pubano", pubano)
  130.  
  131.  
  132. hook.Add("PostDrawOpaqueRenderables", "pubano", function()
  133. for _, ent in pairs (ents.FindByClass("npc_pubano")) do
  134. if ent:GetPos():Distance(LocalPlayer():GetPos()) < 1000 then
  135. local Ang = ent:GetAngles()
  136.  
  137. Ang:RotateAroundAxis( Ang:Forward(), 90)
  138. Ang:RotateAroundAxis( Ang:Right(), -90)
  139.  
  140. cam.Start3D2D(ent:GetPos()+ent:GetUp()*79, Ang, 0.20)
  141. draw.SimpleTextOutlined( 'NPC AYPUB', "HUDNumber5", 0, 0, Color( 255, 0, 0, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color(0, 0, 0, 255))
  142. cam.End3D2D()
  143. end
  144. end
  145. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement