Add DeathScreen
This commit is contained in:
49
Client/Gui/deathscreen.js
Normal file
49
Client/Gui/deathscreen.js
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @overview Life of German Reallife - Gui Infobox infobox.js
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
var playerName;
|
||||
var playerId;
|
||||
var playerMoney;
|
||||
|
||||
var isDeath = false;
|
||||
var deathTime;
|
||||
var respawnTime;
|
||||
var deathSeconds;
|
||||
|
||||
mp.events.add("startDeathTimer", () => {
|
||||
if (isDeath === false) {
|
||||
isDeath = true;
|
||||
mp.gui.chat.activate(false);
|
||||
mp.gui.chat.show(false);
|
||||
deathDate = new Date();
|
||||
respawnTime = deathDate.getSeconds() + 120;
|
||||
secondsToAlpha = 120;
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add("onPlayerRevived", () => {
|
||||
isDeath = false;
|
||||
mp.gui.chat.activate(true);
|
||||
mp.gui.chat.show(true);
|
||||
});
|
||||
|
||||
mp.events.add("render", () => {
|
||||
|
||||
if (isDeath === true) {
|
||||
currentDate = new Date();
|
||||
|
||||
deathSeconds = respawnTime - currentDate.getSeconds();
|
||||
mp.game.graphics.drawText("~y~" + deathSeconds, [0.5, 0.5],
|
||||
{
|
||||
font: 7,
|
||||
color: [255, 255, 255, 255],
|
||||
scale: [0.8, 0.8],
|
||||
outline: true
|
||||
})
|
||||
mp.game.graphics.drawRect(0.5, 0.5, 1, 1, 0, 0, 0, deathSeconds);
|
||||
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user