Skip to main content

Time::pauseClock

Client-side function

JavaScript​

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.");
});