Hey guys I am just wondering if anyone can help me out with this script, I have done everything right(according to my knowledge) and it just wont print any money.
Here is the script:
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include('shared.lua')
function ENT:Initialize()
self.Entity:SetModel( "models/props_lab/reciever01b.mdl" )
self.Entity:PhysicsInit(SOLID_VPHYSICS)
self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
self.Entity:SetSolid(SOLID_VPHYSICS)
self.Entity:SetColor(Color(127,111,63,255))
local phys = self.Entity:GetPhysicsObject()
if(phys:IsValid()) then phys:Wake() end
timer.Create( tostring(self.Entity), 18, 0, function( Pl ) self:giveMoney end)
timer.Create( tostring(self.Entity) .. "fuckafkfags", 750, 1, function()self:shutOff end)
timer.Create( tostring(self.Entity) .. "notifyoff", 700, 1, function()self:notifyPl end)
self.Entity:SetNWBool("sparking",false)
self.Entity:SetNWInt("damage",100)
self.Entity:SetNWInt("upgrade", 0)
local ply = self.Owner
ply:GetTable().maxBronzePrinter=ply:GetTable().maxBronzePrinter + 1
self.Inactive = false
self.NearInact = false
self.Entity:SetNWInt("power",0)
self.Payout = {950, "Bronze Money Printer"}
end
function ENT:giveMoney()
local ply = self.Owner
if(IsValid(ply) && !self.Inactive && self.Entity:IsPowered()) then
// ply:AddMoney( 25 );
local trace = { }
trace.start = self.Entity:GetPos()+self.Entity:GetAngles():Up()*15;
trace.endpos = trace.start + self.Entity:GetAngles():Forward() + self.Entity:GetAngles():Right()
trace.filter = self.Entity
local tr = util.TraceLine( trace );
local amount = math.random( 82, 110 )
if (self.Enitty:GetNWInt("upgrade")==4) then
amount = math.random( 400, 447)
elseif (self.Entity:GetNWInt("upgrade")==3) then
amount = math.random( 330, 377 )
elseif (self.Entity:GetNWInt("upgrade")==2) then
amount = math.random( 220, 274 )
elseif (self.Entity:GetNWInt("upgrade")==1) then
amount = math.random( 192, 220 )
end
local moneybag = ents.Create( "prop_moneybag" );
moneybag:SetModel( "models/notes.mdl" );
moneybag:SetPos( tr.HitPos );
moneybag:SetAngles(self.Entity:GetAngles())
moneybag:Spawn();
moneybag:SetColor(Color(200,255,200,255))
moneybag:SetMoveType( MOVETYPE_VPHYSICS )
moneybag:GetTable().MoneyBag = true;
moneybag:GetTable().Amount = amount
Notify( ply, 0, 3, "Bronze Printer Printed $" .. amount );
elseif (self.Inactive) then
Notify( ply, 4, 3, "A money printer is inactive, press use on it to make it active again." );
elseif !self.Entity:IsPowered() then
Notify(ply, 4, 3, "A money printer does not have enough power. Get a power plant.")
end
end
function ENT:shutOff()
local ply = self.Owner
self.Inactive = true
Notify( ply, 1, 3, "NOTICE: A MONEY PRINTER HAS GONE INACTIVE" );
Notify( ply, 1, 3, "PRESS USE ON IT TO CONTINUE GETTING MONEY" );
self.Entity:SetColor(Color(255,0,0,254))
end
function ENT:notifypl()
self.NearInact = true
local ply = self.Owner
Notify( ply, 4, 3, "NOTICE: A MONEY PRINTER IS ABOUT TO GO INACTIVE" );
Notify( ply, 4, 3, "PRESS USE ON IT TO PREVENT THIS" );
self.Entity:SetColor(Color(255,150,150,254))
end
function ENT:Use(activator,caller)
local ply = self.Owner
if (self.NearInact==true && activator==ply && self.Entity:GetNWBool("sparking")==false && ply:CanAfford(40)) then
ply:AddMoney( -40 )
self.NearInact = false
self.Entity:SetNWBool("sparking",true)
timer.Create( tostring(self.Entity) .. "resupply", 1, 1, function() self:Reload() end)
end
end
function ENT:Reload()
Notify(self.Owner, 0, 3, "Counterfeit money printer resupplied")
timer.Destroy( tostring(self.Entity) .. "fuckafkfags")
timer.Create( tostring(self.Entity) .. "fuckafkfags", 250, 1, function() self:shutOff() end)
timer.Destroy( tostring(self.Entity) .. "notifyoff")
timer.Create( tostring(self.Entity) .. "notifyoff", 200, 1, function() self:notifypl() end)
self.Inactive = false
self.NearInact = false
ply:AddMoney( -250 )
self.Entity:SetColor(Color(140, 120, 83, 254))
local drugPos = self.Entity:GetPos()
self.Entity:SetNWBool("sparking",false)
end
function ENT:Think()
if (IsValid(self.Owner)==false) then
self.Entity:Remove()
end
end
function ENT:OnRemove( )
timer.Destroy(tostring(self.Entity))
timer.Destroy(tostring(self.Entity) .. "fuckafkfags")
timer.Destroy(tostring(self.Entity) .. "notifyoff")
local ply = self.Owner
if IsValid(ply) then
ply:GetTable().maxBronzePrinter=ply:GetTable().maxBronzePrinter - 1
end
end
//Made by: Warrior Gaming
Basically, I have tried pretty much everything to my knowledge, now I am asking for some help which was my last resort.
Thanks in advance, Warrior Gaming