Merge branch 'develop' of ssh://development.life-of-german.org:451/log-gtav/reallife-gamemode into develop

This commit is contained in:
michael.reiswich
2021-03-30 22:43:03 +02:00
2 changed files with 39 additions and 10 deletions

View File

@@ -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 {
@@ -130,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() {
@@ -244,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;
@@ -452,15 +454,27 @@
});
function clearBlips() {
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;
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);
mp.game.ui.removeBlip(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.ui.removeBlip(last_blip);
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++;
}
@@ -485,7 +499,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);
}
@@ -496,7 +510,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;
@@ -511,7 +525,6 @@
if (turf.attackBlip != null) {
mp.game.ui.removeBlip(turf.attackBlip);
}
Natives
});
}
clearBlips();

View File

@@ -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,20 @@ namespace ReallifeGamemode.Server.Gangwar
this.timerCount = 0;
}
private void reloadGangTurfs()
{
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)
{
if (this.status == "attack")
@@ -152,18 +167,18 @@ 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, 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 >= 100) //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)
{
@@ -288,6 +303,7 @@ namespace ReallifeGamemode.Server.Gangwar
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)