time_source_get_state

This function returns the state of the given Time Source.

 

Syntax:

time_source_get_state(id);

ArgumentTypeDescription
idTime SourceThe Time Source to get the state of

 

Returns:

Time Source State Constant

 

Example:

if (keyboard_check_pressed(vk_space))
{
    var _state = time_source_get_state(time_source);

    if (_state == time_source_state_active)
    {
        time_source_pause(time_source);
    }
    else if (_state == time_source_state_paused)
    {
        time_source_start(time_source);
    }
}

When the Space key is pressed, this code will get a Time Source's state.

When the state is active, it will pause the Time Source, and when it's paused, it will resume it.