Changed whole project structure (split client and server into separat projects)
This commit is contained in:
208
ReallifeGamemode.Client/Gui/infobox.js
Normal file
208
ReallifeGamemode.Client/Gui/infobox.js
Normal file
@@ -0,0 +1,208 @@
|
||||
/**
|
||||
* @overview Life of German Reallife - Gui Infobox infobox.js
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
var currentdate;
|
||||
var dateString;
|
||||
var timeString;
|
||||
|
||||
var draw = false;
|
||||
var editMode = false;
|
||||
|
||||
let posX = 0.92;
|
||||
let posY = 0.45;
|
||||
let width = 0.1;
|
||||
let height = 0.2;
|
||||
let colorR = 0;
|
||||
let colorG = 0;
|
||||
let colorB = 0;
|
||||
let colorA = 72;
|
||||
|
||||
var day;
|
||||
var month;
|
||||
var year;
|
||||
var hour;
|
||||
var minute;
|
||||
var second;
|
||||
|
||||
var nDay;
|
||||
var nMonth;
|
||||
var nHour;
|
||||
var nMinute;
|
||||
var nSecond;
|
||||
|
||||
var playerName;
|
||||
var playerId;
|
||||
var playerMoney;
|
||||
|
||||
mp.events.add("draw", (pName, pId) => {
|
||||
playerName = pName;
|
||||
playerId = pId;
|
||||
draw = true;
|
||||
|
||||
});
|
||||
|
||||
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.'));
|
||||
//}
|
||||
|
||||
const moneyFormat = require("moneyformat");
|
||||
|
||||
mp.events.add("updateMoney", (money) => {
|
||||
playerMoney = moneyFormat(money);
|
||||
});
|
||||
|
||||
mp.events.add("render", () => {
|
||||
|
||||
if (draw === true) {
|
||||
currentdate = new Date();
|
||||
|
||||
day = currentdate.getDate();
|
||||
month = currentdate.getMonth();
|
||||
year = currentdate.getFullYear();
|
||||
|
||||
hour = currentdate.getHours();
|
||||
minute = currentdate.getMinutes();
|
||||
second = currentdate.getSeconds();
|
||||
|
||||
if (day < 10) {
|
||||
nDay = "0" + day;
|
||||
} else nDay = day;
|
||||
|
||||
if (hour < 10) {
|
||||
nHour = "0" + hour;
|
||||
} else nHour = hour;
|
||||
|
||||
if (minute < 10) {
|
||||
nMinute = "0" + minute;
|
||||
} else nMinute = minute;
|
||||
|
||||
if (second < 10) {
|
||||
nSecond = "0" + second;
|
||||
} else nSecond = second;
|
||||
|
||||
switch (month) {
|
||||
case 0:
|
||||
nMonth = "Jan.";
|
||||
break;
|
||||
case 1:
|
||||
nMonth = "Feb.";
|
||||
break;
|
||||
case 2:
|
||||
nMonth = "Mär.";
|
||||
break;
|
||||
case 3:
|
||||
nMonth = "Apr.";
|
||||
break;
|
||||
case 4:
|
||||
nMonth = "Mai";
|
||||
break;
|
||||
case 5:
|
||||
nMonth = "Jun.";
|
||||
break;
|
||||
case 6:
|
||||
nMonth = "Jul.";
|
||||
break;
|
||||
case 7:
|
||||
nMonth = "Aug.";
|
||||
break;
|
||||
case 8:
|
||||
nMonth = "Sep.";
|
||||
break;
|
||||
case 9:
|
||||
nMonth = "Okt.";
|
||||
break;
|
||||
case 10:
|
||||
nMonth = "Nov.";
|
||||
break;
|
||||
case 11:
|
||||
nMonth = "Dez.";
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
dateString = nDay + ". " + nMonth + " " + year;
|
||||
timeString = nHour + ":" + nMinute + ":" + nSecond + " Uhr";
|
||||
|
||||
mp.game.graphics.requestStreamedTextureDict("digitaloverlay", true);
|
||||
//static
|
||||
mp.game.graphics.drawSprite("digitaloverlay", "static1", posX, posY, width, height, 0, 0, 255, 0, 88);
|
||||
//mp.game.graphics.drawRect(posX, posY, width, height, colorR, colorG, colorB, colorA);
|
||||
mp.game.graphics.drawText(playerName + " (" + playerId + ")", [0.92, 0.351],
|
||||
{
|
||||
font: 4,
|
||||
color: [255, 255, 255, 255],
|
||||
scale: [0.5, 0.5],
|
||||
outline: true
|
||||
})
|
||||
|
||||
mp.game.graphics.drawText(dateString + "\n" + timeString, [0.938, 0.381],
|
||||
{
|
||||
font: 4,
|
||||
color: [255, 255, 255, 255],
|
||||
scale: [0.5, 0.5],
|
||||
outline: true
|
||||
})
|
||||
|
||||
mp.game.graphics.drawText("~g~$~s~" + playerMoney, [0.938, 0.441],
|
||||
{
|
||||
font: 4,
|
||||
color: [255, 255, 255, 255],
|
||||
scale: [0.5, 0.5],
|
||||
outline: true
|
||||
})
|
||||
mp.game.graphics.drawText("~r~Datum: ", [0.89, 0.381],
|
||||
{
|
||||
font: 4,
|
||||
color: [255, 255, 255, 255],
|
||||
scale: [0.5, 0.5],
|
||||
outline: true
|
||||
})
|
||||
mp.game.graphics.drawText("~r~Uhrzeit: ", [0.891, 0.411],
|
||||
{
|
||||
font: 4,
|
||||
color: [255, 255, 255, 255],
|
||||
scale: [0.5, 0.5],
|
||||
outline: true
|
||||
})
|
||||
mp.game.graphics.drawText("~y~Bank: ", [0.887, 0.441],
|
||||
{
|
||||
font: 4,
|
||||
color: [255, 255, 255, 255],
|
||||
scale: [0.5, 0.5],
|
||||
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
|
||||
})
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user