Time::addToClockTime: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{ClientsideJsFunction}}
{{JSContainer|


==Syntax==
=== Summary ===
<syntaxhighlight lang="javascript">time.addToClockTime(hours, minutes, seconds);</syntaxhighlight>
Adds the specified amount of time to the in-game clock.
=== Required Arguments ===
 
*'''hours:''' int
=== Syntax ===
*'''minutes:''' int
<syntaxhighlight lang="javascript">
*'''seconds:''' int
mp.game.time.addToClockTime(hours, minutes, seconds);
===Return value===
</syntaxhighlight>
*'''Undefined'''
 
==Example==
=== Required Parameters ===
* '''hours:''' {{RageType|int}} - The number of hours to add.
* '''minutes:''' {{RageType|int}} - The number of minutes to add.
* '''seconds:''' {{RageType|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.
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
todo
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.`);
});
</syntaxhighlight>
</syntaxhighlight>
==See also==
}}
{{Time_function_c}}
 
== 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:35, 10 December 2024

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