Fix WeatherTimeSync option

This commit is contained in:
Sardelka 2022-07-12 17:10:16 +08:00
parent edca1e2b98
commit cf8b54a3b5
2 changed files with 11 additions and 11 deletions

View File

@ -10,6 +10,8 @@ namespace RageCoop.Server.Scripting
{
internal class BaseScript:ServerScript
{
private readonly Server Server;
public BaseScript(Server server) { Server=server; }
public override void OnStart()
{
API.RegisterCustomEventHandler(CustomEvents.NativeResponse, NativeResponse);
@ -22,6 +24,8 @@ namespace RageCoop.Server.Scripting
API.Entities.RemovePed((int)e.Args[0]);
});
API.RegisterCustomEventHandler(CustomEvents.WeatherTimeSync, (e) =>
{
if (Server.Settings.WeatherTimeSync)
{
foreach (var c in API.GetAllClients().Values)
{
@ -31,6 +35,7 @@ namespace RageCoop.Server.Scripting
}
c.SendCustomEventQueued(CustomEvents.WeatherTimeSync, e.Args);
}
}
});
}
public override void OnStop()

View File

@ -76,13 +76,8 @@
public float PlayerStreamingDistance { get; set; } = -1;
/// <summary>
/// If enabled, all clients will have same weather as host
/// If enabled, all clients will have same weather and time as host
/// </summary>
public bool WeatherSync { get; set; } = true;
/// <summary>
/// If enabled, all clients will have same time as host
/// </summary>
public bool TimeSync { get; set; } = true;
public bool WeatherTimeSync { get; set; } = true;
}
}