Help with 2 empty boxes make 1 empty box and weapon + empty box dont work

Hello guys,

History of Point:
Red: Empty Shipment
Blue: Weapon


function ENT:StartTouch(hitEnt)	
 	if hitEnt:IsValid() and hitEnt:GetClass() == "spawned_weapon" then
		for k,v in pairs(CustomShipments) do
			if v.entity == hitEnt:GetTable().weaponclass then
				if self.settype == true then
					if self.Entity.dt.contents == k then
					else
						return
					end
				else
					self.settype = true
				end
				if ( CurTime( ) - hitEnt:GetCreationTime( ) ) > 3 then
					self.dt.contents = k
					self.dt.count = self.dt.count + 1
					hitEnt:Remove()
				end
				break
			end
		end
	end
end

So if i put empty shipment + another empty shipment this go to one so, i try with diferent ways just one way left but i dont know how to identify the empty one…

(i have a idea with v.entity ==… but i dont know how to finish it)

and the weapon problem, omg this made me mad!! because sometimes work fine! but sometimes NO, is like (times: dont work: 70%, work:30%)

Thanks and peace!

Post in the darkrp help thread if you need help with DarkRP.
http://forum.facepunch.com/showthread.php?t=1289320

this is not only for darkrp man, is a general code… u can use it in sandbox to…

Ah sorry then, just looked a lot like the code the darkrp shipment stuff is using.



function ENT:StartTouch(hitEnt)	
    if not IsValid(hitEnt) or not IsValid(self) then return end
    if self:GetClass() == "spawned_shipment" and hitEnt:GetClass() == "spawned_shipment" then
        if CustomShipments[self:Getcontents()].name or CustomShipments[self:Getcontents()].name then return end
        hitent:Remove()
    end
    if self:GetClass() == "spawned_shipment" and hitEnt:IsWeapon() and not CustomShipments[v:Getcontents()].name then
        local f = false
        for i, tbl in pairs(CustomShipments) do
            if tbl.entity == hitEnt then
                f = i
                break
            end
        end
        if not f then return end
        self:Setcontents(f)
        self.Setcount(1)
    end
end


Not sure if this will work, haven’t tested.

so u mean i do another start touch? that dont eat a lot resources?