From Multi Theft Auto: Wiki

This function sets the current GTA time to the given time.


bool setTime ( int hour, int minute )

Required Arguments

  • hour: The hour of the new time (range 0-23).
  • minute: The minute of the new time (range 0-59).


Returns true if the new time was successfully set, false otherwise.


Click to collapse [-]
Example 1

This serverside function sets the time and notifies players.

function setTimeAndNotify( hour, minute )
	-- set the time first
	setTime ( hour, minute )
	-- format a notification message, adding leading zeros (e.g. 12:03 instead of 12:3)
	local notifyMessage = string.format("Time changed to %02d:%02d!", hour, minute)
	-- output the message
	outputChatBox ( notifyMessage )
Click to collapse [-]
Example 2

This example freeze the time.

addEventHandler( 'onClientRender', getRootElement( ),
    function( )
        setTime( 1, 0 )

See Also