index.js vom polygon hinzugefügt

This commit is contained in:
Fabian
2021-04-22 17:24:22 +02:00
parent ce7791a693
commit 17c2392a64
4 changed files with 53 additions and 6 deletions

View File

@@ -0,0 +1,23 @@

export function isPlayerInNoDMZone(pos) {
if (pos.x >= -540 && pos.x <= -531
&& pos.y >= -2151 && pos.y <= -2139) {
return true;
}
return false;
}
export default function nodmHandler() {
mp.events.add('playerEnterPolygon', (polygon) => {
mp.gui.chat.push("entered");
});
mp.events.add('playerLeavePolygon', (polygon) => {
mp.gui.chat.push("leaved");
});
setInterval(() => {
mp.events.call('toggleNoDmZone', isPlayerInNoDMZone(mp.players.local.position));
}, 200);
}