From 3bf0f82abb911d7e6dbf1c7164fa0be5c0aab526 Mon Sep 17 00:00:00 2001 From: Fabian Date: Thu, 29 Apr 2021 18:57:46 +0200 Subject: [PATCH] TEST: gangwar kill message --- ReallifeGamemode.Client/Gui/infobox.ts | 23 ++++++++++++++++++- .../Commands/UserCommands.cs | 2 +- ReallifeGamemode.Server/Events/Death.cs | 6 +++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/ReallifeGamemode.Client/Gui/infobox.ts b/ReallifeGamemode.Client/Gui/infobox.ts index cf1ba033..ac006e26 100644 --- a/ReallifeGamemode.Client/Gui/infobox.ts +++ b/ReallifeGamemode.Client/Gui/infobox.ts @@ -56,6 +56,9 @@ export default function (globalData: IGlobalData): void { var playerId; var playerMoney = "5000"; + var gangwarMessage = ""; + var gangwarMessageTimer; + mp.events.add("draw", (pName, pId) => { playerName = pName; playerId = pId; @@ -94,6 +97,15 @@ export default function (globalData: IGlobalData): void { spawnschutz = toggle; }); + mp.events.add("setGangwarKillMessage", (msg) => { + gangwarMessage = msg; + + clearInterval(gangwarMessageTimer); + gangwarMessageTimer = setTimeout(() => { + gangwarMessage = ""; + }, 5000); + }); + mp.events.add("jailTime", (time) => { jailTime = JSON.parse(time); }); @@ -307,9 +319,18 @@ export default function (globalData: IGlobalData): void { centre: false }) mp.game.graphics.drawRect(0.0, 0.555, 0.3, 0.11, 0, 0, 0, 70) - } + mp.game.graphics.drawText(gangwarMessage, [0.08, 0.68], + { + font: 4, + color: [255, 255, 255, 255], + scale: [0.5, 0.5], + outline: true, + centre: false + }) + } } + if (editMode === true) { mp.game.graphics.drawText("~r~EDIT-MODE AKTIV", [0.5, 0], { diff --git a/ReallifeGamemode.Server/Commands/UserCommands.cs b/ReallifeGamemode.Server/Commands/UserCommands.cs index f9718c59..cf5d581b 100644 --- a/ReallifeGamemode.Server/Commands/UserCommands.cs +++ b/ReallifeGamemode.Server/Commands/UserCommands.cs @@ -16,7 +16,7 @@ using ReallifeGamemode.Services; namespace ReallifeGamemode.Server.Commands { internal class UserCommands : Script - { + { [Command("eventport", "~m~eventport")] public void CmdUserEventport(Player player, String option = "") { diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index 21c12c75..0829b426 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -79,6 +79,12 @@ namespace ReallifeGamemode.Server.Events var playerInGangwar = player.HasData("inGangWar"); var killerInGangwar = killer.HasData("inGangWar"); + + if (playerInGangwar && killerInGangwar) + { + killer.TriggerEvent("setGangwarKillMessage", "Du hast ~r~" + player.Name + " getötet"); + } + NAPI.Util.ConsoleOutput($"OnPlayerDeath - Player {player.Name} died - PlayerInGangwar = {playerInGangwar}, KillerInGangwar = {killerInGangwar}"); if (playerInGangwar && killerInGangwar) {