Get Amount

Hello there i am makeing a little code but i am wanteing to make is to that when i put an entity into this safe as such that it gathers the amount off of it the entity being spawend_money so ima put the code and you can tell me whats to do

thx for ur time

[lua]function ENT:Initialize()
util.PrecacheSound(“common/wpn_hudoff.wav”)
util.PrecacheSound(“items/ammo_pickup.wav”)
util.PrecacheSound(“common/null.wav”)
self.Entity:SetModel( “models/props_c17/oildrum001.mdl”)
– self.Entity:SetModel( “models/props_junk/metalgascan.mdl”)
self.Entity:PhysicsInit( SOLID_VPHYSICS ) // Make us work with physics,
self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) // after all, gmod is a physics
self.Entity:SetSolid( SOLID_VPHYSICS ) // Toolbox
local phys = self.Entity:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
self.max = 15 --max number of items per pack, fiddle with this all you like

self.contains = {}	
self.used = false
self.pickedup = false
self.player = nil
self.touched = false
self.Entity:SetNetworkedInt( "number", 0 )

end

function ENT:SpawnFunction( ply, tr )

if ( !tr.Hit ) then return end

local SpawnPos = tr.HitPos + tr.HitNormal * 16

local ent = ents.Create( "sent_backpack" )
ent:SetPos( SpawnPos )
ent:Spawn()
ent:Activate()
return ent

end

–for getting things in and out of, currently you can do this while it’s on someones back. Pickpocketing anyone?
function ENT:Use(activator)
if (!self.used) then
local p = self.Entity:GetNetworkedInt( “number”)
if (p > 0) then
p = p - 1
self.Entity:SetNetworkedInt( “number”, p )
local ang = self.Entity:GetAngles()
local SpawnPos = self.Entity:GetPos() + self.Entity:GetForward() * -20
SpawnPos.z = SpawnPos.z + 70
local ent = ents.Create( self.contains[1].class )
ent:SetModel(self.contains[1].model)
ent:SetPos( SpawnPos )
ent:SetAngles(ang)
ent:Spawn()
ent:Activate()
self.contains[1].tab.Entity = ent
ent:SetTable(self.contains[1].tab)
table.remove(self.contains,1)
local phys = ent:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
self.used = true
timer.Simple(0.3,unuse,self)
end
end
end

function unuse(self)
self.used = false
end

[/lua]

[lua]
–Put things into it with the physics gun, or pick it up by walking into it
function ENT:Touch(activator)
if (!self.touched) then
local p = self.Entity:GetNetworkedInt( “number”)
local r = activator:GetClass()
if (activator:IsPlayerHolding( )) and (p < self.max) then
local m = activator:GetModel()
if (util.IsValidModel(m)) then
local g = {}
if activator:GetClass() == “spawned_money” then g.class = r else return end
g.model = m
g.tab = activator:GetTable()

table.insert(self.contains, g)
activator:Remove()
p = p + 1
self.Entity:SetNetworkedInt( "number", p )
self.touched = true
timer.Simple(0.3,untouch,self)
else
--play error sound if the model doesn't work, it happens sometimes but this way we don't loose the prop or get an annoying error marker
self.Entity:EmitSound( "common/null.wav", 500, 100 )
end
elseif (p == self.max) then
self.Entity:EmitSound( "common/null.wav", 500, 100 )
end
if (activator:IsPlayer()) then
local a = ents.FindByClass("sent_backpack")
local found = false
local n = nil
for k,v in ipairs(a) do
if (v.player == activator) then
found = true
end
end
if (!found) then  end

end
end
end
function untouch(self)
self.touched = false
end [/lua]