-
Notifications
You must be signed in to change notification settings - Fork 2
Context API Getting Started
dev2alert edited this page Feb 4, 2022
·
1 revision
Home ▸ Context API ▸ Getting started
Context is a class whose instance is created when initializing something (for example: when connecting a player).
Factory is a class that allows you to manage contexts.
Creating game mode context:
// index.ts
import {GameMode} from "@sa-mp/core";
import {Mode} from "./mode.gctx";
GameMode.Factory.create(Mode);
// mode.gctx
import {GameMode} from "@sa-mp/core";
import {Context} from "@sa-mp/decorators";
@Context()
export class Mode extends GameMode.Context {
public onInit(): void {
console.log("[Mode] Init!");
}
}
- Getting started [RU]
- Configuration [RU]
- Command line interface (CLI) [RU]
- Examples [RU]
- Player commands [RU]
- Keyboard [RU]
- Dialogs [RU]
- Groups [RU]
- Context API [RU]
- AMX API [RU]