From 6537e0551cf619e44a54a49e9a9190c41ad3458b Mon Sep 17 00:00:00 2001 From: Fabian Date: Thu, 29 Apr 2021 19:24:36 +0200 Subject: [PATCH] Test: gangwar kill mstg --- ReallifeGamemode.Client/Gui/infobox.ts | 21 --------------------- ReallifeGamemode.Client/util/Gangwar.ts | 10 ++++++++++ ReallifeGamemode.Server/Events/Death.cs | 5 ----- ReallifeGamemode.Server/Gangwar/Gangwar.cs | 5 +++-- ReallifeGamemode.Server/Gangwar/Turf.cs | 9 ++++++--- 5 files changed, 19 insertions(+), 31 deletions(-) diff --git a/ReallifeGamemode.Client/Gui/infobox.ts b/ReallifeGamemode.Client/Gui/infobox.ts index ac006e26..72dc766e 100644 --- a/ReallifeGamemode.Client/Gui/infobox.ts +++ b/ReallifeGamemode.Client/Gui/infobox.ts @@ -56,9 +56,6 @@ 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; @@ -97,15 +94,6 @@ 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); }); @@ -319,15 +307,6 @@ 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 - }) } } diff --git a/ReallifeGamemode.Client/util/Gangwar.ts b/ReallifeGamemode.Client/util/Gangwar.ts index f9136552..3fdc949c 100644 --- a/ReallifeGamemode.Client/util/Gangwar.ts +++ b/ReallifeGamemode.Client/util/Gangwar.ts @@ -1,4 +1,6 @@ export default function gangwarHandle(globalData: IGlobalData) { + var gangwarKillCounter = 0; + function inside(point, vs) { let x = point[0], y = point[1]; @@ -625,4 +627,12 @@ //turf.render(); } }); + + mp.events.add("gangWarKillNotification", (deathPlayername) => { + mp.events.call("BN_Show", "GANGWAR: Du hast ~r~" + deathPlayername + " ~w~getötet. Kills: " + ++gangwarKillCounter); + }); + + mp.events.add("resetKillcounter", () => { + gangwarKillCounter = 0; + }); } \ No newline at end of file diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index 0829b426..965733cf 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -80,11 +80,6 @@ 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) { diff --git a/ReallifeGamemode.Server/Gangwar/Gangwar.cs b/ReallifeGamemode.Server/Gangwar/Gangwar.cs index 56d7f42d..c2252bef 100644 --- a/ReallifeGamemode.Server/Gangwar/Gangwar.cs +++ b/ReallifeGamemode.Server/Gangwar/Gangwar.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using GTANetworkAPI; using Newtonsoft.Json; @@ -56,7 +56,8 @@ namespace ReallifeGamemode.Server.Gangwar if (killerInsideTurf && victimInsideTurf) { - NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - Killer and Victim are in Turf area"); + NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - Killer and Victim are in Turf area"); + killer.TriggerEvent("gangWarKillNotification", victim.Name); foreach (var turf in getTurfs()) { if (turf.getId() == victim.GetData("inGangWar")) diff --git a/ReallifeGamemode.Server/Gangwar/Turf.cs b/ReallifeGamemode.Server/Gangwar/Turf.cs index 09f85b64..423b3c3a 100644 --- a/ReallifeGamemode.Server/Gangwar/Turf.cs +++ b/ReallifeGamemode.Server/Gangwar/Turf.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -31,6 +31,8 @@ namespace ReallifeGamemode.Server.Gangwar public Player[] playerInGangwar { get; set; } public int timerCount; + private const int GANGWAR_TOTAL_TIME = 900; + public Turf(int TurfID, string TurfName, int color, string Owner, int value, int maxValue, bool surplus) { this.TurfID = TurfID; @@ -142,7 +144,7 @@ namespace ReallifeGamemode.Server.Gangwar continue; } - gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score, 900 - timerCount); + gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score, GANGWAR_TOTAL_TIME - timerCount); } /*if (this.Att_Score >= 200) { @@ -153,7 +155,7 @@ namespace ReallifeGamemode.Server.Gangwar this.takeOver(this.Owner); }*/ timerCount += 1; - if (timerCount >= 900) //change to 900 (seconds) before release for testing reasons change to whatever you like + if (timerCount >= GANGWAR_TOTAL_TIME) { if (this.Att_Score > this.Def_Score) { @@ -312,6 +314,7 @@ namespace ReallifeGamemode.Server.Gangwar c.TriggerEvent("CLIENT:setAttackBlip", false, TurfID); c.ResetData("inGangWar"); c.ResetData("GotInsideOfTurf"); + c.TriggerEvent("resetKillcounter"); } this.playerInGangwar = null; this.status = "conquered";