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!"); } }
There was an error while loading. Please reload this page.