Time::addToClockTime: 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.addToClockTime(hours, minutes, seconds);</syntaxhighlight> | Adds the specified amount of time to the in-game clock. | ||
=== Required | |||
*'''hours:''' int | === Syntax === | ||
*'''minutes:''' int | <syntaxhighlight lang="javascript"> | ||
*'''seconds:''' int | mp.game.time.addToClockTime(hours, minutes, seconds); | ||
===Return | </syntaxhighlight> | ||
*''' | |||
==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"> | ||
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 | }} | ||
{{ | |||
== 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 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.`);
});