Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.94 KB | None | 0 0
  1. AddCSLuaFile()
  2. ENT.Base = "bw_base_moneyprinter"
  3.  
  4. ENT.Model = "models/freeman/compact_printer.mdl"
  5. ENT.Skin = 0
  6.  
  7. ENT.Capacity = 7806509929
  8. ENT.PrintInterval = 1
  9. ENT.PrintAmount = 7806509
  10. ENT.Health = 2500
  11.  
  12. ENT.PrintName = "ВИП-Принтер T1"
  13.  
  14. ENT.FontColor = color_white
  15. ENT.BackColor = color_black
  16.  
  17.  
  18. function ENT:Draw()
  19. if CLIENT then
  20.  
  21. if self:GetPos():Distance( LocalPlayer():GetPos() ) > 1200 then return end
  22. self:DrawModel()
  23. local pos = self:GetPos()
  24. local ang = self:GetAngles()
  25. local Pw = self:IsPowered()
  26.  
  27. pos = pos + ang:Up() * 6
  28. pos = pos + ang:Forward() * 2.4
  29. pos = pos + ang:Right() * 3
  30. ang:RotateAroundAxis(ang:Up(), 90)
  31. local ang = self:GetAngles()
  32. ang:RotateAroundAxis(ang:Up(), 90)
  33.  
  34. local Cp = self:GetCapacity()
  35. local money = tonumber(self:GetMoney()) or 0
  36. local cap = tonumber(Cp) or 0
  37. local Lv = self:GetLevel() or 0
  38.  
  39.  
  40.  
  41. local money = tonumber(self:GetMoney()) or 0
  42. local cap = tonumber(Cp) or 0
  43.  
  44. local currentMoney = string.format(BaseWars.LANG.CURFORMER, BaseWars.NumberFormat(money))
  45. local maxMoney = string.format(BaseWars.LANG.CURFORMER, BaseWars.NumberFormat(cap))
  46. local paper = math.floor(self:GetPaper())
  47.  
  48.  
  49. local moneyPercentage = math.Round( money / cap * 100 ,1)
  50.  
  51. local EntityName = self.PrintName
  52. local PrinterOwner = "Уровень: ".. self:GetLevel()
  53. local MoneyAmount
  54. if Pw then
  55. MoneyAmount = currentMoney
  56. else
  57. MoneyAmount = "Нет энергии!"
  58. end
  59. local UpgCost = "/upg : $" .. BaseWars.NumberFormat(self:GetNWInt("UpgradeCost") * self:GetLevel())
  60.  
  61. cam.Start3D2D(pos + ang:Up() * 3.09,ang,0.1/2)
  62.  
  63.  
  64. draw.RoundedBox(4, -216, -170, 165*2, 62*2, Color(0,0,0))
  65. draw.DrawText(string.format(BaseWars.LANG.LevelText, Lv):upper(), "InfoSidePrinter", -50,-150, self.FontColor,TEXT_ALIGN_CENTER)
  66. draw.DrawText(string.format(BaseWars.LANG.Paper, paper), "InfoSidePrinter", -50,-125, self.FontColor,TEXT_ALIGN_CENTER)
  67. draw.DrawText("Объем: " .. BaseWars.NumberFormat(self.Capacity) .. "$", "InfoSidePrinter", -50,-100, self.FontColor, TEXT_ALIGN_CENTER)
  68. cam.End3D2D()
  69.  
  70. cam.Start3D2D(pos + ang:Up() * 3.1,ang,0.1/2)
  71. self.FontColor = HSVToColor(CurTime()/2 % 6 * 60, 1, 1)
  72. draw.RoundedBox(5,-215, -48, 325 ,1, self.FontColor)
  73. draw.RoundedBox(5,-215, -171, 325 ,1, self.FontColor)
  74. draw.RoundedBox(5,-214.4,-171,1,125, self.FontColor)
  75. draw.RoundedBox(5,109,-171,1,125, self.FontColor)
  76. cam.End3D2D()
  77.  
  78.  
  79. local UpgradeAng = self:GetAngles()
  80.  
  81. UpgradeAng:RotateAroundAxis(UpgradeAng:Forward(),90)
  82. UpgradeAng:RotateAroundAxis(UpgradeAng:Right(),270)
  83.  
  84.  
  85.  
  86. cam.Start3D2D(pos + UpgradeAng:Up() * 6.99, UpgradeAng, 0.1/2)
  87. local backmoney = self:GetMoney() / self:GetCapacity() * 69*4 .. "%"
  88. local currentMoney = string.format(BaseWars.LANG.CURFORMER, BaseWars.NumberFormat(money))
  89. local maxMoney = string.format(BaseWars.LANG.CURFORMER, BaseWars.NumberFormat(cap))
  90. self.FontColor = HSVToColor(CurTime()/2 % 6 * 60, 1, 1)
  91.  
  92. draw.DrawText("Заполнено на "..moneyPercentage.."%", "PrinterName", -15*4+5 , 1*4, self.FontColor, TEXT_ALIGN_CENTER)
  93. surface.SetDrawColor( self.FontColor)
  94. surface.DrawOutlinedRect( -49*4, 8*5.4, 36*2*4 , 3*5 )
  95.  
  96.  
  97. if self:GetMoney() > 0 then
  98.  
  99. draw.RoundedBox(0, -49*3.93, 8*5.8, self:GetMoney() / self:GetCapacity() * 36*2*3.90 , 3*3.2, self.FontColor )
  100. end
  101.  
  102. draw.DrawText(BaseWars.LANG.Cash..currentMoney, "PrinterName", -15*4+5 , 18*4, self.FontColor, TEXT_ALIGN_CENTER)
  103.  
  104. cam.End3D2D()
  105.  
  106. cam.Start3D2D(pos + UpgradeAng:Up() * 6.9, UpgradeAng, 0.1/2)
  107. self.FontColor = HSVToColor(CurTime()/2 % 6 * 60, 1, 1)
  108. draw.RoundedBox(5,-207, 107, 323 ,1, self.FontColor)
  109. draw.RoundedBox(5,-207, -17, 323 ,1,self.FontColor)
  110. draw.RoundedBox(5, 115, -15, 1 ,125, self.FontColor)
  111. draw.RoundedBox(5, -207, -15, 1 ,125, self.FontColor)
  112.  
  113. cam.End3D2D()
  114. end
  115.  
  116. end
  117.  
  118. ENT.IsValidRaidable = true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement