Gangwar System Complete
This commit is contained in:
@@ -211,7 +211,7 @@
|
||||
}
|
||||
if (self.leaderBlipVector != null) {
|
||||
let dist = mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, mp.players.local.position.z, self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z, false);
|
||||
if (self.isInsideArea() && self._status != "attack" && dist <= 3) {
|
||||
if (self.isInsideArea() && self._status != "attack" && dist <= 6) {
|
||||
if (self.leaderBlipVector != null) {
|
||||
mp.game.graphics.drawText(self.name + "\n~y~Gang: ~s~" + self.owner + "\n~y~Wert: ~s~$~g~187", [self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z], {
|
||||
font: 7,
|
||||
@@ -226,13 +226,9 @@
|
||||
|
||||
}
|
||||
|
||||
private delay(ms: number) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
async startGangWar() {
|
||||
startGangWar() {
|
||||
var self = this;
|
||||
await this.delay(1000);
|
||||
if (self._status == "normal") {
|
||||
let dist = mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, 0, self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z, false);
|
||||
if (dist <= 3) {
|
||||
@@ -285,10 +281,13 @@
|
||||
|
||||
setLeaderBlip(bool) {
|
||||
var self = this;
|
||||
if (this.leaderColShape != null) {
|
||||
this.leaderColShape.destroy();
|
||||
this.leaderColShape = null;
|
||||
}
|
||||
if (bool) {
|
||||
self.leaderBlipVector = mp.players.local.position;
|
||||
mp.events.callRemote("SERVER:Turf_SetNewLeaderPoint", JSON.stringify(self.leaderBlipVector), JSON.stringify(self.id));
|
||||
self.setLeaderColShape();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -306,7 +305,7 @@
|
||||
let newVector = new mp.Vector3(self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z - 2)
|
||||
|
||||
self.leaderColShape = mp.markers.new(1, newVector, 2, {
|
||||
color: [255, 255, 255, 150],
|
||||
color: [255, 255, 0, 150],
|
||||
visible: true,
|
||||
dimension: 0
|
||||
});
|
||||
@@ -337,13 +336,12 @@
|
||||
if ((!self._entered)) {
|
||||
if (self.isInsideArea() && (self.isNearGround() == true)) {
|
||||
self._entered = true;
|
||||
if (self._status === "attack") {
|
||||
if (self._status == "attack") {
|
||||
mp.game.audio.playSoundFrontend(1, "Enter_Capture_Zone", "DLC_Apartments_Drop_Zone_Sounds", true);
|
||||
mp.game.graphics.stopScreenEffect("MinigameTransitionIn");
|
||||
mp.game.graphics.startScreenEffect("MinigameTransitionOut", 500, false);
|
||||
|
||||
}
|
||||
|
||||
mp.events.callRemote("Gangarea:Enter", JSON.stringify(self.id));
|
||||
}
|
||||
} else if (self._entered == true) {
|
||||
@@ -476,9 +474,18 @@
|
||||
var turfs = JSON.parse(turfsJSON);
|
||||
if (gangturfs.length > 0) {
|
||||
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.
|
||||
if (turf.leaderColShape != null) {
|
||||
turf.leaderColShape.destroy();
|
||||
turf.leaderColShape = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
clearBlips();
|
||||
if (turfs.length > 0) {
|
||||
|
||||
gangturfs = [];
|
||||
turfs.forEach(function (turf) {
|
||||
if (turf.Id != undefined) {
|
||||
@@ -534,19 +541,13 @@
|
||||
|
||||
mp.events.add('CLIENT:Turf_LoadLeaderBlip', () => {
|
||||
gangturfs.forEach(function (turf) {
|
||||
if (turf.Id != undefined) {
|
||||
turf.setLeaderBlip(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
mp.events.add('ADMIN:Turf_CreateLeaderBlip', () => {
|
||||
gangturfs.forEach(function (turf) {
|
||||
if (turf._entered == true) {
|
||||
if (turf.leaderColShape != null) {
|
||||
turf.leaderColShape.destroy();
|
||||
turf.leaderColShape = null;
|
||||
}
|
||||
turf.setLeaderBlip(true);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace ReallifeGamemode.Server.Gangwar
|
||||
{
|
||||
if (turf.status == "attack")
|
||||
{
|
||||
client.SendChatMessage("Ein GW läuft grad bruder"); // DEBUG //change to smth more serious
|
||||
ChatService.ErrorMessage(client,"Du kannst momentan kein Gangwar starten");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user