From 4d40b3734c0843f9ee25adb84e9e9c9da566da50 Mon Sep 17 00:00:00 2001 From: Fabian Date: Thu, 22 Apr 2021 21:45:41 +0200 Subject: [PATCH] spawnschutz fix --- ReallifeGamemode.Client/Login/main.ts | 3 +-- ReallifeGamemode.Client/Player/spawnschutz.ts | 7 +++++++ ReallifeGamemode.Server/Commands/FactionCommands.cs | 3 +-- ReallifeGamemode.Server/Events/Death.cs | 5 ++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ReallifeGamemode.Client/Login/main.ts b/ReallifeGamemode.Client/Login/main.ts index 5e0775dd..faf75835 100644 --- a/ReallifeGamemode.Client/Login/main.ts +++ b/ReallifeGamemode.Client/Login/main.ts @@ -70,7 +70,6 @@ export default function (globalData: IGlobalData): void { loginCam.setActive(false); mp.game.cam.renderScriptCams(false, false, 0, true, false); - mp.events.call("toggleSpawnschutz", true); - mp.events.call("triggerSpawnschutzTimer"); + mp.events.call("enableSpawnschutz"); }); } \ No newline at end of file diff --git a/ReallifeGamemode.Client/Player/spawnschutz.ts b/ReallifeGamemode.Client/Player/spawnschutz.ts index 1639fc61..8fd01d34 100644 --- a/ReallifeGamemode.Client/Player/spawnschutz.ts +++ b/ReallifeGamemode.Client/Player/spawnschutz.ts @@ -2,6 +2,13 @@ export default function spawnschutz() { + mp.events.add("enableSpawnschutz", () => { + spawnschutzEnabled = true; + mp.events.call("toggleSpawnschutz", true); + mp.events.call("triggerSpawnschutzTimer"); + + }); + mp.events.add("triggerSpawnschutzTimer", () => { var spawnschutzTimer = setTimeout(() => { mp.events.call("toggleSpawnschutz", false); diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs index 4abae4e5..f6ad5d2a 100644 --- a/ReallifeGamemode.Server/Commands/FactionCommands.cs +++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs @@ -426,8 +426,7 @@ namespace ReallifeGamemode.Server.Commands deadPlayer.SetData("isDead", false); deadPlayer.SetData("reviveSperre", 5); - deadPlayer.TriggerEvent("toggleSpawnschutz", true); - deadPlayer.TriggerEvent("triggerSpawnschutzTimer"); + deadPlayer.TriggerEvent("enableSpawnschutz"); dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 2).First().BankAccount.Balance += Medic.ReviveIncome; diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index d260ea63..22b4a9c2 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -244,9 +244,8 @@ namespace ReallifeGamemode.Server.Events } player.SafeTeleport(new Vector3(-495.45, -336.33, 34.5), 0, true); - - player.TriggerEvent("toggleSpawnschutz", true); - player.TriggerEvent("triggerSpawnschutzTimer"); + + player.TriggerEvent("enableSpawnschutz"); } } }