Sometimes printers blow automatic, How to disable that?
I assume you're talking about DarkRP?
[QUOTE=Killervalon;40233532]I assume you're talking about DarkRP?[/QUOTE]
Yes
So you want printers that don't blow up unless shot?
[QUOTE=Bo98;40233800]So you want printers that don't blow up unless shot?[/QUOTE]
Yeah
Take out the random.math and the stuff that makes it overheat.
[lua]
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 < 3 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:Getowning_ent(), 1, 4, "Your normal money printer has exploded!")
end
function ENT:BurstIntoFlames()
GAMEMODE:Notify(self:Getowning_ent(), 0, 4, "Your money printer is overheating!")
self.burningup = true
local burntime = math.random(8, 18)
self:Ignite(burntime, 0)
timer.Simple(burntime, function() self:Fireball() end)
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[/lua]
[QUOTE=Example;40234008]Take out the random.math and the stuff that makes it overheat.
[lua]
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 < 3 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:Getowning_ent(), 1, 4, "Your normal money printer has exploded!")
end
function ENT:BurstIntoFlames()
GAMEMODE:Notify(self:Getowning_ent(), 0, 4, "Your money printer is overheating!")
self.burningup = true
local burntime = math.random(8, 18)
self:Ignite(burntime, 0)
timer.Simple(burntime, function() self:Fireball() end)
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[/lua][/QUOTE]
Now i can't blow the printers.
Sorry, my mistake, keep the following in the lua:
[lua]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:Getowning_ent(), 1, 4, "Your normal money printer has exploded!")
end[/lua]
[QUOTE=Example;40242804]Sorry, my mistake, keep the following in the lua:
[lua]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:Getowning_ent(), 1, 4, "Your normal money printer has exploded!")
end[/lua][/QUOTE]
Still can't blow it, This is my printer's init.lua
[lua]-- RRPX Money Printer reworked for DarkRP by philxyz
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
ENT.SeizeReward = 950
local PrintMore
function ENT:Initialize()
self:SetModel("models/props_c17/consolebox01a.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
phys:Wake()
self.sparking = false
self.damage = 100
self.IsMoneyPrinter = true
timer.Simple(math.random(60, 61), function() PrintMore(self) end)
end
function ENT:OnTakeDamage(dmg)
if self.burningup then return end
self.damage = (self.damage or 100) - dmg:GetDamage()
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:Getowning_ent(), 1, 4, "Your money printer has exploded!")
end
PrintMore = function(ent)
if not IsValid(ent) then return end
ent.sparking = true
timer.Simple(3, function()
if not IsValid(ent) then return end
ent:CreateMoneybag()
end)
end
function ENT:CreateMoneybag()
local MoneyPos = self:GetPos()
local amount = GAMEMODE.Config.mprintamount
if amount == 0 then
amount = 400
end
DarkRPCreateMoneyBag(Vector(MoneyPos.x + 15, MoneyPos.y, MoneyPos.z + 15), amount)
self.sparking = false
timer.Simple(math.random(60,61), function() PrintMore(self) end)
end
function ENT:Think()
if self:WaterLevel() > 0 then
self:Destruct()
self:Remove()
return
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
[/lua]
Where to start... first of all, as I said on your other DarkRP threads. THIS IS NOT THE PLACE. Nor is it the place for lua scripting help.
As for the anwser to your question. Why the fuck did you modify the ENT:OnTakeDamage? You are the one that fucked it up. Example gave you what you needed, minus the part where he took out ENT:Destruct.
[B][I][U]Do not come back[/U][/I][/B] with your DarkRP questions. Go put them in the DarkRP Mega thread. If you have a legitimate issue regarding the game, by all means post them here, otherwise stay out.
Sorry, you need to Log In to post a reply to this thread.