Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The Init.Lua
- AddCSLuaFile("cl_init.lua")
- AddCSLuaFile("shared.lua")
- include("shared.lua")
- local PrintMore
- function ENT:Initialize()
- self:SetModel("models/props_c17/consolebox01a.mdl")
- self:PhysicsInit(SOLID_VPHYSICS)
- self:SetMoveType(MOVETYPE_VPHYSICS)
- self:SetSolid(SOLID_VPHYSICS)
- self:SetColor(200,100,30,255)
- local phys = self:GetPhysicsObject()
- if phys:IsValid() then phys:Wake() end
- self.sparking = false
- self.damage = 100
- self.IsMoneyPrinter = true
- timer.Simple(180, PrintMore, self)
- self:SetNWInt("PrintA",0)
- end
- function ENT:OnTakeDamage(dmg)
- if self.burningup then return end
- self.damage = (self.damage or 100) - dmg:GetDamage()
- if self.damage <= 0 then
- local rnd = math.random(1, 10)
- if rnd < 2 then
- self:BurstIntoFlames()
- else
- self:Destruct()
- self:Remove()
- end
- end
- end
- function ENT:Destruct()
- local vPoint = self:GetPos()
- local effectdata = EffectData()
- effectdata:SetStart(vPoint)
- effectdata:SetOrigin(vPoint)
- effectdata:SetScale(1)
- util.Effect("Explosion", effectdata)
- GAMEMODE:Notify(self.dt.owning_ent, 1, 4, "Your money printer has exploded!")
- end
- function ENT:BurstIntoFlames()
- GAMEMODE:Notify(self.dt.owning_ent, 1, 4, "Your money printer is overheating!")
- self.burningup = true
- local burntime = math.random(8, 18)
- self:Ignite(burntime, 0)
- timer.Simple(burntime, self.Fireball, self)
- end
- function ENT:Fireball()
- if not self:IsOnFire() then self.burningup = false return end
- local dist = math.random(20, 280) -- Explosion radius
- self:Destruct()
- for k, v in pairs(ents.FindInSphere(self:GetPos(), dist)) do
- if not v:IsPlayer() and not v:IsWeapon() and v:GetClass() ~= "predicted_viewmodel" and not v.IsMoneyPrinter then
- v:Ignite(math.random(5, 22), 0)
- elseif v:IsPlayer() then
- local distance = v:GetPos():Distance(self:GetPos())
- v:TakeDamage(distance / dist * 100, self, self)
- end
- end
- self:Remove()
- end
- PrintMore = function(ent)
- if ValidEntity(ent) then
- ent.sparking = true
- timer.Simple(5, ent.CreateMoneybag, ent)
- end
- end
- function ENT:Use(activator)
- if(activator:IsPlayer()) then
- activator:AddMoney(self:GetNWInt("PrintA"));
- self:SetNWInt("PrintA",0)
- end
- end
- function ENT:CreateMoneybag()
- if not ValidEntity(self) then return end
- if self:IsOnFire() then return end
- local MoneyPos = self:GetPos()
- local X = 22
- local Y = 250
- // ---Removed Code --- if math.random(1, 22) == 3 then self:BurstIntoFlames() end
- //---------- Added code------
- local count1 = 0
- local mytable = ents.FindInSphere(self:GetPos(),100)
- for key,value in ipairs(mytable) do
- if string.find(value:GetClass(),"printer_cooler") then
- count1 = count1 + 1
- end
- end
- if(count1 >= 1) then
- if math.random(1,44) == 3 then self:BurstIntoFlames() end
- elseif(count1 == 0) then
- if math.random(1,22) == 3 then self:BurstIntoFlames() end
- end
- //---------------------------
- local amount = self:GetNWInt("PrintA") + Y
- self:SetNWInt("PrintA",amount)
- self.sparking = false
- timer.Simple(60, PrintMore, self)
- end
- function ENT:Think()
- //--------------------------Added Code---------------------------------
- local count2 = 0
- local mytable = ents.FindInSphere(self:GetPos(),100)
- for key,value in ipairs(mytable) do
- if string.find(value:GetClass(),"printer_cooler") then
- count2 = count2 + 1
- end
- end
- if( count2 >= 1) then
- self:SetColor(200,100,30,255)
- if count2 = 1 then
- self:SetNWInt("IsCooled",count2)
- elseif( count2 == 0) then
- self:SetColor(200,100,30,255)
- end
- //if( count2 >= 1) then
- // self:SetColor(50,50,255,255)
- //elseif( count2 == 0) then
- // self:SetColor(255,255,255,255)
- //end
- //-----------------------------------------------------------------------
- if not self.sparking then return end
- local effectdata = EffectData()
- effectdata:SetOrigin(self:GetPos())
- effectdata:SetMagnitude(1)
- effectdata:SetScale(1)
- effectdata:SetRadius(2)
- util.Effect("Sparks", effectdata)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement