Can't buy money printers after they explode...?

Okay well I have 3 custom money printers. I was wondering…How do I make it so AFTER the printers explode, I can buy them again. At the moment after they explode it just says “You have reached the limit” It’s kind of stupid really. Here is the code I am using.


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(0,120,255,255)
	local phys = self:GetPhysicsObject()
	if phys:IsValid() then phys:Wake() end
	self.sparking = false
	self.damage = 100
	self.IsMoneyPrinter = true
	timer.Simple(0.5, 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 < 6 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)
	Notify(self.dt.owning_ent, 1, 4, "Your money printer has exploded!")
end

function ENT:BurstIntoFlames()
	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 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.IsMoneyPrinter then v:Ignite(math.random(5, 22), 0) end
	end
	self:Remove()
end

PrintMore = function(ent)
	if ValidEntity(ent) then
		ent.sparking = true
		timer.Simple(0.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 = 2
	if math.random(1, 2000) == 3 then self:BurstIntoFlames() end
	local amount = self:GetNWInt("PrintA") + Y
	self:SetNWInt("PrintA",amount)
	
	self.sparking = false
	timer.Simple(0.3, PrintMore, self)
end


Can you show us the buy code please, also I would recommend making just one entity and have it read the amount to print rather then making three different objects and just changing one variable.

If you were referring to the AddEntities code it would be…

AddEntity(“Gold Money printer”, “Gold_money_printer”, “models/props_c17/consolebox01a.mdl”, 1500, 2, “/buygoldmoneyprinter”)

And I would rather have it change the print ammount but since i’m new to LUA I couldn’t figure out how to change the ammount, I thought it was mathrandom that did that but whatever.