Skip to main content

Time::addToClockTime

Client-side function

JavaScript​

Summary​

Adds the specified amount of time to the in-game clock.

Syntax​

mp.game.time.addToClockTime(hours, minutes, seconds);

Required Parameters​

  • hours: int - The number of hours to add.
  • minutes: int - The number of minutes to add.
  • seconds: int - The number of seconds to add.

Return Value​

  • undefined - This function does not return a value.

Example​

This example demonstrates adding time to the in-game clock via event.

mp.events.add("addtime", (player, _, hours, minutes, seconds) => {
hours = parseInt(hours) || 0;
minutes = parseInt(minutes) || 0;
seconds = parseInt(seconds) || 0;

mp.game.time.addToClockTime(hours, minutes, seconds);
mp.gui.chat.push(`Added ${hours} hours, ${minutes} minutes, and ${seconds} seconds to the clock.`);
});