Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1.  
  2. function ENT:Think()
  3. if monitor.on == 0 then return end
  4.  
  5. local time = os.time()
  6. -- print( "time = " .. time ) print( "last = " .. last )
  7. if last > time - 1 then return end
  8.  
  9. -- print( "Ran @@@@" )
  10. last = time
  11.  
  12. local rate = 0
  13. local total = 0
  14. local minernumber = 0
  15. local ang = self:GetAngles()
  16. -- print("")
  17. -- print(ang[1])
  18. -- print(ang[2])
  19. -- print(ang[3])
  20.  
  21. -- if ang[1] > 10
  22.  
  23. if ang[1] < 10 and ang[1] > -10 then
  24. if ang[3] < 10 and ang[3] > -10 then
  25. for _, ent in pairs( ents.FindInSphere( self:GetPos(), 100 ) ) do
  26. if ent:GetClass() == 'btc_miner_crappy' then
  27. minernumber = minernumber + 1
  28. end
  29. end
  30.  
  31. if minernumber > 0 then
  32.  
  33. rate = math.Round( math.sqrt(0.1 * minernumber ) * (2 * minernumber ), 3) / 10
  34. monitor.total = math.Round( ( rate + monitor.total ), 5 )
  35.  
  36. net.Start( "BTC_Miners" )
  37.  
  38. net.WriteEntity(self)
  39. net.WriteString( minernumber )
  40. net.WriteString( rate )
  41. net.WriteString( monitor.total )
  42. net.WriteBool( true )
  43. net.WriteTable( BTC_IDs )
  44.  
  45. net.Broadcast()
  46.  
  47. end
  48. end
  49. end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement