/** * @overview Life of German Reallife - Gui Infobox infobox.js * @author VegaZ * @copyright (c) 2008 - 2018 Life of German */ var currentdate; var timeString; var draw = false; var draw = 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; mp.events.add("draw", () => { draw = true; }); 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; } timeString = "~r~Datum: ~s~" + nDay + ". " + nMonth + " " + year + "\n~r~Uhrzeit: ~s~" + nHour + ":" + nMinute + ":" + nSecond + " Uhr"; mp.game.graphics.drawRect(posX, posY, width, height, colorR, colorG, colorB, colorA); mp.game.graphics.drawText(timeString, [0.92, 0.35], { font: 4, color: [255, 255, 255, 255], scale: [0.5, 0.5], outline: true }) } });