Test: gangwar kill mstg

This commit is contained in:
Fabian
2021-04-29 19:24:36 +02:00
parent 3bf0f82abb
commit 6537e0551c
5 changed files with 19 additions and 31 deletions

View File

@@ -56,9 +56,6 @@ export default function (globalData: IGlobalData): void {
var playerId; var playerId;
var playerMoney = "5000"; var playerMoney = "5000";
var gangwarMessage = "";
var gangwarMessageTimer;
mp.events.add("draw", (pName, pId) => { mp.events.add("draw", (pName, pId) => {
playerName = pName; playerName = pName;
playerId = pId; playerId = pId;
@@ -97,15 +94,6 @@ export default function (globalData: IGlobalData): void {
spawnschutz = toggle; spawnschutz = toggle;
}); });
mp.events.add("setGangwarKillMessage", (msg) => {
gangwarMessage = msg;
clearInterval(gangwarMessageTimer);
gangwarMessageTimer = setTimeout(() => {
gangwarMessage = "";
}, 5000);
});
mp.events.add("jailTime", (time) => { mp.events.add("jailTime", (time) => {
jailTime = JSON.parse(time); jailTime = JSON.parse(time);
}); });
@@ -319,15 +307,6 @@ export default function (globalData: IGlobalData): void {
centre: false centre: false
}) })
mp.game.graphics.drawRect(0.0, 0.555, 0.3, 0.11, 0, 0, 0, 70) 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
})
} }
} }

View File

@@ -1,4 +1,6 @@
export default function gangwarHandle(globalData: IGlobalData) { export default function gangwarHandle(globalData: IGlobalData) {
var gangwarKillCounter = 0;
function inside(point, vs) { function inside(point, vs) {
let x = point[0], let x = point[0],
y = point[1]; y = point[1];
@@ -625,4 +627,12 @@
//turf.render(); //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;
});
} }

View File

@@ -80,11 +80,6 @@ namespace ReallifeGamemode.Server.Events
var playerInGangwar = player.HasData("inGangWar"); var playerInGangwar = player.HasData("inGangWar");
var killerInGangwar = killer.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}"); NAPI.Util.ConsoleOutput($"OnPlayerDeath - Player {player.Name} died - PlayerInGangwar = {playerInGangwar}, KillerInGangwar = {killerInGangwar}");
if (playerInGangwar && killerInGangwar) if (playerInGangwar && killerInGangwar)
{ {

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using GTANetworkAPI; using GTANetworkAPI;
using Newtonsoft.Json; using Newtonsoft.Json;
@@ -57,6 +57,7 @@ namespace ReallifeGamemode.Server.Gangwar
if (killerInsideTurf && victimInsideTurf) 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()) foreach (var turf in getTurfs())
{ {
if (turf.getId() == victim.GetData<int>("inGangWar")) if (turf.getId() == victim.GetData<int>("inGangWar"))

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -31,6 +31,8 @@ namespace ReallifeGamemode.Server.Gangwar
public Player[] playerInGangwar { get; set; } public Player[] playerInGangwar { get; set; }
public int timerCount; 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) public Turf(int TurfID, string TurfName, int color, string Owner, int value, int maxValue, bool surplus)
{ {
this.TurfID = TurfID; this.TurfID = TurfID;
@@ -142,7 +144,7 @@ namespace ReallifeGamemode.Server.Gangwar
continue; 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) /*if (this.Att_Score >= 200)
{ {
@@ -153,7 +155,7 @@ namespace ReallifeGamemode.Server.Gangwar
this.takeOver(this.Owner); this.takeOver(this.Owner);
}*/ }*/
timerCount += 1; 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) if (this.Att_Score > this.Def_Score)
{ {
@@ -312,6 +314,7 @@ namespace ReallifeGamemode.Server.Gangwar
c.TriggerEvent("CLIENT:setAttackBlip", false, TurfID); c.TriggerEvent("CLIENT:setAttackBlip", false, TurfID);
c.ResetData("inGangWar"); c.ResetData("inGangWar");
c.ResetData("GotInsideOfTurf"); c.ResetData("GotInsideOfTurf");
c.TriggerEvent("resetKillcounter");
} }
this.playerInGangwar = null; this.playerInGangwar = null;
this.status = "conquered"; this.status = "conquered";