Giving full health on ENT:Use()

Hey guys,

Basically want it so when someone presses E on my entity they get full health, but they are only able to use it every 300 seconds. Could someone point me in the right direction?

[lua]local lastused = setmetatable({}, {__mode = “k”});
function ENT:Use(act, caller)
if act:IsPlayer() then
lastused[act] = lastused[act] or math.huge;
if lastused[act] + 300 >= CurTime() then
lastused[act] = CurTime();
act:SetHealth(act:GetMaxHealth());
end
end
end[/lua]

Something like that would do. I’m in a bit of a rush so it may not work.