Skip to content

Groups RU

dev2alert edited this page Jan 27, 2022 · 1 revision

Главная ▸ Группы

Определение

Группа - это массив, который позволяет группировать Object, TextDraw и многие другие элементы.

Группа имеет функции create, destroy, show и hide, благодаря которым можно выполнять действия над элементами.

Пример

Создание и показ TextDraw:

import {GameMode, Group, Player, TextDraw} from "@sa-mp/core";

const textdraws: Group<TextDraw> = new Group(
    new TextDraw({text: "Text #1!", x: 300, y: 100, color: 0xf2630aAA}),
    new TextDraw({text: "Text #2!", x: 300, y: 150, color: 0xf2630aAA}),
    new TextDraw({text: "Text #3!", x: 300, y: 200, color: 0xf2630aAA}),
    new TextDraw({text: "Text #4!", x: 300, y: 250, color: 0xf2630aAA}),
    new TextDraw({text: "Text #5!", x: 300, y: 300, color: 0xf2630aAA})
);

GameMode.on("init", () => textdraws.create());

Player.on("connect", (player) => textdraws.show(player));

Clone this wiki locally