Added real time clock
This commit is contained in:
1
Main.cs
1
Main.cs
@@ -36,6 +36,7 @@ namespace reallife_gamemode
|
||||
NAPI.Data.SetWorldData("playerCreatorDimension", 0);
|
||||
|
||||
TuningManager.AddTuningGarage(new Vector3(-341, -134, 38.5));
|
||||
TimeManager.StartTimeManager();
|
||||
|
||||
DatabaseHelper.InitDatabaseFirstTime();
|
||||
FactionHelper.CheckFactionBankAccounts();
|
||||
|
||||
25
Server/Managers/TimeManager.cs
Normal file
25
Server/Managers/TimeManager.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user