Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.93 KB | None | 0 0
  1. if not CLIENT then return end
  2. surface.CreateFont( "BM_Large", {
  3. font = "Tahoma",
  4. size = ScreenScale( 15 ),
  5. weight = 500
  6. } )
  7. surface.CreateFont( "BM_Medium", {
  8. font = "Tahoma",
  9. size = ScreenScale( 10 ),
  10. weight = 500
  11. } )
  12. surface.CreateFont( "BM_Small", {
  13. font = "Tahoma",
  14. size = ScreenScale( 7 ),
  15. weight = 500
  16. } )
  17. local function Buildmode_Menu()
  18. local Frame = vgui.Create( "DFrame" )
  19. Frame:SetSize( ScreenScale(200), ScreenScale(200) )
  20. Frame:SetTitle( "" )
  21. Frame:ShowCloseButton(true)
  22. Frame:Center()
  23. Frame:MakePopup()
  24. Frame.Paint = function( self, w, h )
  25. draw.RoundedBox( 0, 0, 0, w, h, Color( 100, 100, 100, 255 ) )
  26. end
  27. local function stage2(choice)
  28. --ChoiceLabel
  29. --First Label
  30. if choice == "PVP" then
  31. local label_choice = vgui.Create("DLabel", Frame)
  32. label_choice:SetFont("BM_Medium")
  33. label_choice:SetText(" You have chosen PVP mode.\n To switch to build mode, type \n '!build'\n in chat.")
  34. label_choice:SizeToContents()
  35. label_choice:SetTextColor( Color(200,200,200))
  36. label_choice:Center()
  37. else
  38. local label_choice = vgui.Create("DLabel", Frame)
  39. label_choice:SetFont("BM_Medium")
  40. label_choice:SetText(" You have chosen build mode.\n To switch to PVP mode, type \n '!pvp'\n in chat.")
  41. label_choice:SizeToContents()
  42. label_choice:SetTextColor( Color(200,200,200))
  43. label_choice:SetPos(0,ScreenScale(10))
  44. label_choice:Center()
  45. end
  46. --PVP Mode
  47. local but_close = vgui.Create( "DButton", Frame )
  48. but_close:SetText( "Close" )
  49. but_close:SetTextColor( Color( 255, 255, 255 ) )
  50. but_close:SetFont("BM_Large")
  51. but_close:SetSize( ScreenScale(100), ScreenScale(30) )
  52. but_close:SetPos( 0, ScreenScale(150) )
  53. but_close:CenterHorizontal()
  54. but_close.Paint = function( self, w, h )
  55. draw.RoundedBox( 0, 0, 0, w, h, Color( 200, 200, 200, 255 ) )
  56. end
  57. but_close.DoClick = function()
  58. Frame:Remove()
  59. end
  60. --[[
  61. local label_build = vgui.Create("DLabel", Frame)
  62. label_build:SetText("Build mode give you god mode and prevents you from hurting other players.")
  63. label_build:SetTextColor( Color(200,200,200))
  64. label_build:SetPos(100,50)
  65. --PVP Label
  66. local label_pvp = vgui.Create("DLabel", Frame)
  67. label_pvp:SetText("PVP mode allows you to hurt and be hurt.")
  68. label_pvp:SetTextColor( Color(200,200,200))
  69. label_pvp:SetPos(100,50)
  70. --You Have Chosen Label
  71. local label_choice = vgui.Create("DLabel", Frame)
  72. label_choice:SetText("")
  73. label_choice:SetTextColor( Color(200,200,200))
  74. label_choice:SetPos(100,50)
  75. label_choice:SetText("You have chosen Build Mode. However, you may change this at any time by typing '!pvp' in chat.")
  76. ]]
  77. end
  78. local function stage1()
  79. --First Label
  80. local label_choose = vgui.Create("DLabel", Frame)
  81. label_choose:SetFont("BM_Medium")
  82. label_choose:SetText(" Welcome to Hybrid Gaming - Sandbox.\n Please choose which mode you would like to play in. \n You can change it later.")
  83. label_choose:SizeToContents()
  84. label_choose:SetTextColor( Color(200,200,200))
  85. label_choose:SetPos(0,ScreenScale(10))
  86. label_choose:CenterHorizontal()
  87. --Build Mode
  88. local but_build = vgui.Create( "DButton", Frame )
  89. but_build:SetText( "Build Mode" )
  90. but_build:SetTextColor( Color( 255, 255, 255 ) )
  91. but_build:SetFont("BM_Large")
  92. but_build:SetSize( ScreenScale(100), ScreenScale(30) )
  93. but_build:SetPos( 0, ScreenScale(70) )
  94. but_build:CenterHorizontal()
  95. but_build.Paint = function( self, w, h )
  96. draw.RoundedBox( 0, 0, 0, w, h, Color( 200, 200, 200, 255 ) )
  97. end
  98. --Build Desc
  99. local label_builddesc = vgui.Create("DLabel", Frame)
  100. label_builddesc:SetFont("BM_Small")
  101. label_builddesc:SetText("Build mode give you god mode and prevents you from hurting other players.")
  102. label_builddesc:SizeToContents()
  103. label_builddesc:SetTextColor( Color(200,200,200))
  104. label_builddesc:SetPos(0,ScreenScale(110))
  105. label_builddesc:CenterHorizontal()
  106. --PVP Mode
  107. local but_pvp = vgui.Create( "DButton", Frame )
  108. but_pvp:SetText( "PVP Mode" )
  109. but_pvp:SetTextColor( Color( 255, 255, 255 ) )
  110. but_pvp:SetFont("BM_Large")
  111. but_pvp:SetSize( ScreenScale(100), ScreenScale(30) )
  112. but_pvp:SetPos( 0, ScreenScale(150) )
  113. but_pvp:CenterHorizontal()
  114. but_pvp.Paint = function( self, w, h )
  115. draw.RoundedBox( 0, 0, 0, w, h, Color( 200, 200, 200, 255 ) )
  116. end
  117. --PVP Desc
  118. local label_pvpdesc = vgui.Create("DLabel", Frame)
  119. label_pvpdesc:SetFont("BM_Small")
  120. label_pvpdesc:SetText("PVP mode allows you to hurt and be hurt.")
  121. label_pvpdesc:SizeToContents()
  122. label_pvpdesc:SetTextColor( Color(200,200,200))
  123. label_pvpdesc:SetPos(0,ScreenScale(190))
  124. label_pvpdesc:CenterHorizontal()
  125. but_build.DoClick = function()
  126. --SetBuild
  127. label_choose:Remove()
  128. label_pvpdesc:Remove()
  129. label_builddesc:Remove()
  130. but_build:Remove()
  131. but_pvp:Remove()
  132.  
  133. net.Start("InitBuild")
  134. net.WriteEntity(LocalPlayer())
  135. net.SendToServer()
  136. stage2("Build")
  137. end
  138. but_pvp.DoClick = function()
  139. --SetPVP
  140. label_choose:Remove()
  141. label_pvpdesc:Remove()
  142. label_builddesc:Remove()
  143. but_build:Remove()
  144. but_pvp:Remove()
  145. net.Start("InitPVP")
  146. net.WriteEntity(LocalPlayer())
  147. net.SendToServer()
  148. stage2("PVP")
  149. --Start Timer to close
  150. end
  151. end
  152. stage1()
  153. end
  154.  
  155. hook.Add("InitPostEntity", "PlayerJoinThing", function()
  156. local ply = LocalPlayer()
  157. if ply:IsBot() then
  158. net.Start("InitPVP")
  159. net.WriteEntity(LocalPlayer())
  160. net.SendToServer()
  161. else
  162. net.Start("PlayerJoin")
  163. net.SendToServer()
  164. for k, v in pairs(player.GetAll()) do
  165. end
  166. end
  167. end)
  168. net.Receive("RightBackAtYou", function(len)
  169. Buildmode_Menu()
  170. end)
  171. //TITLE SHIT
  172.  
  173. function DrawNameTitle()
  174. local textalign = 1
  175. local distancemulti = 2
  176. local vStart = LocalPlayer():GetPos()
  177. local vEnd
  178. for k, v in pairs(player.GetAll()) do
  179. local vmode = "Error/Not Loaded In"
  180. local vtestmode = v:GetNWBool("BuildMode",nil)
  181. if vtestmode != nil then
  182. vmode=vtestmode
  183. end
  184. if (vmode != LocalPlayer():GetNWBool("BuildMode",nil) or vmode == "Error/Not Loaded In") and v:Alive() then
  185.  
  186. local vStart = LocalPlayer():GetPos()
  187. local vEnd = v:GetPos() + Vector(0,0,40)
  188. local trace = util.TraceLine( {
  189. start = vStart,
  190. endpos = vEnd,
  191. filter = function( ent ) if ( ent:GetClass() == "prop_physics" ) then return true end end
  192. } )
  193. if trace.Entity != NULL then
  194. --Do nothing!
  195. else
  196. local mepos = LocalPlayer():GetPos()
  197. local tpos = v:GetPos()
  198. local tdist = mepos:Distance(tpos)
  199.  
  200. if tdist <= 3000 then
  201. local zadj = 0.03334 * tdist
  202. local pos = v:GetPos() + Vector(0,0,v:OBBMaxs().z + 5 + zadj)
  203. pos = pos:ToScreen()
  204.  
  205. local alphavalue = (600 * distancemulti) - (tdist/1.5)
  206. alphavalue = math.Clamp(alphavalue, 0, 255)
  207.  
  208. local outlinealpha = (450 * distancemulti) - (tdist/2)
  209. outlinealpha = math.Clamp(outlinealpha, 0, 255)
  210.  
  211.  
  212. local playercolour = Color(255,255,255)
  213. titlefont = "Trebuchet18"
  214. if v!=LocalPlayer() then
  215. if vmode == "Error/Not Loaded In" then
  216. draw.SimpleTextOutlined("ERROR/NOT LOADED IN", titlefont, pos.x, pos.y + 6, Color(255,255,255,alphavalue),textalign,1,1,Color(0,0,0,outlinealpha))
  217. elseif vmode == true then
  218. draw.SimpleTextOutlined("BUILD MODE", titlefont, pos.x, pos.y + 6, Color(0,150,255,alphavalue),textalign,1,1,Color(0,0,0,outlinealpha))
  219. elseif vmode == false then
  220. draw.SimpleTextOutlined("PVP MODE", titlefont, pos.x, pos.y + 6, Color(255,0,0,alphavalue),textalign,1,1,Color(0,0,0,outlinealpha))
  221. end
  222. end
  223. end
  224. end
  225. end
  226. end
  227. end
  228.  
  229. net.Receive("CheckBM_Back", function(len,ply)
  230. local netply = net.ReadEntity()
  231. local mode = net.ReadBool()
  232. local netply = Player(netply:UserID())
  233. --netply.buildmode = mode
  234. end)
  235. timer.Simple(0,function()
  236. hook.Add("HUDPaint", "DrawNameTitle", DrawNameTitle)
  237. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement