todesbildschirm angepasst

This commit is contained in:
Luke
2021-05-31 19:20:42 +02:00
parent 883a067fc1
commit b91fc42ecb

View File

@@ -17,32 +17,33 @@ export default function deathScreen() {
mp.game.gameplay.setFadeOutAfterDeath(false);
function deactivateDeathScreen() {
isDead = false;
mp.gui.chat.activate(true);
mp.game.gameplay.setFadeOutAfterDeath(false);
}
mp.events.add("startDeathTimer", (isSupporter) => {
if (isDead === false) {
if (isDead) {
return;
}
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.game.graphics.requestStreamedTextureDict("Mptattoos", true);
mp.events.call("GetDutyMedics");
}
});
mp.events.add("onPlayerRevived", () => {
isDead = false;
mp.gui.chat.activate(true);
mp.game.gameplay.setFadeOutAfterDeath(false);
mp.game.graphics.setStreamedTextureDictAsNoLongerNeeded("Mptattoos");
deactivateDeathScreen();
});
mp.events.add("respawnDeathPlayer", () => {
isDead = false;
mp.gui.chat.activate(true);
mp.game.gameplay.setFadeOutAfterDeath(false);
deactivateDeathScreen();
mp.events.callRemote('RespawnPlayerAtHospital');
mp.game.graphics.setStreamedTextureDictAsNoLongerNeeded("Mptattoos");
});
mp.events.add("updateDutyMedics", (count) => {
@@ -50,10 +51,13 @@ export default function deathScreen() {
});
mp.events.add("render", () => {
var currentDate = new Date();
if (isDead === true) {
var medicString;
if (!isDead) {
return;
}
var medicString = "Derzeit befinden sich ~r~keine Einsatzkräfte ~s~im Dienst";
if (dutyMedics > 0) {
medicString = "Das L.S.E.D. wurde benachrichtigt\nDerzeit ";
@@ -65,21 +69,33 @@ export default function deathScreen() {
}
medicString += " ~s~im Dienst";
} else {
medicString = "Derzeit befinden sich ~r~keine Einsatzkräfte ~s~im Dienst";
}
var currentDate = new Date();
deathSeconds = respawnTime - Math.floor(currentDate.getTime() / 1000);
if (deathSeconds >= 0) {
if (deathSeconds <= 0) {
mp.events.call("respawnDeathPlayer");
return;
}
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],
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: false
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],
{
@@ -87,16 +103,12 @@ export default function deathScreen() {
color: [255, 255, 255, 255],
scale: [0.4, 0.4],
outline: true,
centre: false
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);
} else {
mp.events.call("respawnDeathPlayer");
}
}
});
}