I did a system to check cooldowns.
The cooldown of the ability needed to be registred tho. (i.e.)
When a player cast an ability call RegisterCooldown(unit, abilityId, time)
and you could GetCooldownRemaining(unit, abilityId); returns real, etc..
Here's the link. I didn't update it tho. It's old and could be re-done. It's just to show you how I've did it.