I Tried to fix the error from this moneyprinter [url]http://www.garrysmod.org/downloads/?a=view&id=124347[/url] from [Gmod-Net.] UnR
I press (upgrade) nothing happens )= same for (buy 10x paper)
[B]
[U]Init.lua[/U][/B]
[HTML]-- RRPX Money Printer reworked for DarkRP by philxyz
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
local PrintMore
local Entity;
function ENT:Initialize()
--if not ent.dt.owning_ent:IsUserGroup( "Silber" ) or not ent.dt.owning_ent:IsUserGroup( "Gold" ) or not ent.dt.owning_ent:IsUserGroup( "Platin" ) or not ent.dt.owning_ent:IsUserGroup( "Diamant" ) then
-- Notify(self.dt.owning_ent, 1, 4, "You need to be a Premium Member to use this!")
--self.dt.owning_ent:AddMoney(1000)
--Destruct()
--return
self:SetModel("models/props_c17/consolebox01a.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType( SIMPLE_USE );
local phys = self:GetPhysicsObject()
if phys:IsValid() then phys:Wake() end
self.sparking = false
self.damage = 100
self.IsMoneyPrinter = true
timer.Simple(27, PrintMore, self)
self.MPLevel = 1
self.CurPaper = 5
self.MaxxPaper = 10
self.PrintWNPaper = 0
if self.MPLevel == 1 then
Entity = ents.Create("prop_physics");
Entity:SetPos(self:GetPos() + Vector(0, 0, 14))
Entity:SetAngles(self:GetAngles() - Angle(0, 0, 0));
Entity:SetModel("models/props_lab/reciever01b.mdl");
Entity:SetParent(self);
Entity:Spawn();
end
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 < 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)
Notify(self.dt.owning_ent, 1, 4, "Your money printer has exploded!")
end
function ENT:BurstIntoFlames()
Notify(self.dt.owning_ent, 0, 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.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(3, ent.CreateMoneybag, ent)
end
end
function ENT:CreateMoneybag()
if not ValidEntity(self) then return end
if self:IsOnFire() then return end
local MoneyPos = self:GetPos()
if self.PrintWNPaper >= 3 then
if math.random(1, 3) == 2 then self:BurstIntoFlames() end
Notify(self.dt.owning_ent, 1, 4, "You printed 3 times without Paper, your Money printer began to break!" )
timer.Simple(math.random(250, 300), PrintMore, self)
return
end
if self.CurPaper <= 0 then
self.CurPaper = 0
self.PrintWNPaper = self.PrintWNPaper + 1
Notify(self.dt.owning_ent, 1, 4, "You dont have enough Paper to Print! Go and Refill it." )
self.sparking = false
timer.Simple(math.random(250, 300), PrintMore, self)
if math.random(1, 10) == 3 then self:BurstIntoFlames() end
return
end
if self.MPLevel == 1 then
if math.random(1, 15) == 3 then self:BurstIntoFlames() end
self.CurPaper = self.CurPaper - 1
elseif self.MPLevel == 2 then
self.CurPaper = self.CurPaper - 1
if math.random(1, 18) == 3 then self:BurstIntoFlames() end
end
if self.MPLevel == 1 then
if self.PrintWNPaper == 1 then
amount = math.random(100,150)
self:EmitSound("items/spawn_item.wav", 85, 100)
Notify(self.dt.owning_ent, 1, 4, "Your printing has been decreased due printing without Paper." )
elseif self.PrintWNPaper == 2 then
amount = math.random(90,150)
self:EmitSound("items/spawn_item.wav", 85, 100)
Notify(self.dt.owning_ent, 1, 4, "Your printing has been decreased due printing without Paper." )
elseif self.PrintWNPaper == 3 then
amount = math.random(70,110)
self:EmitSound("items/spawn_item.wav", 85, 100)
Notify(self.dt.owning_ent, 1, 4, "Your printing has been decreased due printing without Paper." )
else
amount = math.random(50,90)
self:EmitSound("items/spawn_item.wav", 85, 100)
end
elseif self.MPLevel == 2 then
if self.PrintWNPaper == 1 then
amount = math.random(150,180)
self:EmitSound("items/spawn_item.wav", 85, 100)
Notify(self.dt.owning_ent, 1, 4, "Your printing has been decreased due printing without Paper." )
elseif self.PrintWNPaper == 2 then
amount = math.random(130,170)
self:EmitSound("items/spawn_item.wav", 85, 100)
Notify(self.dt.owning_ent, 1, 4, "Your printing has been decreased due printing without Paper." )
elseif self.PrintWNPaper == 3 then
amount = math.random(100,150)
self:EmitSound("items/spawn_item.wav", 85, 100)
Notify(self.dt.owning_ent, 1, 4, "Your printing has been decreased due printing without Paper." )
else
amount = math.random(180,210)
self:EmitSound("items/spawn_item.wav", 85, 100)
end
end
DarkRPCreateMoneyBag(Vector(MoneyPos.x + 15, MoneyPos.y, MoneyPos.z + 15), amount)
self.sparking = false
timer.Simple(math.random(250, 300), PrintMore, self)
end
function ENT:Use( activator, caller )
if !IsValid( activator ) then
return;
end
if activator != self.dt.owning_ent then
Notify(activator, 1, 4, "You're not the Owner of the MoneyPrinter." )
return
end
umsg.Start( "CurrentPaper" );
umsg.String( ""..self.CurPaper.."".."/"..self.MaxxPaper );
umsg.Float( 123.456 );
umsg.Long( 123456 );
umsg.Bool( false );
umsg.End();
--if not ply:IsUserGroup( "Silber" ) or not ply:IsUserGroup( "Admin" ) or not ply:IsUserGroup( "Gold" ) or not ply:IsUserGroup( "Platin" ) or not ply:IsUserGroup( "Diamant" ) then
-- Notify(activator, 1, 4, "You need to Be VIP/Silber/Gold/Platin or Diamant to Update your Money Printers!" )
-- return end
if self.MPLevel == 1 then
umsg.Start( "UpgradeMP", activator )
umsg.End()
elseif self.MPLevel == 2 then
umsg.Start( "UpgradeMP", activator )
umsg.End()
end
end
concommand.Add( "mps_upgrd", function( ply, cmd, args )
local tr = ply:GetEyeTraceNoCursor();
if ( tr and ValidEntity(tr.Entity) and tr.Entity:GetClass() == "vip_printer" ) then
local ent = tr.Entity;
if ( ent.dt.owning_ent != ply ) then
Notify(ply, 1, 4, "You're not the Owner of the MoneyPrinter." )
return;
end
if ent.MPLevel == 1 then
if not ply:CanAfford(1000) then
Notify(ply, 1, 10, "You can't afford it!")
return
end
ply:AddMoney(-1000)
ent:SetPos(ent:GetPos() + Vector(0,0,30))
ent:SetModel("models/props_lab/reciever_cart.mdl")
ent:PhysicsInit(SOLID_VPHYSICS)
ent:SetMoveType(MOVETYPE_VPHYSICS)
ent:SetSolid(SOLID_VPHYSICS)
ent.MPLevel = 2
Notify(ply, 1, 4, "Your Money Printer is now Level 2" )
ent.MaxxPaper = 30
local phys = ent:GetPhysicsObject()
if phys and phys:IsValid() then
phys:SetMass(150)
phys:EnableMotion(true)
end
return
end
if ent.MPLevel == 2 then
Notify(ply, 1, 4, "Your Money Printer is Maxed!" )
return
end
end
end );
concommand.Add( "mps_papr", function( ply, cmd, args )
local tr = ply:GetEyeTraceNoCursor();
if ( tr and ValidEntity(tr.Entity) and tr.Entity:GetClass() == "vip_printer" ) then
local ent = tr.Entity;
if not ply:CanAfford(500) then
Notify(ply, 1, 10, "You can't afford it!")
return
end
if ent.CurPaper >= ent.MaxxPaper then
Notify(ply, 1, 10, "Your Money printer cant handle more Paper.")
return
end
ply:AddMoney(-500)
ent.CurPaper = ent.CurPaper + 10
Notify(ply, 1, 4, "You have bought 10x P
Please use lua tags instead of HTML tags in the future.
Sorry, you need to Log In to post a reply to this thread.