How can i do a timer + hit ent? it's for empty crate.



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
						//Not the same
						return
					end
				else
					self.settype = true
				end
				
				self.Entity.dt.contents = k
				self.Entity.dt.count = self.Entity.dt.count + 1
				hitEnt:Remove()
				break
			end
		end
	end
end

I need help with this i want the weapon join to the shipment (this do okey) but this is so fast so i cant grab the weapon i was thinking in give a timer for like 5 seconds but i dont know how to do it, i try with simple.timer and create.timer but dont work help.

  • Sorry for my english!

if ( hitEnt:GetCreationTime( ) - CurTime( ) ) > 5 then
  self.dt.contents = k
  self.dt.count = self.dt.count + 1
  hitEnt:Remove( )
end

That might do what you want.

Thanks but i think is bugged with the curtime cuz dont work

I got my order backwards:


if ( CurTime( ) - hitEnt:GetCreationTime( ) ) > 5 then

It was always <= 0 so nothing was going to happen.

Good Job Man <3 Solved