Timers in GTA 2 Coding

Timers are used in a number of missions in GTA 2 but are a little tricky sometimes to do.

First of all, you need to create the timer. This is done with the TIMER_DATA command. An example would be:

TIMER_DATA missiontimer01

Call the missiontimer01 whatever you like. Now, this timer won’t do anything. For a basic timer, you now have to add the DISPLAY_TIMER command for it to show on screen. So, to show it onscreen, use the following command:

DISPLAY_TIMER ( timer name , count down )

The timer name is a previously declared timer, and the count down is what it should count down from in real seconds. So, our one could be like:

DISPLAY_TIMER ( missiontimer01 , 30 )

This would show our timer with 30 seconds on the clock. And that’s it for a basic timer. For more complex features, they include clearing the timer and adding time to a timer (below).

Clearing a Timer

To clear a timer, call up the CLEAR_TIMER command. If we wanted to remove the one above, the code would look like this:

CLEAR_TIMER ( missiontimer01 )

Doesn’t get much easier than that!

Add Time to a Timer

To extend a timer, for example when you have killed someone, use this command:

ADD_TIME_TO_TIMER (timer name, seconds added )

If I wanted to add 30 seconds to our timer, I would simply use this:

ADD_TIME_TO_TIMER ( missiontimer01 , 30 )

(Originally written by Chris “Pyro” Hockley and formatted by Ben “Cerbera” Millard with full permission.)