SetMinuteDuration: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Replace to predefined variables.)
 
(3 intermediate revisions by 3 users not shown)
Line 9: Line 9:


===Required Arguments===
===Required Arguments===
*'''milliseconds''': the new duration of an ingame minute
*'''milliseconds''': the new duration of an ingame minute, accepted values 0 - 2147483647.


===Returns===
===Returns===
Line 24: Line 24:
     setMinuteDuration(60000)
     setMinuteDuration(60000)
end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), resourceStart)
addEventHandler("onResourceStart", resourceRoot, resourceStart)
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>

Latest revision as of 23:14, 11 January 2023

Sets the real-world duration of an ingame minute. The GTA default is 1000.

Syntax

bool setMinuteDuration ( int milliseconds )

Required Arguments

  • milliseconds: the new duration of an ingame minute, accepted values 0 - 2147483647.

Returns

Returns true if successful, false otherwise.

Example

This example will make the ingame time correspond to the real-world time of the server.

Click to collapse [-]
Server
function resourceStart()
    local realtime = getRealTime()

    setTime(realtime.hour, realtime.minute)
    setMinuteDuration(60000)
end
addEventHandler("onResourceStart", resourceRoot, resourceStart)

See Also