IsTimerPaused: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with {{Server client function}} __NOTOC__ {{New feature/item|3.0161|1.6.0|22701| This function allows you to check whether a timer is paused. }} ==Syntax== <syntaxhighlight lang="lua"> bool isTimerPa...)
 
mNo edit summary
 
Line 9: Line 9:
bool isTimerPaused ( timer theTimer )
bool isTimerPaused ( timer theTimer )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[timer]]:paused||}}
{{OOP|||paused}}
===Required Arguments===  
===Required Arguments===  
*'''theTimer:''' The [[timer]] you wish to check.
*'''theTimer:''' The [[timer]] you wish to check.

Latest revision as of 10:29, 6 September 2024

ADDED/UPDATED IN VERSION 1.6.0 r22701:

This function allows you to check whether a timer is paused.

Syntax

bool isTimerPaused ( timer theTimer )

OOP Syntax Help! I don't understand this!

Variable: .paused


Required Arguments

  • theTimer: The timer you wish to check.

Returns

Returns true if the timer is currently paused, false if not or if no such timer existed.

Example

This example pauses all currently running timers and resumes all currently paused timers from this resource.

-- Get a table of all current timers from this resource
local timers = getTimers ( )
-- Loop through the table of timers
for timerIndex, timerValue in ipairs( timers ) do
    -- check if each timer is currently paused
    local isPaused = isTimerPaused( timerValue )
    -- pause or resume each timer based on its current state
    setTimerPaused ( timerValue, not isPaused )
end

See Also