Upgradeable moneyprinter

I Tried to fix the error from this moneyprinter http://www.garrysmod.org/downloads/?a=view&id=124347 from [Gmod-Net.] UnR
I press (upgrade) nothing happens )= same for (buy 10x paper)
**
Init.lua**

-- 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 Paper." ) 
--Notify(ply, 1, 4, "Update Comming soon!!!" ) 
end
end );

concommand.Add( "mps_repir", function( ply, cmd, args )

--local Teamm = team.GetName(ply:Team())

	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 not ply:CanAfford(1250) then
		Notify(ply, 1, 10, "You can't afford it!")
	return
	end
	
	ply:AddMoney(-1250)
	
	ent.PrintWNPaper = 0
	
	Notify(ply, 1, 10, "Your Money printer has been Repaired! Your printig now the max Amount.")
			
   end
end);


function ENT:Think()
	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

cl_init.lua

include("shared.lua")

function ENT:Initialize()
end

function ENT:Draw()
	self.Entity:DrawModel()
	
	local Pos = self:GetPos()
	local Ang = self:GetAngles()
	
	local owner = self.dt.owning_ent
	
	surface.SetFont("HUDNumber5")
	local TextWidth = surface.GetTextSize("Money printer")
	
	Ang:RotateAroundAxis(Ang:Up(), 90)
	
	cam.Start3D2D(Pos + Ang:Up() * 30, Ang, 0.11)
		draw.WordBox(2, -TextWidth*0.5, -15, "VIP Money printer", "HUDNumber5", Color(30,144,255, 100), Color(255,255,255,255))
	cam.End3D2D()
end

usermessage.Hook( "UpgradeMP", function()

local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 350, 150 )
DermaPanel:SetTitle( "Money Printer Menu" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( false )
DermaPanel:Center()
DermaPanel:MakePopup()
 
local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) 
DermaButton:SetText( "Upgrade" )
DermaButton:SetPos( 15, 115 )
DermaButton:SetSize( 70, 25 )
DermaButton.DoClick = function ()
RunConsoleCommand("mps_upgrd")
DermaPanel:Remove()
end

local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) 
DermaButton:SetText( "Buy 10x Paper" )
DermaButton:SetPos( 100, 115 )
DermaButton:SetSize( 90, 25 )
DermaButton.DoClick = function ()
RunConsoleCommand("mps_papr")
DermaPanel:Remove()
end

local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) 
DermaButton:SetText( "Cancel" )
DermaButton:SetPos( 265, 115 )
DermaButton:SetSize( 70, 25 )
DermaButton.DoClick = function ()
DermaPanel:Remove()
end

local myLabel = vgui.Create("DLabel", DermaPanel)
myLabel:SetPos(30,50) 
myLabel:SetColor(Color(255,255,255,255)) 
myLabel:SetFont("default")
myLabel:SetText("Really want to Update MoneyPrinter to Level 2 for:") 
myLabel:SizeToContents() 

local myLabel = vgui.Create("DLabel", DermaPanel)
myLabel:SetPos(86,25) 
myLabel:SetColor(Color(255,255,255,255)) 
myLabel:SetFont("default")
myLabel:SetText("Welcome to the Money Printer Menu") 
myLabel:SizeToContents() 

local myLabel = vgui.Create("DLabel", DermaPanel)
myLabel:SetPos(280,50) 
myLabel:SetColor(Color(0,255,0,255)) 
myLabel:SetFont("default")
myLabel:SetText("1000$") 
myLabel:SizeToContents() 

local myLabel = vgui.Create("DLabel", DermaPanel)
myLabel:SetPos(315,50) 
myLabel:SetColor(Color(255,255,255,255)) 
myLabel:SetFont("default")
myLabel:SetText("?") 
myLabel:SizeToContents() 

local myLabel = vgui.Create("DLabel", DermaPanel)
myLabel:SetPos(170,67) 
myLabel:SetColor(Color(255,255,255,255)) 
myLabel:SetFont("default")
myLabel:SetText("or") 
myLabel:SizeToContents() 

local myLabel = vgui.Create("DLabel", DermaPanel)
myLabel:SetPos(125,85) 
myLabel:SetColor(Color(255,255,255,255)) 
myLabel:SetFont("default")
myLabel:SetText("Buy 10x Paper for:") 
myLabel:SizeToContents() 

local myLabel = vgui.Create("DLabel", DermaPanel)
myLabel:SetPos(220,85) 
myLabel:SetColor(Color(0,255,0,255)) 
myLabel:SetFont("default")
myLabel:SetText("500$") 
myLabel:SizeToContents()

local myLabel = vgui.Create("DLabel", DermaPanel)
myLabel:SetPos(275,5) 
myLabel:SetColor(Color(255,255,255,255)) 
myLabel:SetFont("default")
myLabel:SetText("Paper:") 
myLabel:SizeToContents()

usermessage.Hook( "CurrentPaper", function(data)
local myLabel = vgui.Create("DLabel", DermaPanel)
myLabel:SetPos(310,5) 
myLabel:SetColor(Color(0,255,255,255)) 
myLabel:SetFont("default")
myLabel:SetText(data:ReadString()) 
myLabel:SizeToContents()
end);

end );


function ENT:Think()
end

[editline]6th July 2012[/editline]

I’ve found an error I had to replace Notify with GAMEMODE:Notify

Please use lua tags instead of HTML tags in the future.