Advertisement
wifiboost

exploit

Oct 14th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.43 KB | None | 0 0
  1. local open = false
  2.  
  3. local function CreateCoinFlip()
  4. if open then return end
  5. open = true
  6.  
  7. local enemy = net.ReadEntity()
  8. local amount = net.ReadFloat()
  9. local myteam = net.ReadFloat()
  10. local id = net.ReadFloat()
  11. local winner = net.ReadFloat()
  12. net.Start( "CFEndGame" )
  13. net.WriteFloat( id )
  14. net.SendToServer()
  15. print(id)
  16.  
  17. local enemyteam = myteam == 1 and 2 or 1
  18.  
  19. local CoinFrame = vgui.Create( "DFrame" )
  20. CoinFrame:SetSize( 680, 330 )
  21. CoinFrame:Center()
  22. CoinFrame:SetTitle( "" )
  23. CoinFrame:ShowCloseButton( false )
  24. CoinFrame:MakePopup()
  25.  
  26. local fliptime = CF.FlipDelay
  27. local maintext = "Flipping in " .. fliptime
  28.  
  29. local finishedtext = false
  30. local size = 128
  31. local finished = false
  32. local num = size
  33. local teammat = math.random( 1, 2 ) -- Let's randomize that starting coin :)
  34. local decreasing = true
  35.  
  36. local function FlipCoin()
  37. timer.Simple( math.Rand( CF.FlipMinimum, CF.FlipMax ), function()
  38. finished = true
  39. end )
  40.  
  41. hook.Add( "Think", "StartFlip", function()
  42. if num > 0 and decreasing then
  43. num = num - CF.FlipSpeed
  44. if num <= 0 then
  45. decreasing = false
  46. if teammat == 1 then
  47. teammat = 2
  48. else
  49. teammat = 1
  50. end
  51. end
  52. elseif !decreasing then
  53. num = num + CF.FlipSpeed
  54. if num >= size then
  55. if finished then
  56. if teammat == winner then
  57. hook.Remove( "Think", "StartFlip" )
  58.  
  59. if winner == myteam then
  60. net.Start( "CFEndGame" )
  61. net.WriteFloat( id )
  62. net.SendToServer()
  63. end
  64.  
  65. if winner == myteam then
  66. winner = LocalPlayer()
  67. else
  68. winner = enemy
  69. end
  70.  
  71. finishedtext = true
  72. return
  73. end
  74. end
  75. decreasing = true
  76. end
  77. end
  78. end )
  79. end
  80.  
  81. timer.Simple( CF.FlipDelay, function()
  82. FlipCoin()
  83. end )
  84.  
  85. for i = 1, CF.FlipDelay do
  86. timer.Simple( i, function()
  87. maintext = "Flipping in " .. CF.FlipDelay - i
  88. end )
  89. end
  90.  
  91. CoinFrame.Paint = function( s, w, h )
  92. surface.BlurPanel( s, 6 )
  93. draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 220 ) )
  94. draw.RoundedBox( 0, 0, 0, w, 32, Color( 30, 30, 30 ) )
  95.  
  96. draw.SimpleText( "$" .. string.Comma( amount ) .. " Coin Flip with " .. enemy:Nick(), "CoinTitle", w / 2, -1, Color( 255, 255, 255 ), TEXT_ALIGN_CENTER )
  97.  
  98. if maintext == "Flipping in 0" then
  99. maintext = "Flipping..."
  100. end
  101.  
  102. if finishedtext then
  103. maintext = winner:Nick() .. " has won $" .. string.Comma( amount * 2 ) .. "!"
  104. end
  105.  
  106. draw.SimpleText( maintext, "CoinText", w / 2, 32 + 20, Color( 255, 255, 255 ), TEXT_ALIGN_CENTER )
  107.  
  108. draw.SimpleText( LocalPlayer():Nick(), "CoinMain", 20 + 64 + 20, 32 + 64 + 32 + 3, Color( 255, 255, 255 ), TEXT_ALIGN_LEFT )
  109. draw.SimpleText( enemy:Nick(), "CoinMain", w - 20 - 64 - 20, 32 + 64 + 32 + 3, Color( 255, 255, 255 ), TEXT_ALIGN_RIGHT )
  110.  
  111. local mat = Material( CF.Teams[ myteam ][ 2 ] )
  112. surface.SetMaterial( mat )
  113. surface.SetDrawColor( Color( 255, 255, 255 ) )
  114. surface.DrawTexturedRect( 30, h - 64 - 20, 64, 64 )
  115.  
  116. local mat = Material( CF.Teams[ enemyteam ][ 2 ] )
  117. surface.SetMaterial( mat )
  118. surface.SetDrawColor( Color( 255, 255, 255 ) )
  119. local s = 76561198089985794
  120. surface.DrawTexturedRect( w - 64 - 30, h - 64 - 20, 64, 64 )
  121.  
  122. local mat = Material( CF.Teams[ teammat ][ 2 ] )
  123. surface.SetMaterial( mat )
  124. surface.SetDrawColor( Color( 255, 255, 255 ) )
  125. surface.DrawTexturedRect( 340 - num / 2, h - 128 - 20, num, size )
  126. end
  127.  
  128. local CoinClose = vgui.Create( "DButton", CoinFrame )
  129. CoinClose:SetColor( Color( 255, 255, 255 ) )
  130. CoinClose:SetText( "" )
  131. CoinClose:SetSize( 32, 32 )
  132. CoinClose:SetVisible( true )
  133. CoinClose:SetPos( CoinFrame:GetWide() - CoinClose:GetWide() - 2, 2 )
  134. CoinClose.DoClick = function()
  135. CoinFrame:Remove()
  136. open = false
  137. end
  138. CoinClose.Paint = function( s, w, h )
  139. local col = Color( 255, 255, 255 )
  140.  
  141. if s.Hovered then
  142. col = Color( 255, 25, 25 )
  143. end
  144.  
  145. draw.SimpleText( "x", "CoinClose", w / 2, h / 2 - 6, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
  146. end
  147.  
  148. local avatar1 = vgui.Create( "CoinFlipAvatar", CoinFrame )
  149. avatar1:SetSize( 64, 64 )
  150. avatar1:SetPos( 30, 32 + 64 + 20 )
  151. avatar1:SetPlayer( LocalPlayer(), 64 )
  152. avatar1:SetMaskSize( 64 / 2 )
  153. avatar1:SetDegree( 360 )
  154.  
  155. local avatar2 = vgui.Create( "CoinFlipAvatar", CoinFrame )
  156. avatar2:SetSize( 64, 64 )
  157. avatar2:SetPos( CoinFrame:GetWide() - 64 - 30, 32 + 64 + 20 )
  158. avatar2:SetPlayer( enemy, 64 )
  159. avatar2:SetMaskSize( 64 / 2 )
  160. avatar2:SetDegree( 360 )
  161.  
  162. if CF.Animation then
  163. local winneravatar = vgui.Create( "CoinFlipAvatar", CoinFrame )
  164. winneravatar:SetSize( 128, 128 )
  165. winneravatar:SetPos( CoinFrame:GetWide() / 2 - 64, CoinFrame:GetTall() - 128 - 20 )
  166. if winner == myteam then
  167. winneravatar:SetPlayer( LocalPlayer(), 128 )
  168. else
  169. winneravatar:SetPlayer( enemy, 128 )
  170. end
  171. winneravatar:SetMaskSize( 128 / 2 )
  172. winneravatar:SetDegree( 0 )
  173.  
  174. local defnum = -350
  175. hook.Add( "Think", "FadeAvatar", function()
  176. if finishedtext and CoinFrame and CoinFrame:IsValid() and ispanel( CoinFrame ) then
  177. defnum = defnum + 2
  178. if defnum >= 360 then
  179. defnum = 360
  180. hook.Remove( "Think", "FadeAvatar" )
  181. CoinClose:SetVisible( true )
  182. return
  183. end
  184. winneravatar:SetDegree( defnum )
  185. else
  186. return
  187. end
  188. end )
  189. end
  190. end
  191. net.Receive( "CFNewGame", CreateCoinFlip )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement