diff --git a/ReallifeGamemode.Client/Gui/infobox.ts b/ReallifeGamemode.Client/Gui/infobox.ts index b837d579..cf1ba033 100644 --- a/ReallifeGamemode.Client/Gui/infobox.ts +++ b/ReallifeGamemode.Client/Gui/infobox.ts @@ -28,6 +28,7 @@ export default function (globalData: IGlobalData): void { var cdTimestamp; var countdownText; var blackScreenMode = false; + let spawnschutz = false; let posX = 0.92; let posY = 0.45; @@ -89,6 +90,10 @@ export default function (globalData: IGlobalData): void { noDmZone = toggle; }); + mp.events.add("toggleSpawnschutz", (toggle) => { + spawnschutz = toggle; + }); + mp.events.add("jailTime", (time) => { jailTime = JSON.parse(time); }); @@ -361,6 +366,17 @@ export default function (globalData: IGlobalData): void { }) } + if (spawnschutz) { + mp.game.graphics.drawText("~r~Spawnschutz", [0.92, 0.75], + { + font: 2, + color: [255, 255, 255, 255], + scale: [0.7, 0.7], + outline: true, + centre: false + }) + } + if (countdown > 0) { var now = Date.now(); var diff = Math.trunc((now - cdTimestamp) / 1000); diff --git a/ReallifeGamemode.Client/Login/main.ts b/ReallifeGamemode.Client/Login/main.ts index 3fe6e020..e1ab88b7 100644 --- a/ReallifeGamemode.Client/Login/main.ts +++ b/ReallifeGamemode.Client/Login/main.ts @@ -69,5 +69,7 @@ export default function (globalData: IGlobalData): void { globalData.InMenu = false; loginCam.setActive(false); mp.game.cam.renderScriptCams(false, false, 0, true, false); + + mp.events.call("toggleSpawnschutz", true); }); } \ No newline at end of file diff --git a/ReallifeGamemode.Client/Player/spawnschutz.ts b/ReallifeGamemode.Client/Player/spawnschutz.ts new file mode 100644 index 00000000..8a6bf9bc --- /dev/null +++ b/ReallifeGamemode.Client/Player/spawnschutz.ts @@ -0,0 +1,9 @@ +export let spawnschutzEnabled = true; + +export default function spawnschutz() { + + setInterval(() => { + mp.events.call("toggleSpawnschutz", false); + spawnschutzEnabled = false; + }, 60000); +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index 598922bf..c2b161ab 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -268,6 +268,10 @@ antiAfk(globalData); import ammunation from './Interaction/ammunation/ammunation'; ammunation(globalData); +import spawnschutz from './Player/spawnschutz'; +spawnschutz(); + + require('./Gui/policedepartment'); require('./Gui/helptext'); require('./admin/spectate'); diff --git a/ReallifeGamemode.Client/util/weapondamage.ts b/ReallifeGamemode.Client/util/weapondamage.ts index 369289c1..18983512 100644 --- a/ReallifeGamemode.Client/util/weapondamage.ts +++ b/ReallifeGamemode.Client/util/weapondamage.ts @@ -1,6 +1,7 @@ import { isInAnyNoDMPolygon, listNoDMZones } from "../Player/nodm"; import polygons from "../polygons"; import { getWantedCount } from "../Gui/wanteds"; +import { spawnschutzEnabled } from "../Player/spawnschutz"; function isTargetInPolygon(pos): boolean { @@ -30,6 +31,10 @@ export default function weapondamageUtil() { if ((isTargetInPolygon(sourceEntity.position) || isInAnyNoDMPolygon) && getWantedCount() === 0) { return true; } + + if (spawnschutzEnabled) { + return true; + } }); mp.events.add("render", () => {