diff --git a/ReallifeGamemode.Client/Player/spawnschutz.ts b/ReallifeGamemode.Client/Player/spawnschutz.ts index 8fd01d34..848d7c93 100644 --- a/ReallifeGamemode.Client/Player/spawnschutz.ts +++ b/ReallifeGamemode.Client/Player/spawnschutz.ts @@ -1,4 +1,5 @@ export let spawnschutzEnabled = true; +var spawnschutzTimer; export default function spawnschutz() { @@ -6,11 +7,16 @@ export default function spawnschutz() { spawnschutzEnabled = true; mp.events.call("toggleSpawnschutz", true); mp.events.call("triggerSpawnschutzTimer"); + }); + mp.events.add("abortSpawnschutz", () => { + spawnschutzEnabled = false; + mp.events.call("toggleSpawnschutz", false); + clearInterval(spawnschutzTimer); }); mp.events.add("triggerSpawnschutzTimer", () => { - var spawnschutzTimer = setTimeout(() => { + spawnschutzTimer = setTimeout(() => { mp.events.call("toggleSpawnschutz", false); spawnschutzEnabled = false; }, 60000); diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index ed27acef..581db2c8 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -308,6 +308,7 @@ namespace ReallifeGamemode.Server.Events user.SetData("duty", true); player.SendNotification("Du bist nun ~g~im Dienst."); player.TriggerEvent("toggleDutyMode", true); + player.TriggerEvent("abortSpawnschutz"); if (player.GetUser().FactionId == 2) //Fire Department { Medic.UpdateDutyMedics();