add Blips and Sounds to Gangwar
This commit is contained in:
@@ -55,6 +55,7 @@
|
||||
_inColshape: boolean;
|
||||
_timerCheck;
|
||||
edit: boolean;
|
||||
attackBlip: BlipMp;
|
||||
|
||||
constructor(name, id, x, y, range, color, rot, owner, edit) {
|
||||
this._setup(name, id, x, y, range, color, rot, owner, edit);
|
||||
@@ -80,6 +81,7 @@
|
||||
self.attacker = null;
|
||||
self.edit = edit;
|
||||
self.loadArea();
|
||||
self.attackBlip = null;
|
||||
}
|
||||
|
||||
setColor(owner) {
|
||||
@@ -199,7 +201,7 @@
|
||||
}
|
||||
if (status == "normal") {
|
||||
self._status = "normal";
|
||||
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false);
|
||||
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false);
|
||||
return;
|
||||
}
|
||||
if (status == "conquered") {
|
||||
@@ -213,6 +215,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
setAttackBlip(bool) {
|
||||
var self = this;
|
||||
if (bool) {
|
||||
self.attackBlip = mp.game.ui.addBlipForRadius(self.x, self.y, 1, 3);
|
||||
mp.game.invoke(Natives.SET_BLIP_SPRITE, self.attackBlip, 378);
|
||||
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.attackBlip, true);
|
||||
} else if (!bool) {
|
||||
mp.game.invoke(Natives.SET_BLIP_ALPHA, self.blip, 0);
|
||||
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.attackBlip, false);
|
||||
}
|
||||
}
|
||||
|
||||
isTurfArea(shape) {
|
||||
return (shape == this._colshape)
|
||||
}
|
||||
@@ -237,11 +251,13 @@
|
||||
if ((!self._entered)) {
|
||||
if (self.isInsideArea() && (self.isNearGround() == true)) {
|
||||
self._entered = true;
|
||||
mp.game.audio.playSoundFrontend(1, "Enter_Capture_Zone", "DLC_Apartments_Drop_Zone_Sounds", true);
|
||||
mp.events.callRemote("Gangarea:Enter", JSON.stringify(self.id));
|
||||
}
|
||||
} else if (self._entered == true) {
|
||||
if (!self.isInsideArea() || (self.isNearGround() == false)) {
|
||||
self._entered = false;
|
||||
mp.game.audio.playSoundFrontend(1, "Exit_Capture_Zone", "DLC_Apartments_Drop_Zone_Sounds", true);
|
||||
mp.events.callRemote("Gangarea:Leave", JSON.stringify(self.id));
|
||||
}
|
||||
}
|
||||
@@ -331,6 +347,13 @@
|
||||
});
|
||||
});
|
||||
|
||||
mp.events.add('CLIENT:loose', () => {
|
||||
mp.game.audio.playSoundFrontend(1, "Zone_Enemy_Capture", "DLC_Apartments_Drop_Zone_Sounds", true);
|
||||
});
|
||||
mp.events.add('CLIENT:win', () => {
|
||||
mp.game.audio.playSoundFrontend(1, "Zone_Team_Capture", "DLC_Apartments_Drop_Zone_Sounds", true);
|
||||
});
|
||||
|
||||
function clearBlips() {
|
||||
mp.game.gameplay.setThisScriptCanRemoveBlipsCreatedByAnyScript(true);
|
||||
var x = 0;
|
||||
@@ -394,13 +417,10 @@
|
||||
});
|
||||
});
|
||||
|
||||
mp.events.add('CLIENT:ScoreUpdate1', (JSONattackerScore, JSONdefenderScore, JSONid) => {
|
||||
var attackerScore = JSON.parse(JSONattackerScore);
|
||||
var defenderScore = JSON.parse(JSONdefenderScore);
|
||||
var id = JSON.parse(JSONid);
|
||||
mp.events.add('CLIENT:setAttackBlip', (bool, id) => {
|
||||
gangturfs.forEach(function (turf) {
|
||||
if (turf.id == id) {
|
||||
turf.scoreUpdate(attackerScore, defenderScore);
|
||||
turf.setAttackBlip(bool);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user