added library for polygons
This commit is contained in:
20
ReallifeGamemode.Client/polygons/events.js
Normal file
20
ReallifeGamemode.Client/polygons/events.js
Normal file
@@ -0,0 +1,20 @@
|
||||
setInterval(() => {
|
||||
const { position, dimension } = mp.players.local;
|
||||
|
||||
mp.polygons.pool.map((polygon) => {
|
||||
|
||||
if (polygon.colliding) {
|
||||
if (!mp.polygons.isPositionWithinPolygon(position, polygon, dimension)) {
|
||||
polygon.colliding = false;
|
||||
mp.events.call('playerLeavePolygon', polygon);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (mp.polygons.isPositionWithinPolygon(position, polygon, dimension)) {
|
||||
polygon.colliding = true;
|
||||
mp.events.call('playerEnterPolygon', polygon);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}, 100);
|
||||
Reference in New Issue
Block a user