23.09.2013, 03:49
You can actually use GetTickCount() to calculate the remaining time without using any timers at all.
Example:
Also you should check, if your time variable has been ever set, before checking it for being expired or calculating the remaining time.
Example:
pawn Код:
// When you've triggered some event, for example picking up a pickup
my_time = GetTickCount();
// Check, if something has expired, for example the player is allowed to pick a pickup again (5000 means 5000 milliseconds, also 5 seconds)
if(GetTickCount() >= my_time+5000)
{
}
// Calculate the remaining time in milliseconds
remaining_time = (my_time+5000)-GetTickCount();
