Jump to content

Search the Community

Showing results for tags 'zone'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • RAGE Multiplayer
    • Announcements
    • Discussion
    • Suggestions
  • Scripting
    • Scripting
    • Resources
  • Community
    • Support
    • Servers
    • Media Gallery
  • Non-English
    • Русский - Russian
    • Français - French
    • Deutsch - German
    • Espanol - Spanish
    • Română - Romanian
    • Portuguesa - Portuguese
    • Polski - Polish

Categories

  • Scripts
  • Gamemodes
  • Libraries
  • Plugins
  • Maps
  • Tools

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Facebook


Youtube


Skype


Web


VK

Found 3 results

  1. Version 1.0.0

    509 downloads

    I recently needed a polygons library like this for my gamemode to define some companies, houses, gangzones and other kind of establishments boundaries, so I decided to create this resource previously based on abmn's zone manager, but the code was terrible and I decided to rewrite my own from scratch and improving the functionality. Basically you'll be able to create any kind of colshape you want, without worring about combining colshapes to fit your needs, you can just define the points and the height of the shape and it'll be created easily! You can set boundaries for houses to move furnitures, for companies to accomplish the job, for mountains in hunting animals scripts and anything else your creativity takes you, just use it! Demos https://streamable.com/w7l4h6 https://youtu.be/OxSPcVQrWrY Advantages The main advantages of using this resource instead of abmn's are: These polygons are dynamic, you can modify, move, rotate, basically do anything to the polygon vertices array in real time and it'll work instantaneously, updating the collisions with players. This script is way more optimized and lightweight than the other version. You can choose the color for the lines of the polygon and set them visible or not by just modifying the polygon `visible` property. This script supports different kind of heights for detecting collision (eg.: slopes), it's accurate (may not work as you think it should depending on the slope degree and the polygon height), and supports even colshapes for mountains. You can add more vertex at any time you want to existing polygons, by just pushing a new vector3 position to `polygon.vertices` array. API Functions /* Creates a new polygon and return it's instance */ mp.polygons.add(vertices: Vector3Mp[], height: number, options = { visible: false, lineColorRGBA: [255,255,255,255], dimension: 0 }): Polygon /* Removes a polygon */ mp.polygons.remove(polygon: Polygon): void /* Check if a polygon exists */ mp.polygons.exists(polygon: Polygon): boolean /* Check if a position is contained within a given polygon */ mp.polygons.isPositionWithinPolygon(position: Vector3Mp, polygon: Polygon): boolean /* Examples */ // Creating a new polygon const polygon = mp.polygons.add([new mp.Vector3(10, 10, 5), new mp.Vector3(15, 15, 5), new mp.vector3(5, 5, 5)], 10, { visible: false, lineColorRGBA: [255,255,255,255], dimension: 0 }); // Set the polygon lines visible polygon.visible = true; // Modifying a polygon height polygon.height = 100; // Modifying a polygon color (RGBA) polygon.lineColorRGBA = [255, 155, 0, 255]; // Modifying a polygon dimension polygon.dimension = 30; /* Events*/ // Event called when player enter a polygon (clientside) mp.events.add('playerEnterPolygon', (polygon) => mp.gui.chat.push(`You entered the polygon ${polygon.id}!`)); // Event called when the local player leaves a polygon (clientside) mp.events.add('playerLeavePolygon', (polygon) => mp.gui.chat.push(`You left the polygon ${polygon.id}.`)); How to install Download the zip folder Extract it on your clientside folder Require the index file from the polygons folder. Enjoy it! See you on the next release! - n0minal
  2. Have a good evening everyone. Please tell me why when my create a glare when you zoom in on a map, the glare starts to float. I create a flare on the server side. An example of my highlight: let blip = mp.blips.new(9, new mp.Vector3(x,y,z), { radius: 180, dimension: 1, color: 35, alpha: 175, rotation: 0 }); Maybe some additional argument is missing? P.S. 0.3.7
  3. Пример создания зон, территорий, и событий когда игрок входит/покидает их. Зоны будут 2х типов 2D и 3D, различия между ними в том что 3D зона имеет высоту равную ее радиусу, то есть если игрок находится выше или ниже радиуса зоны то он в ней не находится, 2D же зоны не имеют высоты и игрок находясь на любом уровне на/под ними все равно находится внутри. Создаем в каталоге 'packages/keker' файл 'zones.js', объявим его в 'packages/keker/index.js' добавив туда строку: require("./zones"); Добавляем в 'zones.js' этот код: mp.Vector3.Distance = function (v1, v2){ return (Math.sqrt(Math.pow((v2.x - v1.x),2) + Math.pow((v2.y - v1.y),2)+ Math.pow((v2.z - v1.z),2))); } mp.Vector3.Distance2D = function (v1, v2){ return (Math.sqrt(Math.pow((v2.x - v1.x),2) + Math.pow((v2.y - v1.y),2))); } var Zone = class Zone { constructor(n ,v, r, t){ this.name = n; // Название зоны this.center = v; // Центральная точка this.radius = r; // Радиус this.type = t; // Тип 2D или 3D this.insidePlayers = []; // Массив игроков находящихся в зоне this.interval = InitInterval(this); } BroadcastMessage(s){ // Фунция рассылки сообщения игрокам находящимся в нутри этой зоны this.insidePlayers.forEach(player => { player.outputChatBox(s); }); } } function InitInterval(zone){ return setInterval(function(){ mp.players.forEach(player => { let dist = (zone.type=="2D") ? mp.Vector3.Distance2D(player.position, zone.center) : mp.Vector3.Distance(player.position, zone.center); if(dist < zone.radius && zone.insidePlayers.indexOf(player) < 0){ zone.insidePlayers.push(player); mp.events.call("playerEnterZone", zone, player); } else if (dist > zone.radius && zone.insidePlayers.indexOf(player) >= 0){ zone.insidePlayers.splice(zone.insidePlayers.indexOf(player), 1); mp.events.call("playerExitZone", zone, player); } }) }, 500); } var Zones = class Zones { constructor(){ this._Zone = Zone; this.zones = []; } Add(n, v, r, t){ if(this.zones[n]) this.Remove(n); let z = new this._Zone(n, v, r, t); this.zones[n] = z; return z; } AddZone3D(n, v, r){ return this.Add(n, v, r, '3D'); } AddZone2D(n, v, r){ return this.Add(n, v, r, '2D'); } Remove(n){ let z = this.zones[n]; clearInterval(z.interval); delete this.zones[n]; } Get(n){ return this.zones[n]; } } mp.Zones = new Zones(); mp.events.add({"playerQuit" : (player, reason, kickReason) => { for(let key in mp.Zones.zones) { // Удаление игрока из зоны при выходе let zone = mp.Zones.zones[key]; if (zone.insidePlayers.indexOf(player) >= 0){ zone.insidePlayers.splice(zone.insidePlayers.indexOf(player), 1); } } } }); Теперь в любом удобном месте, или в 'events/common.js' добавляем события для зон: mp.events.add({ "playerEnterZone": (zone, player) => { /* Событие когда игрок вошел в зону на входе получаем zone - обьект зоны, и игрока - player */ }, "playerExitZone": (zone, player) => { /* Событие когда игрок покинул зону на входе получаем zone - обьект зоны, и игрока - player */ } }); Методы и свойства для работы с зонами: let zone = mp.Zones.AddZone3D("zone1", new mp.Vector3(10, 25, 46), 10); // Создает 3D зону с названием zone1, в точке X:10;Y:25;Z:46; и радиусом 10 let zone = mp.Zones.AddZone2D("zone1", new mp.Vector3(10, 25, 46), 10); // Создает 2D зону с названием zone1, в точке X:10;Y:25;Z:46; и радиусом 10 let zone = mp.Zones.Get('zone1'); // Получает зону с названием zone1 mp.Zones.Remove('zone1'); // Удаляет зону zone1 zone.BroadcastMessage("Сообщение"); // Рассылает игрокам находящимся в зоне чат сообщение; zone.insidePlayers // Массив с игроками находящимися в зоне zone.name // Название зоны Прошу строго не судить так как это костыльный метод, пока данный функционал не добавят в API.
×
×
  • Create New...