Time::pauseClock: Difference between revisions
(yay) |
No edit summary |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
{{ClientsideJsFunction}} | |||
{{JSContainer| | |||
==Syntax== | === Summary === | ||
<syntaxhighlight lang="javascript">mp.game.time.pauseClock(toggle);</syntaxhighlight> | Pauses or resumes the in-game clock based on the specified toggle. | ||
=== Required | |||
*'''toggle:''' Boolean | === Syntax === | ||
===Return | <syntaxhighlight lang="javascript"> | ||
*''' | mp.game.time.pauseClock(toggle); | ||
==Example== | </syntaxhighlight> | ||
=== Required Parameters === | |||
* '''toggle:''' {{RageType|Boolean}} - Pass `true` to pause the clock and `false` to resume it. | |||
=== Return Value === | |||
* '''undefined''' - This function does not return a value. | |||
=== Example === | |||
This example pauses the in-game clock when a event is triggered. | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
// | mp.events.add("pauseclock", () => { | ||
mp.game.time.pauseClock(true); // Pauses the clock | |||
mp.gui.chat.push("The in-game clock is now paused."); | |||
}); | |||
mp.events.add("resumeclock", () => { | |||
mp.game.time.pauseClock(false); // Resumes the clock | |||
mp.gui.chat.push("The in-game clock is now running."); | |||
}); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See | }} | ||
{{ | |||
== See Also == | |||
{{Time_functions_c}} | |||
[[Category:Clientside API]] | [[Category:Clientside API]] | ||
[[Category:Time API]] | |||
[[Category:TODO: Example]] | [[Category:TODO: Example]] | ||
Latest revision as of 12:34, 10 December 2024
Client-Side Function
JavaScript Syntax
Summary
Pauses or resumes the in-game clock based on the specified toggle.
Syntax
mp.game.time.pauseClock(toggle);
Required Parameters
- toggle: Boolean - Pass `true` to pause the clock and `false` to resume it.
Return Value
- undefined - This function does not return a value.
Example
This example pauses the in-game clock when a event is triggered.
mp.events.add("pauseclock", () => {
mp.game.time.pauseClock(true); // Pauses the clock
mp.gui.chat.push("The in-game clock is now paused.");
});
mp.events.add("resumeclock", () => {
mp.game.time.pauseClock(false); // Resumes the clock
mp.gui.chat.push("The in-game clock is now running.");
});