Time::addToClockTime

From RAGE Multiplayer Wiki
Revision as of 12:35, 10 December 2024 by Shr0x (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Client-Side
Function

 JavaScript



JavaScript Syntax


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


See Also