Code Monkey home page Code Monkey logo

vina-timesync's Introduction

Vina TimeSync

FEATURES

  • Perfect Client & Server time synchronization
  • Can configure resource with convars
  • Can start server with a custom time rate
  • Can pause time serverside
  • Time Persistence when rebooting
  • Standalone Resource
  • Can use Exports methods in your own resources

Client Performance
Client Performance

Server Performance
Server Performance

Server Console Output
Server Console Output


DEPENDENCIES:


INSTRUCTIONS:

1) Place "vinatimesync" directory inside your server Resources directory.

2) Add "ensure vinatimesync" to your server config.

3) Start your FiveM server.

4) Will create a "server_time.txt" automatically at first launch, this is were time will be saved for persistence.


SERVER EXPORTS:

You can get the server time in your own resource using this export function:

  • GetTimeIsPaused()
    return: bool
    info: Get if the server time is paused

  • SetTimeIsPaused(bool isPaused)
    info: Pause the server time

  • GetCurrentDateTicks()
    return: long
    info: Get the server time total ticks

  • SetCurrentDateTicks(long ticks)
    info: Set the server time from total ticks

// Get the server time
long ticks = Exports["vinatimesync"].GetCurrentDateTicks();
DateTime currentDate = new DateTime(ticks);

// Set the server time
Exports["vinatimesync"].SetCurrentDateTicks(DateTime.Now.Ticks);

CONVARS:

You can change the settings using convar in your FiveM server config file:

  • set vina_timesync_network_verbose 0
    Set to 1 to print event in the console

  • set vina_timesync_console_print_time 0
    Set to 1 to print the time periodically in the console

  • set vina_timesync_console_print_format "MMMM d yyyy, HH:mm:ss tt"
    Set the format to print the date/time

  • set vina_timesync_console_print_delay 60000
    Set the millisecond delay between the print of time in console

  • set vina_timesync_update_delay 60000
    Set the delay before server force resync with all players

  • set vina_timesync_timerate 1
    Set the timerate, 1 = 1 real second & 10 = 10 time faster than real time

vina-timesync's People

Contributors

vinastar avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.