laufenden countdown auch nach login/register anzeigen
This commit is contained in:
@@ -86,8 +86,8 @@ export default function (globalData: IGlobalData): void {
|
||||
gangwarTimer = gwTimer;
|
||||
});
|
||||
|
||||
mp.events.add("countdown", (timer, text) => {
|
||||
countdown = timer;
|
||||
mp.events.add("countdown", (timer: number, text) => {
|
||||
countdown = Math.round(timer);
|
||||
cdTimestamp = Date.now();
|
||||
countdownText = text;
|
||||
});
|
||||
|
||||
@@ -544,6 +544,9 @@ namespace ReallifeGamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
GlobalHelper.CountdownUntil = DateTime.Now + TimeSpan.FromSeconds(timer);
|
||||
GlobalHelper.CountdownText = text;
|
||||
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("countdown", timer, text);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ using ReallifeGamemode.Server.Types;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Server.Wanted;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
|
||||
using System;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Event Login (Login.cs)
|
||||
@@ -167,6 +167,11 @@ namespace ReallifeGamemode.Server.Events
|
||||
player.SetData("isDead", false);
|
||||
}
|
||||
}, delayTime: 1000);
|
||||
|
||||
if(GlobalHelper.CountdownUntil > DateTime.Now)
|
||||
{
|
||||
player.TriggerEvent("countdown", (GlobalHelper.CountdownUntil - DateTime.Now).TotalSeconds, GlobalHelper.CountdownText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ using ReallifeGamemode.Database.Entities;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
using System;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Event Register (Register.cs)
|
||||
@@ -66,6 +68,11 @@ namespace ReallifeGamemode.Server.Events
|
||||
player.TriggerEvent("toggleCreator");
|
||||
player.SafeTeleport(new Vector3(402.8664, -996.4108, -99.00027));
|
||||
//player.Position = new Vector3(user.PositionX, user.PositionY, user.PositionZ);
|
||||
|
||||
if (GlobalHelper.CountdownUntil > DateTime.Now)
|
||||
{
|
||||
player.TriggerEvent("countdown", (GlobalHelper.CountdownUntil - DateTime.Now).TotalSeconds, GlobalHelper.CountdownText);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Server.Util
|
||||
@@ -14,5 +15,8 @@ namespace ReallifeGamemode.Server.Util
|
||||
{ "iCroniX", "Life of Malle - Eimer für Alle - Alle für Malle - Böllern! (CroniX)" },
|
||||
{ "balboistderbeste", "Hurra! Hurra! Der Balbo ist jetzt da! (balbo)" },
|
||||
};
|
||||
|
||||
public static DateTime CountdownUntil { get; internal set; }
|
||||
public static string CountdownText { get; internal set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user