Question about timers..
#1

With a timer, how would I check if their under the time, or get their time, ( For ex: A race ) so when they pass the last checkpoint it would say like You've finished the race in xxx.xxx seconds, (I'm trying to work more with timers and things.)
Reply
#2

Timers are used to run something after a fixed amount of time. If you want to calculate the time between 2 points you shoulden't use timers but tick counts.
For example:

pawn Код:
public OnGameModeInit() {
    new tick1 = GetTickCount(); // Get the time in milliseconds (for example when he enters the checkpoint)
    // Do all your stuff here
    new tick2 = GetTickCount(); // Get the time again in milliseconds (for example when he enters the next checkpoint)

    new difference = tick2 - tick1; // new time - old time = difference in time (example: time between checkpoints)
    printf("The difference between tick1 and tick2 is %d milliseconds", difference);
}
Hope that helped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)