Create a cooldown on lua

So, i want to make sprint enabled for donators on ttt, though not infinite
I want it to have a cooldown, what lua code would i need for that? also how could i add the cooldown meter to the hud?

I will be using the USE key for sprint since shift is team chat

Why in gods name would you make shift team chat. That’s the sprint key in pretty much every fps game I have played…

I didn’t make shift team chat, the maker of ttt did?

Change the team chat to something else, such as holding T. Then use shift for sprint. To have a “cooldown” for sprint, I’d recommend coding a stamina system. From there, you should code it to have vars that can be changed such as:

[lua]// While sprinting, how much stamina is lost per tick
PLAYER_STAMINA_RUN_LOSS = 0.1;

// How much stamina lost when jumping
PLAYER_JUMP_STAMINA_LOSS = 5;

// How much stamina to regain while walking normally
PLAYER_STAMINA_MOVE_GAIN = 0.01;

// How much stamina to regain when standing still
PLAYER_STAMINA_STAND_GAIN = 0.10;

// How much stamina to regain when crouching ( ow, this hurts )
PLAYER_STAMINA_CROUCH_GAIN = 0.025;[/lua]

Those are some, but not all of my vars, but they should be enough to give you an idea of some of the logic.