Merge develop into feature/inventory-system

This commit is contained in:
VegaZ
2018-11-26 17:53:25 +01:00
66 changed files with 4533 additions and 1302 deletions

View File

@@ -49,7 +49,7 @@ mp.events.add("respawnDeathPlayer", () => {
});
mp.events.add("updateDutyMedics", (count) => {
if (count == true)
if (count === true)
{
dutyMedics++;
}
@@ -70,11 +70,11 @@ mp.events.add("render", () => {
if (dutyMedics > 0) {
medicString = "Derzeit sind ~g~" + dutyMedics + " Medics ~s~im Dienst ~c~und versuchen dich wiederzubeleben...";
} else {
medicString = "Derzeit sind ~r~keine Medics ~s~im Dienst."
medicString = "Derzeit sind ~r~keine Medics ~s~im Dienst.";
}
deathSeconds = respawnTime - Math.floor(currentDate.getTime() / 1000);
var alpha = fade + (Math.floor((currentDate.getTime() / 1000) - (deathDate.getTime() / 1000)));
var alpha = fade + Math.floor(currentDate.getTime() / 1000 - deathDate.getTime() / 1000);
if (deathSeconds >= 0) {
mp.game.graphics.drawSprite("Mptattoos", "clearout", 0.625, 0.52, 0.1, 0.1, 0, 255, 255, 255, 236);
mp.game.graphics.drawText("Respawn in: ~y~" + deathSeconds, [0.5, 0.5],
@@ -83,14 +83,14 @@ mp.events.add("render", () => {
color: [255, 255, 255, 255],
scale: [0.8, 0.8],
outline: true
})
});
mp.game.graphics.drawText(medicString, [0.5, 0.975],
{
font: 4,
color: [255, 255, 255, 255],
scale: [0.4, 0.4],
outline: true
})
});
mp.game.graphics.drawRect(0.5, 0.5, 1, 1, 0, 0, 0, alpha);
} else {

View File

@@ -9,6 +9,7 @@ var dateString;
var timeString;
var draw = false;
var editMode = false;
let posX = 0.92;
let posY = 0.45;
@@ -43,6 +44,26 @@ mp.events.add("draw", (pName, pId) => {
});
mp.events.add("toggleEditMode", (toggle) => {
editMode = toggle;
});
mp.events.add("toggleUi", (show) => {
if (show === false) {
draw = false;
mp.game.ui.displayRadar(false);
mp.game.ui.displayHud(false);
mp.gui.chat.show(false);
globalData.HideGui = true;
} else {
draw = true;
mp.game.ui.displayRadar(true);
mp.game.ui.displayHud(true);
mp.gui.chat.show(true);
globalData.HideGui = false;
}
});
//function currencyFormatDE(num) {
// return ('$' + num.toFixed(2).replace('.', ',').replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.'));
//}
@@ -173,4 +194,13 @@ mp.events.add("render", () => {
outline: true
})
}
if (editMode === true) {
mp.game.graphics.drawText("~r~EDIT-MODE AKTIV", [0.5, 0],
{
font: 4,
color: [255, 255, 255, 255],
scale: [0.7, 0.7],
outline: true
})
}
});

57
Client/Gui/nametags.js Normal file
View File

@@ -0,0 +1,57 @@
const maxDistance = 25 * 25;
const width = 0.03;
const height = 0.0065;
const border = 0.001;
const color = [255, 255, 255, 255];
mp.nametags.enabled = false;
mp.events.add('render', (nametags) => {
const graphics = mp.game.graphics;
const screenRes = graphics.getScreenResolution(0, 0);
nametags.forEach(nametag => {
let [player, x, y, distance] = nametag;
if (distance <= maxDistance) {
let scale = distance / maxDistance;
if (scale < 0.6) scale = 0.6;
var health = player.getHealth();
health = health < 100 ? 0 : (health - 100) / 100;
var armour = player.getArmour() / 100;
y -= scale * (0.005 * (screenRes.y / 1080));
mp.game.graphics.drawText(player.name + " (" + player.remoteId + ")", [x, y],
{
font: 4,
color: [255, 255, 255, 255],
scale: [0.4, 0.4],
outline: true
});
if (mp.game.player.isFreeAimingAtEntity(player.handle)) {
let y2 = y + 0.042;
if (armour > 0) {
graphics.drawRect(x, y2, width + border * 2, 0.0085, 0, 0, 0, 200);
graphics.drawRect(x, y2, width, height, 150, 150, 150, 255);
graphics.drawRect(x - width / 2 * (1 - health), y2, width * health, height, 255, 255, 255, 200);
x2 = x + width / 2 + border / 2;
graphics.drawRect(x, y2 + height, width + border * 2, height + border * 2, 0, 0, 0, 200);
graphics.drawRect(x, y2 + height, width, height, 41, 66, 78, 255);
graphics.drawRect(x - width / 2 * (1 - armour), y2 + height, width * armour, height, 48, 108, 135, 200);
}
else {
graphics.drawRect(x, y2, width + border * 2, height + border * 2, 0, 0, 0, 200);
graphics.drawRect(x, y2, width, height, 150, 150, 150, 255);
graphics.drawRect(x - width / 2 * (1 - health), y2, width * health, height, 255, 255, 255, 200);
}
}
}
});
});