From 89be8372c7f4b97e83fe3abaad80fe1dcfed36ae Mon Sep 17 00:00:00 2001 From: VegaZ Date: Tue, 30 Mar 2021 19:15:17 +0200 Subject: [PATCH 01/11] GangwarFix zweiter Tag 1 --- ReallifeGamemode.Client/util/Gangwar.ts | 8 ++++++-- ReallifeGamemode.Server/Gangwar/Turf.cs | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ReallifeGamemode.Client/util/Gangwar.ts b/ReallifeGamemode.Client/util/Gangwar.ts index 8178996a..70b57441 100644 --- a/ReallifeGamemode.Client/util/Gangwar.ts +++ b/ReallifeGamemode.Client/util/Gangwar.ts @@ -30,7 +30,8 @@ DOES_BLIP_EXIST: "0xA6DB27D19ECBB7DA", SET_BLIP_COORDS: "0xAE2AF67E9D9AF65D", SET_BLIP_FLASH_INTERVAL: "0xAA51DB313C010A7E", - REMOVE_BLIP: "0x86A652570E5F25DD" + REMOVE_BLIP: "0x86A652570E5F25DD", + SET_THIS_SCRIPT_CAN_REMOVE_BLIPS_CREATED_BY_ANY_SCRIPT: "0xB98236CAAECEF897" }; var Gangturf = class { @@ -452,7 +453,9 @@ }); function clearBlips() { - mp.game.gameplay.setThisScriptCanRemoveBlipsCreatedByAnyScript(true); + + mp.game.invoke(Natives.SET_THIS_SCRIPT_CAN_REMOVE_BLIPS_CREATED_BY_ANY_SCRIPT, 1); + //mp.game.gameplay.setThisScriptCanRemoveBlipsCreatedByAnyScript(true); var x = 0; var y = 0; var z = 0; @@ -460,6 +463,7 @@ while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_blip)) { mp.game.invoke(Natives.SET_BLIP_SPRITE, last_blip, -1); + mp.game.invoke(Natives.REMOVE_BLIP, last_blip, -1); mp.game.ui.removeBlip(last_blip); last_blip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 5); x++; diff --git a/ReallifeGamemode.Server/Gangwar/Turf.cs b/ReallifeGamemode.Server/Gangwar/Turf.cs index 5886022e..b4c35f18 100644 --- a/ReallifeGamemode.Server/Gangwar/Turf.cs +++ b/ReallifeGamemode.Server/Gangwar/Turf.cs @@ -152,7 +152,7 @@ namespace ReallifeGamemode.Server.Gangwar foreach (Player gangwarPlayer in this.playerInGangwar) { - gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score, 100 - timerCount); + gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score, 60 - timerCount); } if (this.Att_Score >= 200) { @@ -163,7 +163,7 @@ namespace ReallifeGamemode.Server.Gangwar this.takeOver(this.Owner); } timerCount += 1; - if (timerCount >= 100) //change to 900 (seconds) before release for testing reasons change to whatever you like + if (timerCount >= 60) //change to 900 (seconds) before release for testing reasons change to whatever you like { if (this.Att_Score > this.Def_Score) { From f9380b11379c12788c71650638487f6a0fe6406b Mon Sep 17 00:00:00 2001 From: VegaZ Date: Tue, 30 Mar 2021 20:02:48 +0200 Subject: [PATCH 02/11] GangwarFix zweiter Tag 2 --- ReallifeGamemode.Client/util/Gangwar.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ReallifeGamemode.Client/util/Gangwar.ts b/ReallifeGamemode.Client/util/Gangwar.ts index 70b57441..082b4dcb 100644 --- a/ReallifeGamemode.Client/util/Gangwar.ts +++ b/ReallifeGamemode.Client/util/Gangwar.ts @@ -131,7 +131,7 @@ mp.game.invoke(Natives.SET_BLIP_SPRITE, self.blip, 5); mp.game.invoke(Natives.SET_BLIP_ALPHA, self.blip, 70); mp.game.invoke(Natives.SET_BLIP_COLOUR, self.blip, self.color); - + self._colshape = mp.colshapes.newCircle(self.x, self.y, self.range * 1.5); } render() { @@ -245,6 +245,7 @@ self._status = "attack"; self.attacker = args[1]; //self.blip.setFlashes(true); + //self.blip.setFlashInterval(1000); mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, true); mp.game.invoke(Natives.SET_BLIP_FLASH_INTERVAL, self.blip, 1000) return; @@ -464,7 +465,8 @@ while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_blip)) { mp.game.invoke(Natives.SET_BLIP_SPRITE, last_blip, -1); mp.game.invoke(Natives.REMOVE_BLIP, last_blip, -1); - mp.game.ui.removeBlip(last_blip); + mp.game.invoke(Natives.SET_BLIP_ALPHA, last_blip, 0); + mp.game.ui.removeBlip(last_blip); last_blip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 5); x++; } From 9d4bb6ff7bfff068def7de970d01758cb5533e6a Mon Sep 17 00:00:00 2001 From: VegaZ Date: Tue, 30 Mar 2021 20:12:34 +0200 Subject: [PATCH 03/11] GangwarFix zweiter Tag 3 --- ReallifeGamemode.Client/util/Gangwar.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ReallifeGamemode.Client/util/Gangwar.ts b/ReallifeGamemode.Client/util/Gangwar.ts index 082b4dcb..6e32d47b 100644 --- a/ReallifeGamemode.Client/util/Gangwar.ts +++ b/ReallifeGamemode.Client/util/Gangwar.ts @@ -456,7 +456,7 @@ function clearBlips() { mp.game.invoke(Natives.SET_THIS_SCRIPT_CAN_REMOVE_BLIPS_CREATED_BY_ANY_SCRIPT, 1); - //mp.game.gameplay.setThisScriptCanRemoveBlipsCreatedByAnyScript(true); + mp.game.gameplay.setThisScriptCanRemoveBlipsCreatedByAnyScript(true); var x = 0; var y = 0; var z = 0; @@ -510,6 +510,7 @@ if (turf._marker) if (turf.blip != null) { mp.game.ui.removeBlip(turf.blip); + mp.game.invoke(Natives.SET_BLIP_ALPHA, turf.blip, 0); } if (turf.leaderBlip != null) { mp.game.ui.removeBlip(turf.leaderBlip); From e00194e0238bb142a076f98284ee0ada492fc555 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Tue, 30 Mar 2021 20:30:36 +0200 Subject: [PATCH 04/11] GangwarFix zweiter Tag 4 --- ReallifeGamemode.Client/util/Gangwar.ts | 4 +--- ReallifeGamemode.Server/Gangwar/Turf.cs | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/ReallifeGamemode.Client/util/Gangwar.ts b/ReallifeGamemode.Client/util/Gangwar.ts index 6e32d47b..44d876d4 100644 --- a/ReallifeGamemode.Client/util/Gangwar.ts +++ b/ReallifeGamemode.Client/util/Gangwar.ts @@ -502,7 +502,7 @@ gangturfs[gangturfs.length - 1].edit = false; gangturfs.forEach(function (turf) { turf._status = "disabled"; - turf.id = -420; //Due to garbage collecting this value needs to be negative, so that the Server doesn't find multiple Turfs in the Database with same ID's. + turf.id = null; //Due to garbage collecting this value needs to be negative, so that the Server doesn't find multiple Turfs in the Database with same ID's. if (turf.leaderColShape != null) { turf.leaderColShape.destroy(); turf.leaderColShape = null; @@ -510,7 +510,6 @@ if (turf._marker) if (turf.blip != null) { mp.game.ui.removeBlip(turf.blip); - mp.game.invoke(Natives.SET_BLIP_ALPHA, turf.blip, 0); } if (turf.leaderBlip != null) { mp.game.ui.removeBlip(turf.leaderBlip); @@ -518,7 +517,6 @@ if (turf.attackBlip != null) { mp.game.ui.removeBlip(turf.attackBlip); } - Natives }); } clearBlips(); diff --git a/ReallifeGamemode.Server/Gangwar/Turf.cs b/ReallifeGamemode.Server/Gangwar/Turf.cs index b4c35f18..2e40b1eb 100644 --- a/ReallifeGamemode.Server/Gangwar/Turf.cs +++ b/ReallifeGamemode.Server/Gangwar/Turf.cs @@ -152,7 +152,7 @@ namespace ReallifeGamemode.Server.Gangwar foreach (Player gangwarPlayer in this.playerInGangwar) { - gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score, 60 - timerCount); + gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score, 40 - timerCount); } if (this.Att_Score >= 200) { @@ -163,7 +163,7 @@ namespace ReallifeGamemode.Server.Gangwar this.takeOver(this.Owner); } timerCount += 1; - if (timerCount >= 60) //change to 900 (seconds) before release for testing reasons change to whatever you like + if (timerCount >= 40) //change to 900 (seconds) before release for testing reasons change to whatever you like { if (this.Att_Score > this.Def_Score) { From 9d8bcf11e7071f2eb5a54cee6c12568120974762 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Tue, 30 Mar 2021 20:38:00 +0200 Subject: [PATCH 05/11] GangwarFix zweiter Tag 5 --- ReallifeGamemode.Client/util/Gangwar.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ReallifeGamemode.Client/util/Gangwar.ts b/ReallifeGamemode.Client/util/Gangwar.ts index 44d876d4..78829f5a 100644 --- a/ReallifeGamemode.Client/util/Gangwar.ts +++ b/ReallifeGamemode.Client/util/Gangwar.ts @@ -467,6 +467,7 @@ mp.game.invoke(Natives.REMOVE_BLIP, last_blip, -1); mp.game.invoke(Natives.SET_BLIP_ALPHA, last_blip, 0); mp.game.ui.removeBlip(last_blip); + mp.game.invoke(Natives.REMOVE_BLIP, last_blip); last_blip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 5); x++; } From d164593a2a68b8365fecddc0c337eb9494bdb101 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Tue, 30 Mar 2021 20:42:32 +0200 Subject: [PATCH 06/11] GangwarFix zweiter Tag 6 --- ReallifeGamemode.Client/util/Gangwar.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ReallifeGamemode.Client/util/Gangwar.ts b/ReallifeGamemode.Client/util/Gangwar.ts index 78829f5a..56316ed8 100644 --- a/ReallifeGamemode.Client/util/Gangwar.ts +++ b/ReallifeGamemode.Client/util/Gangwar.ts @@ -460,8 +460,14 @@ var x = 0; var y = 0; var z = 0; + var n = 0; let last_blip = mp.game.invoke(Natives.GET_FIRST_BLIP_INFO_ID, 5); + gangturfs.forEach(function (turf) { + mp.game.invoke(Natives.REMOVE_BLIP, turf.blip); + n++; + }); + while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_blip)) { mp.game.invoke(Natives.SET_BLIP_SPRITE, last_blip, -1); mp.game.invoke(Natives.REMOVE_BLIP, last_blip, -1); @@ -492,7 +498,7 @@ z++ } - mp.gui.chat.push("DEBUG: Turf blips not removed: " + x); + mp.gui.chat.push("DEBUG: Turf blips not removed: " + x + " / " + n); mp.gui.chat.push("DEBUG: Attack blips not removed: " + y); mp.gui.chat.push("DEBUG: LeaderBlips blips not removed: " + z); } From e64491c27f2643e2aacfcfa5f57dd94bde29c1cf Mon Sep 17 00:00:00 2001 From: VegaZ Date: Tue, 30 Mar 2021 21:03:05 +0200 Subject: [PATCH 07/11] GangwarFix zweiter Tag 7 --- ReallifeGamemode.Client/util/Gangwar.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ReallifeGamemode.Client/util/Gangwar.ts b/ReallifeGamemode.Client/util/Gangwar.ts index 56316ed8..2ba5ec0e 100644 --- a/ReallifeGamemode.Client/util/Gangwar.ts +++ b/ReallifeGamemode.Client/util/Gangwar.ts @@ -465,6 +465,7 @@ gangturfs.forEach(function (turf) { mp.game.invoke(Natives.REMOVE_BLIP, turf.blip); + mp.game.ui.removeBlip(turf.blip); n++; }); From 17f78998238a41b68146ca7e219684e76508ef46 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Tue, 30 Mar 2021 21:49:57 +0200 Subject: [PATCH 08/11] GangwarFix zweiter Tag 8 --- ReallifeGamemode.Server/Gangwar/Turf.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ReallifeGamemode.Server/Gangwar/Turf.cs b/ReallifeGamemode.Server/Gangwar/Turf.cs index 2e40b1eb..a2ef678e 100644 --- a/ReallifeGamemode.Server/Gangwar/Turf.cs +++ b/ReallifeGamemode.Server/Gangwar/Turf.cs @@ -154,14 +154,14 @@ namespace ReallifeGamemode.Server.Gangwar { gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score, 40 - timerCount); } - if (this.Att_Score >= 200) + /*if (this.Att_Score >= 200) { this.takeOver(this.Attacker); } else if (this.Def_Score >= 200) { this.takeOver(this.Owner); - } + }*/ timerCount += 1; if (timerCount >= 40) //change to 900 (seconds) before release for testing reasons change to whatever you like { @@ -286,7 +286,7 @@ namespace ReallifeGamemode.Server.Gangwar this.status = "conquered"; NAPI.ClientEvent.TriggerClientEventForAll("CLIENT:Turf_Conquered", JsonConvert.SerializeObject(this.TurfID), JsonConvert.SerializeObject(this.status), JsonConvert.SerializeObject(this.Owner)); - Gangwar.loadTurfs(); + //Gangwar.loadTurfs(); Gangwar.loadTurfs_ToAllPlayers(); } From 136c1c06d29885a2bf0e297c7ae5c8c1ad3ba30b Mon Sep 17 00:00:00 2001 From: VegaZ Date: Tue, 30 Mar 2021 22:06:28 +0200 Subject: [PATCH 09/11] GangwarFix zweiter Tag 9 --- ReallifeGamemode.Server/Gangwar/Turf.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ReallifeGamemode.Server/Gangwar/Turf.cs b/ReallifeGamemode.Server/Gangwar/Turf.cs index a2ef678e..e93eeb7e 100644 --- a/ReallifeGamemode.Server/Gangwar/Turf.cs +++ b/ReallifeGamemode.Server/Gangwar/Turf.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using System.Timers; using GTANetworkAPI; using Microsoft.EntityFrameworkCore; @@ -113,6 +114,13 @@ namespace ReallifeGamemode.Server.Gangwar this.timerCount = 0; } + private async Task reloadGangTurfs() + { + await Task.Delay(10000); + Gangwar.loadTurfs(); + Gangwar.loadTurfs_ToAllPlayers(); + } + private void Tick(object sender, System.Timers.ElapsedEventArgs e) { if (this.status == "attack") @@ -286,8 +294,7 @@ namespace ReallifeGamemode.Server.Gangwar this.status = "conquered"; NAPI.ClientEvent.TriggerClientEventForAll("CLIENT:Turf_Conquered", JsonConvert.SerializeObject(this.TurfID), JsonConvert.SerializeObject(this.status), JsonConvert.SerializeObject(this.Owner)); - //Gangwar.loadTurfs(); - Gangwar.loadTurfs_ToAllPlayers(); + reloadGangTurfs(); } public void attack(string attacker) From 298109ac513587fa401bfb736191f86a85123507 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Tue, 30 Mar 2021 22:20:29 +0200 Subject: [PATCH 10/11] GangwarFix zweiter Tag 10 --- ReallifeGamemode.Server/Gangwar/Turf.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ReallifeGamemode.Server/Gangwar/Turf.cs b/ReallifeGamemode.Server/Gangwar/Turf.cs index e93eeb7e..614018d8 100644 --- a/ReallifeGamemode.Server/Gangwar/Turf.cs +++ b/ReallifeGamemode.Server/Gangwar/Turf.cs @@ -114,11 +114,18 @@ namespace ReallifeGamemode.Server.Gangwar this.timerCount = 0; } - private async Task reloadGangTurfs() + private void reloadGangTurfs() { - await Task.Delay(10000); - Gangwar.loadTurfs(); - Gangwar.loadTurfs_ToAllPlayers(); + var t = Task.Factory.StartNew(() => + { + ChatService.Broadcast("DEBUG: reloadGangTurfs(...)"); + Task.Delay(10000).Wait(); + Gangwar.loadTurfs(); + Gangwar.loadTurfs_ToAllPlayers(); + ChatService.Broadcast("DEBUG: reloadGangTurfs()...10 Sekunden um"); + }); + t.Wait(); + } private void Tick(object sender, System.Timers.ElapsedEventArgs e) From a6be7e83656c5a10e0a4b1d20e2fc6390a78c7f3 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Tue, 30 Mar 2021 22:25:56 +0200 Subject: [PATCH 11/11] GangwarFix zweiter Tag 11 --- ReallifeGamemode.Server/Gangwar/Turf.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ReallifeGamemode.Server/Gangwar/Turf.cs b/ReallifeGamemode.Server/Gangwar/Turf.cs index 614018d8..2d9463a2 100644 --- a/ReallifeGamemode.Server/Gangwar/Turf.cs +++ b/ReallifeGamemode.Server/Gangwar/Turf.cs @@ -301,6 +301,8 @@ namespace ReallifeGamemode.Server.Gangwar this.status = "conquered"; NAPI.ClientEvent.TriggerClientEventForAll("CLIENT:Turf_Conquered", JsonConvert.SerializeObject(this.TurfID), JsonConvert.SerializeObject(this.status), JsonConvert.SerializeObject(this.Owner)); + Gangwar.loadTurfs(); + Gangwar.loadTurfs_ToAllPlayers(); reloadGangTurfs(); }