Added real time clock

This commit is contained in:
hydrant
2018-12-02 23:37:29 +01:00
parent ba02c523ed
commit 94632cc428
2 changed files with 26 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ namespace reallife_gamemode
NAPI.Data.SetWorldData("playerCreatorDimension", 0); NAPI.Data.SetWorldData("playerCreatorDimension", 0);
TuningManager.AddTuningGarage(new Vector3(-341, -134, 38.5)); TuningManager.AddTuningGarage(new Vector3(-341, -134, 38.5));
TimeManager.StartTimeManager();
DatabaseHelper.InitDatabaseFirstTime(); DatabaseHelper.InitDatabaseFirstTime();
FactionHelper.CheckFactionBankAccounts(); FactionHelper.CheckFactionBankAccounts();

View File

@@ -0,0 +1,25 @@
using GTANetworkAPI;
using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;
namespace reallife_gamemode.Server.Managers
{
public class TimeManager
{
public static void StartTimeManager()
{
Timer t = new Timer(1000);
t.Elapsed += SetTime;
t.Start();
}
private static void SetTime(object sender, ElapsedEventArgs args)
{
DateTime now = DateTime.Now;
NAPI.World.SetTime(now.Hour, now.Minute, now.Second);
}
}
}