todesbildschirm angepasst
This commit is contained in:
@@ -17,32 +17,33 @@ export default function deathScreen() {
|
|||||||
|
|
||||||
mp.game.gameplay.setFadeOutAfterDeath(false);
|
mp.game.gameplay.setFadeOutAfterDeath(false);
|
||||||
|
|
||||||
|
function deactivateDeathScreen() {
|
||||||
|
isDead = false;
|
||||||
|
mp.gui.chat.activate(true);
|
||||||
|
mp.game.gameplay.setFadeOutAfterDeath(false);
|
||||||
|
}
|
||||||
|
|
||||||
mp.events.add("startDeathTimer", (isSupporter) => {
|
mp.events.add("startDeathTimer", (isSupporter) => {
|
||||||
if (isDead === false) {
|
if (isDead) {
|
||||||
isDead = true;
|
return;
|
||||||
mp.gui.chat.activate(isSupporter);
|
|
||||||
mp.game.audio.playSoundFrontend(-1, "Bed", "WastedSounds", true);
|
|
||||||
deathDate = new Date();
|
|
||||||
respawnTime = Math.floor(deathDate.getTime() / 1000 + maxDeathTime);
|
|
||||||
fade = 255 - maxDeathTime;
|
|
||||||
mp.game.graphics.requestStreamedTextureDict("Mptattoos", true);
|
|
||||||
mp.events.call("GetDutyMedics");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDead = true;
|
||||||
|
mp.gui.chat.activate(isSupporter);
|
||||||
|
mp.game.audio.playSoundFrontend(-1, "Bed", "WastedSounds", true);
|
||||||
|
deathDate = new Date();
|
||||||
|
respawnTime = Math.floor(deathDate.getTime() / 1000 + maxDeathTime);
|
||||||
|
fade = 255 - maxDeathTime;
|
||||||
|
mp.events.call("GetDutyMedics");
|
||||||
});
|
});
|
||||||
|
|
||||||
mp.events.add("onPlayerRevived", () => {
|
mp.events.add("onPlayerRevived", () => {
|
||||||
isDead = false;
|
deactivateDeathScreen();
|
||||||
mp.gui.chat.activate(true);
|
|
||||||
mp.game.gameplay.setFadeOutAfterDeath(false);
|
|
||||||
mp.game.graphics.setStreamedTextureDictAsNoLongerNeeded("Mptattoos");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
mp.events.add("respawnDeathPlayer", () => {
|
mp.events.add("respawnDeathPlayer", () => {
|
||||||
isDead = false;
|
deactivateDeathScreen();
|
||||||
mp.gui.chat.activate(true);
|
|
||||||
mp.game.gameplay.setFadeOutAfterDeath(false);
|
|
||||||
mp.events.callRemote('RespawnPlayerAtHospital');
|
mp.events.callRemote('RespawnPlayerAtHospital');
|
||||||
mp.game.graphics.setStreamedTextureDictAsNoLongerNeeded("Mptattoos");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
mp.events.add("updateDutyMedics", (count) => {
|
mp.events.add("updateDutyMedics", (count) => {
|
||||||
@@ -50,53 +51,64 @@ export default function deathScreen() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
mp.events.add("render", () => {
|
mp.events.add("render", () => {
|
||||||
var currentDate = new Date();
|
|
||||||
|
|
||||||
if (isDead === true) {
|
if (!isDead) {
|
||||||
var medicString;
|
return;
|
||||||
|
|
||||||
if (dutyMedics > 0) {
|
|
||||||
medicString = "Das L.S.E.D. wurde benachrichtigt\nDerzeit ";
|
|
||||||
|
|
||||||
if (dutyMedics === 1) {
|
|
||||||
medicString += "befindet sich ~g~" + dutyMedics + " Mitglied";
|
|
||||||
} else {
|
|
||||||
medicString += "befinden sich ~g~" + dutyMedics + " Mitglieder";
|
|
||||||
}
|
|
||||||
|
|
||||||
medicString += " ~s~im Dienst";
|
|
||||||
} else {
|
|
||||||
medicString = "Derzeit befinden sich ~r~keine Einsatzkräfte ~s~im Dienst";
|
|
||||||
}
|
|
||||||
|
|
||||||
deathSeconds = respawnTime - Math.floor(currentDate.getTime() / 1000);
|
|
||||||
if (deathSeconds >= 0) {
|
|
||||||
mp.game.graphics.set2dLayer(2);
|
|
||||||
mp.game.graphics.drawSprite("Mptattoos", "clearout", 0.625, 0.5, 0.1, 0.1, 0, 255, 255, 255, 236);
|
|
||||||
mp.game.graphics.drawText("Respawn in: ~y~" + deathSeconds, [0.5, 0.5],
|
|
||||||
{
|
|
||||||
font: 7,
|
|
||||||
color: [255, 255, 255, 255],
|
|
||||||
scale: [0.8, 0.8],
|
|
||||||
outline: true,
|
|
||||||
centre: false
|
|
||||||
});
|
|
||||||
mp.game.graphics.drawText(medicString, [0.5, 0.945],
|
|
||||||
{
|
|
||||||
font: 4,
|
|
||||||
color: [255, 255, 255, 255],
|
|
||||||
scale: [0.4, 0.4],
|
|
||||||
outline: true,
|
|
||||||
centre: false
|
|
||||||
});
|
|
||||||
|
|
||||||
var alpha = fade + Math.floor(currentDate.getTime() / 1000 - deathDate.getTime() / 1000);
|
|
||||||
mp.game.graphics.set2dLayer(1);
|
|
||||||
mp.game.graphics.drawRect(0.5, 0.5, 1, 1, 0, 0, 0, alpha);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
mp.events.call("respawnDeathPlayer");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var medicString = "Derzeit befinden sich ~r~keine Einsatzkräfte ~s~im Dienst";
|
||||||
|
|
||||||
|
if (dutyMedics > 0) {
|
||||||
|
medicString = "Das L.S.E.D. wurde benachrichtigt\nDerzeit ";
|
||||||
|
|
||||||
|
if (dutyMedics === 1) {
|
||||||
|
medicString += "befindet sich ~g~" + dutyMedics + " Mitglied";
|
||||||
|
} else {
|
||||||
|
medicString += "befinden sich ~g~" + dutyMedics + " Mitglieder";
|
||||||
|
}
|
||||||
|
|
||||||
|
medicString += " ~s~im Dienst";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var currentDate = new Date();
|
||||||
|
deathSeconds = respawnTime - Math.floor(currentDate.getTime() / 1000);
|
||||||
|
|
||||||
|
if (deathSeconds <= 0) {
|
||||||
|
mp.events.call("respawnDeathPlayer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mp.game.graphics.set2dLayer(2);
|
||||||
|
mp.game.graphics.drawText("~HUD_COLOUR_RED~Du bist gestorben", [0.5, 0.425],
|
||||||
|
{
|
||||||
|
font: 7,
|
||||||
|
color: [255, 255, 255, 255],
|
||||||
|
scale: [0.8, 0.8],
|
||||||
|
outline: true,
|
||||||
|
centre: true
|
||||||
|
});
|
||||||
|
mp.game.graphics.drawText("Du wirst in " + deathSeconds + " Sekunden wiederbelebt", [0.5, 0.475],
|
||||||
|
{
|
||||||
|
font: 4,
|
||||||
|
color: [255, 255, 255, 255],
|
||||||
|
scale: [0.4, 0.4],
|
||||||
|
outline: true,
|
||||||
|
centre: true
|
||||||
|
});
|
||||||
|
mp.game.graphics.drawText(medicString, [0.5, 0.945],
|
||||||
|
{
|
||||||
|
font: 4,
|
||||||
|
color: [255, 255, 255, 255],
|
||||||
|
scale: [0.4, 0.4],
|
||||||
|
outline: true,
|
||||||
|
centre: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var alpha = fade + Math.floor(currentDate.getTime() / 1000 - deathDate.getTime() / 1000);
|
||||||
|
mp.game.graphics.set2dLayer(1);
|
||||||
|
mp.game.graphics.drawRect(0.5, 0.5, 1, 1, 0, 0, 0, alpha);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user