Time::setClockDate: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
{{ClientsideJsFunction}} | |||
{{JSContainer| | |||
== | === Summary === | ||
Sets the in-game date by specifying the day, month, and year. This function is useful for synchronizing the game environment with custom timelines or events. | |||
=== Syntax === | |||
=== | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
mp.game.time.setClockDate(day, month, year); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See | |||
{{ | === Required Parameters === | ||
* '''day:''' {{RageType|int}} - The day of the month (1–31). | |||
* '''month:''' {{RageType|int}} - The month (1–12). | |||
* '''year:''' {{RageType|int}} - The year to set. | |||
=== Return Value === | |||
* '''undefined''' - No value is returned. | |||
=== Example === | |||
This example sets the in-game date to January 1st, 2025: | |||
<syntaxhighlight lang="javascript"> | |||
mp.game.time.setClockDate(1, 1, 2025); | |||
mp.gui.chat.push("The in-game date has been updated to 01/01/2025."); | |||
</syntaxhighlight> | |||
}} | |||
== See Also == | |||
{{Time_functions_c}} | |||
[[Category:Clientside API]] | [[Category:Clientside API]] | ||
[[Category:Time API]] | [[Category:Time API]] | ||
[[Category:TODO: Example]] | [[Category:TODO: Example]] | ||
Latest revision as of 12:42, 10 December 2024
Client-Side Function
JavaScript Syntax
Summary
Sets the in-game date by specifying the day, month, and year. This function is useful for synchronizing the game environment with custom timelines or events.
Syntax
mp.game.time.setClockDate(day, month, year);
Required Parameters
- day: int - The day of the month (1–31).
- month: int - The month (1–12).
- year: int - The year to set.
Return Value
- undefined - No value is returned.
Example
This example sets the in-game date to January 1st, 2025:
mp.game.time.setClockDate(1, 1, 2025);
mp.gui.chat.push("The in-game date has been updated to 01/01/2025.");