Darkrp Searchable Dumpster Timer issue

So, I used a workshop searchable dumpster, its timer is broken, it will work sometimes, but will either get stuck on its first second or last second of the timer. Here’ what I have so far.

cl_init.lua



include("shared.lua")

function ENT:Initialize()
end


function ENT:Draw()
	self:DrawModel()

	local pos = self:GetPos()
	local ang = self:GetAngles()
	local Ang = self:GetAngles()
	local Pos = self:GetPos()
	
	surface.SetFont("HUDNumber5")
	local TxtWidth = surface.GetTextSize("Dumpster")
	
	cam.Start3D2D(pos + Vector(0, 0, 50), ang + Angle(0, 90, 90), 0.11)
		draw.SimpleText("Dumpster", "HUDNumber5", 0, -70, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)

	cam.End3D2D()
	
	cam.Start3D2D(Pos + Ang:Up() * 10.7, Ang, 0.16)

	cam.End3D2D()
	
	if self:GetDTInt(0) > 0 then
		surface.SetFont("HUDNumber5")
		local TxtWidth2 = surface.GetTextSize(string.FormattedTime(self:GetDTInt(0), "%01i:%02i"))
	
		cam.Start3D2D(pos + Vector(0, 0, 60), ang + Angle(0, 90, 90), .5)
			draw.WordBox(0, -28, 10, string.FormattedTime(self:GetDTInt(0), "%01i:%02i"), "HUDNumber5", Color(33, 255, 0, 0), Color(255,255,255,255))
		cam.End3D2D()
	end
end

function ENT:Think()
end


function ENT:Think()
end


Init.lua



AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")

local cooldown = 5

local items = { -- Edit props here
	Props = {
		"models/props_c17/BriefCase001a.mdl",
		"models/props_c17/playgroundTick-tack-toe_block01a.mdl",
		"models/props_combine/breenclock.mdl",
		"models/props_junk/garbage_newspaper001a.mdl"

	},
	
	Guns = { -- Please, add your own guns here, since ill use the default DarkRP Weapons
		"weapon_deagle2",
		"weapon_fiveseven2",
		"weapon_glock2",
		"weapon_p2282",
		"weapon_mac102",
		"weapon_baton",
		"darkrp_kunlockpick",
		"weapon_ak472",
		"weapon_mp52",
		"weapon_m42",
		"weapon_pumpshotgun2",
		
		
		
	},
	
	Entities = { -- As usual, only default stuff will be used! Edit this!
		""
	}
}

local allowedjobs = {
	TEAM_HOBO

}



function ENT:Initialize()
	self:SetModel("models/props_junk/TrashDumpster01a.mdl")
	self:SetColor(Color(79, 60, 10, 255))
	self:PhysicsInit(SOLID_VPHYSICS)
	self:SetMoveType(MOVETYPE_VPHYSICS)
	self:SetSolid(SOLID_VPHYSICS)
	self:SetUseType(SIMPLE_USE)
	local phys = self:GetPhysicsObject()
	phys:Wake()
end


	
function ENT:GiveItems()
	local spawnpos = self:GetPos() + Vector(0, 0, 50)
	
	for i = 1, math.random(2, 5) do
		if math.random(1, 100) <= 3 then
			local gun = ents.Create(table.Random(items["Guns"]))
			gun:SetPos(spawnpos)
			gun:Spawn()
		elseif math.random(1, 100) <= 10 then
			local en = ents.Create(table.Random(items["Entities"]))
			en:SetPos(spawnpos)
			en:Spawn()
		elseif math.random(1, 100) <= 100 then
			local prop = ents.Create("prop_physics")
			prop:SetModel(table.Random(items["Props"]))
			prop:SetPos(spawnpos)
			prop:Spawn()
			
			timer.Simple(60, function()
				if prop:IsValid() then
					prop:Remove()
				end
			end)
		end
	end
end

function ENT:AcceptInput(s,e,p)
	if self:GetDTInt(0) > 0 then return end
	if table.HasValue(allowedjobs, p:Team()) then
		self:SetDTInt(0, cooldown)
		self:GiveItems()
		timer.Create("cooldown " ..self:EntIndex(), 1, 10, function()
			self:TimerRemove()
		end)
	else
		p:ChatPrint("You don't have the right job to use this.")
	end
end

function ENT:TimerRemove()
	self:SetDTInt(0, self:GetDTInt(0) - 1)
	
	if self:GetDTInt(0) <= 0 then
		if timer.Exists("DTime " ..self:EntIndex()) then
			timer.Destroy("DTime " ..self:EntIndex())
		end
	end
end


And shared.lua



ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Searchable Dumpster"
ENT.Author = "Razor Sharp"
ENT.Spawnable = true

function ENT:SetupDataTables()
	self:DTVar("Int", 0, "cooldown")
end


Thanks for any help! :smiley:

I would help, but I’d rather be an ass in this case and show you something you have appearently missed.

http://puu.sh/bbbms/c461237f84.png