Guest User

Untitled

a guest
May 20th, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. -- RRPX Money Printer reworked for DarkRP by philxyz
  2. AddCSLuaFile("cl_init.lua")
  3. AddCSLuaFile("shared.lua")
  4. include("shared.lua")
  5.  
  6. ENT.SeizeReward = 950
  7.  
  8. local PrintMore
  9. function ENT:Initialize()
  10. self:SetModel("models/props_c17/consolebox01a.mdl")
  11. self:PhysicsInit(SOLID_VPHYSICS)
  12. self:SetMoveType(MOVETYPE_VPHYSICS)
  13. self:SetSolid(SOLID_VPHYSICS)
  14. local phys = self:GetPhysicsObject()
  15. if phys:IsValid() then phys:Wake() end
  16. self.sparking = false
  17. self.damage = 100
  18. self.IsMoneyPrinter = true
  19. timer.Simple(27, PrintMore, self)
  20. end
  21.  
  22. function ENT:OnTakeDamage(dmg)
  23. if self.burningup then return end
  24.  
  25. self.damage = (self.damage or 100) - dmg:GetDamage()
  26. if self.damage <= 0 then
  27. local rnd = math.random(1, 10)
  28. if rnd < 3 then
  29. self:BurstIntoFlames()
  30. else
  31. self:Destruct()
  32. self:Remove()
  33. end
  34. end
  35. end
  36.  
  37. function ENT:Destruct()
  38. local vPoint = self:GetPos()
  39. local effectdata = EffectData()
  40. effectdata:SetStart(vPoint)
  41. effectdata:SetOrigin(vPoint)
  42. effectdata:SetScale(1)
  43. util.Effect("Explosion", effectdata)
  44. Notify(self.dt.owning_ent, 1, 4, "Your silver money printer has exploded!")
  45. end
  46.  
  47. function ENT:BurstIntoFlames()
  48. Notify(self.dt.owning_ent, 0, 4, "Your silver money printer is overheating!")
  49. self.burningup = true
  50. local burntime = math.random(8, 18)
  51. self:Ignite(burntime, 0)
  52. timer.Simple(burntime, self.Fireball, self)
  53. end
  54.  
  55. function ENT:Fireball()
  56. if not self:IsOnFire() then self.burningup = false return end
  57. local dist = math.random(20, 280) -- Explosion radius
  58. self:Destruct()
  59. for k, v in pairs(ents.FindInSphere(self:GetPos(), dist)) do
  60. if not v:IsPlayer() and not v.IsMoneyPrinter then v:Ignite(math.random(5, 22), 0) end
  61. end
  62. self:Remove()
  63. end
  64.  
  65. PrintMore = function(ent)
  66. if ValidEntity(ent) then
  67. ent.sparking = true
  68. timer.Simple(3, ent.CreateMoneybag, ent)
  69. end
  70. end
  71.  
  72. function ENT:CreateMoneybag()
  73. if not ValidEntity(self) then return end
  74. if self:IsOnFire() then return end
  75. local MoneyPos = self:GetPos()
  76.  
  77. if math.random(1, 22) == 3 then self:BurstIntoFlames() end
  78.  
  79. local amount = GetConVarNumber("mprintamount")
  80. if amount == 0 then
  81. amount = 500
  82. end
  83.  
  84. DarkRPCreateMoneyBag(Vector(MoneyPos.x + 15, MoneyPos.y, MoneyPos.z + 15), amount)
  85. self.sparking = false
  86. timer.Simple(math.random(100, 350), PrintMore, self)
  87. end
  88.  
  89. function ENT:Think()
  90. if not self.sparking then return end
  91.  
  92. local effectdata = EffectData()
  93. effectdata:SetOrigin(self:GetPos())
  94. effectdata:SetMagnitude(1)
  95. effectdata:SetScale(1)
  96. effectdata:SetRadius(2)
  97. util.Effect("Sparks", effectdata)
  98. end
Add Comment
Please, Sign In to add comment