From 8c3778a729b2046c34372db0229466ed1b5c6026 Mon Sep 17 00:00:00 2001 From: Fabian Date: Thu, 22 Apr 2021 16:49:03 +0200 Subject: [PATCH] hydrant (dumm)kopfentwickler --- ReallifeGamemode.Client/Gui/infobox.ts | 26 +++++++++++++++++----- ReallifeGamemode.Client/Player/position.ts | 22 ++++++++++++++++++ ReallifeGamemode.Client/index.ts | 6 ++--- 3 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 ReallifeGamemode.Client/Player/position.ts diff --git a/ReallifeGamemode.Client/Gui/infobox.ts b/ReallifeGamemode.Client/Gui/infobox.ts index 5e53bb15..e3e26fff 100644 --- a/ReallifeGamemode.Client/Gui/infobox.ts +++ b/ReallifeGamemode.Client/Gui/infobox.ts @@ -1,8 +1,8 @@ /** - * @overview Life of German Reallife - Gui Infobox infobox.js - * @author VegaZ - * @copyright (c) 2008 - 2018 Life of German - */ +* @overview Life of German Reallife - Gui Infobox infobox.js +* @author VegaZ +* @copyright (c) 2008 - 2018 Life of German +*/ import moneyFormat from "../moneyformat"; @@ -16,6 +16,7 @@ export default function (globalData: IGlobalData): void { var adutyMode = false; var adminUnshow = false; var adminTSupport = false; + var noDmZone = false; var dutyMode = false; let jailTime = 0; let att_score = 0; @@ -84,6 +85,10 @@ export default function (globalData: IGlobalData): void { blackScreenMode = toggle; }); + mp.events.add("toggleNoDmZone", (toggle) => { + noDmZone = toggle; + }); + mp.events.add("jailTime", (time) => { jailTime = JSON.parse(time); }); @@ -345,6 +350,17 @@ export default function (globalData: IGlobalData): void { }) } + if (noDmZone) { + mp.game.graphics.drawText("~r~NoDM Zone", [0.907, 0.741], + { + font: 4, + color: [255, 255, 255, 255], + scale: [0.8, 0.8], + outline: true, + centre: false + }) + } + if (countdown > 0) { var now = Date.now(); var diff = Math.trunc((now - cdTimestamp) / 1000); @@ -367,4 +383,4 @@ export default function (globalData: IGlobalData): void { mp.game.graphics.drawRect(0, 0, 10000, 100000, 0, 0, 0, 255); } }); -} \ No newline at end of file +} diff --git a/ReallifeGamemode.Client/Player/position.ts b/ReallifeGamemode.Client/Player/position.ts new file mode 100644 index 00000000..d6343ddb --- /dev/null +++ b/ReallifeGamemode.Client/Player/position.ts @@ -0,0 +1,22 @@ + +export function isPlayerInNoDMZone(pos) { + if (pos.x >= -540 && pos.x <= -531 + && pos.y >= -2151 && pos.y <= -2139) { + return true; + } + return false; +} + +export default function positionHandler() { + + mp.events.add("checkPosition", (targetEntity) => { + + if (isPlayerInNoDMZone(mp.players.local.position) || isPlayerInNoDMZone(targetEntity.position)) { + mp.gui.chat.push("Kein DM in NODM!"); + } + }); + + setInterval(() => { + mp.events.call('toggleNoDmZone', isPlayerInNoDMZone(mp.players.local.position)); + }, 200); +} diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index 64ab04de..724e857f 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -186,6 +186,9 @@ ped(); import reportList from './Player/reportmenu'; reportList(globalData); +import positionHandler from './Player/position'; +positionHandler(); + import checkpointHandle from './util/checkpoint'; checkpointHandle(globalData); @@ -265,9 +268,6 @@ antiAfk(globalData); import ammunation from './Interaction/ammunation/ammunation'; ammunation(globalData); -import handsup from './Player/handsup'; -handsup(); - require('./Gui/policedepartment'); require('./Gui/helptext'); require('./admin/spectate');