Time::advanceClockTimeTo
Client-Side Function
JavaScript Syntax
Summary
Sets the in-game clock to a specific time by advancing it to the specified hour, minute, and second.
Syntax
mp.game.time.advanceClockTimeTo(hour, minute, second);
Required Parameters
- hour: int - The hour to set (0-23).
- minute: int - The minute to set (0-59).
- second: int - The second to set (0-59).
Return Value
- undefined - This function does not return a value.
Example
The following example sets the time to a specified value via event trigger:
mp.events.add("settime", (player, _, hour, minute, second) => {
hour = parseInt(hour) || 0;
minute = parseInt(minute) || 0;
second = parseInt(second) || 0;
mp.game.time.advanceClockTimeTo(hour, minute, second);
mp.gui.chat.push(`The time has been set to ${hour}:${minute}:${second}.`);
});