From 85c599b24ac8a5b003be3934ebd753536059d370 Mon Sep 17 00:00:00 2001 From: Fabian Date: Thu, 22 Apr 2021 21:57:01 +0200 Subject: [PATCH] spawnschutz bei duty weg --- ReallifeGamemode.Client/Player/spawnschutz.ts | 8 +++++++- ReallifeGamemode.Server/Events/Key.cs | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) 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();