World::time.set

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

Server-Side
Function

Js.png JavaScript



This function sets time.

JavaScript Syntax
Jslogo.png

Syntax

mp.world.time.set(hour, minute, second);

Required Arguments

  • *hour: Int (0 - 23)
  • *minute: Int (0 - 59)
  • *second: Int (0 - 59)

Example

In this example, we will set a custom time via command (e.g. 12:20:10 -> /time 12 20 10).

Server-Side
mp.events.addCommand('time', (player, fulltext, hour, minute, second) => mp.world.time.set(hour, minute, second));

You can also set time by changing its properties and then call 'set' function without parameters.

Server-Side
mp.events.addCommand('lunchtime', (player)) => {
    mp.world.time.hour = 16;
    mp.world.time.minute = 0;
    mp.world.time.second = 0;
    mp.world.time.set();
});


See Also