Jump to page content
English English  Polish Polish  Dutch Dutch  Russian Russian  German German  Hungarian Hungarian  Norwegian Norwegian  Swedish Swedish  Finnish Finnish  Romanian Romanian  Spanish Spanish  Portuguese Portuguese  Latvian Latvian 
Homepage
Home
Register
Login

Resources
Forum
Wiki
Servers

rssTime sync (servertimesync)

Category:script
Author(s):IIYAMA12
Downloads:132
Rate:You need to be logged in to vote
Rating:None (0)
Description:
This resource is for (advanced) scripters and other resources that make use of this resource.

The resource allows you to sync server the timestamp value in milliseconds. This is useful for animations you want to sync with other players. Or just a regular clock.

Why does server time sync matter? You want to give your players a great experience without connection issues. You want to reduce communication between the server and client as much as possible to achieve that. When time can decide the state of your animations(like for example a rotating car or a flying aircraft), you do not need the server to constantly update these.

The export getServerTime function returns the timestamp in milliseconds if available, else it returns false.


Example:
local timeNow = exports.servertimesync:getServerTime()
if timeNow then

local currentRotation = ((timeNow % 10000) / 10000) * 360
-- Rotate 0-359 every 10 seconds.

end





1.0.2 (I wrote the changes in to the wrong input field... :/)
- Removed resync based on timestamp. Once the timestamp is fixed, it will only rely on tickCount.
- Fixed incorrect time value for event "onServerTimeAvailable", which was given a value in seconds and not in milliseconds.
- Optimise API speed with variable localization.
- Add debug mode, which allows you to see the time desync value between the server and the client.
- Increased the server time refresh updates from 5 min to 10 min.
...

(more)

Download latest version | Report

Version history

Version Publish Date Changes
1.1.0 2022-01-12 19:57:15 Added the following event "onServerTimeInitialized", so that other resources also know when the server time is available. Download
1.0.2 2022-01-03 17:39:23 Download
1.0.1 2022-01-02 12:37:16 Edited example (wrong resource name) Download
1.0.0 2022-01-02 12:23:05 First public release Download