Time::setClockTime: Difference between revisions
No edit summary |
|||
| Line 10: | Line 10: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
// | //Realtime | ||
const date = new Date(); | |||
function syncTime() { | |||
mp.game.time.setClockTime(date.getHours(), date.getMinutes(), date.getSeconds()); | |||
} | |||
setInterval(syncTime, 2000); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See also== | ==See also== | ||
{{Time_s_function_c}} | {{Time_s_function_c}} | ||
Revision as of 08:14, 13 March 2018
SET_CLOCK_TIME(12, 34, 56);
Syntax
mp.game.time.setClockTime(hour, minute, second);
Required Arguments
- hour: int
- minute: int
- second: int
Return value
- Undefined
Example
//Realtime
const date = new Date();
function syncTime() {
mp.game.time.setClockTime(date.getHours(), date.getMinutes(), date.getSeconds());
}
setInterval(syncTime, 2000);