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 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
})
}
}

View File

@@ -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;
});
}

View File

@@ -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)
{

View File

@@ -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<int>("inGangWar"))

View File

@@ -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";