Skip to main content Link Search Menu Expand Document (external link)

Base Classes

The Armoury Framework provides several Base Classes in order to avoid code duplication, and fasten your development time when creating resources.
Base Classes provide basic functionality and also functions which work as scripting shortcuts, and are meant to be extended by child classes which further add functionality to them.

The Base Classes of Armoury

The table below summarizes the role of each base class, and how you can make use of them:

Script Type (Server/Client) Class Name Description
Server ServerController The ServerController is the bread and butter of server scripts in the Armoury Framework. It is the starting point controller type and it is the base class which is used when generating a new Armoury resource.
Server ServerFactionController The ServerFactionController directly extends ServerController and contains functionality like Faction Vehicles, Faction Lockers, Faction Member Management and Faction HQs.
Server ServerDBDependentController The ServerDBDependentController directly extends ServerController and contains functionality for CRUD operations on a MySQL database (this one depends on oxmysql!).
Server ServerEntityWithEntranceController The ServerEntityWithEntranceController directly extends ServerDBDependentController and contains basic implementations for entrances and exits. An example resource extending this type of controller might be a 'houses' resource, or a 'businesses' one.
Script Type (Server/Client) Class Name Description
Client ClientController The ClientController is the bread and butter of client scripts in the Armoury Framework. It is the starting point controller type and it is the base class which is used when generating a new Armoury resource.
Client ClientWithUIController The ClientWithUIController directly extends ClientController and contains basic implementations for User Interfaces (UI). Whenever you're creating a resource which would contain UI, make use of this class to speed up your development.
Client ClientFactionController The ClientFactionController directly extends ClientWithUIController and contains the needed implementation in order to work with the ServerFactionController. When extending this class, you should also extend the ServerFactionController on the server script as well.

Internal Classes (NOT meant to be extended!)

Even though they should not be directly extended, it would make sense to have a quick overview of the functionality behind the scenes of the Armoury Framework:

Script Type (Server/Client) Class Name Description
Server ServerBase Contains shortcut functions for Routing Buckets
Client ClientBase Contains functionality for Routing Buckets and "tick functions" management
Client ClientEntities Contains functionality and code shortcuts for blips, markers, vehicles, peds, waypoints, and checkpoints
Client ClientActionPoints Contains functionality related to "action points" - places where stuff should be executed.

Extending Classes (or making use of the classes above)

When creating a new Armoury Resource using the automated scripts, a server controller usually looks like this:

// server.controller.ts
@FiveMController()
export class Server extends ServerController {
}

As you might already know, whenever you’re developing with the Armoury Framework, your implementation should go inside this class (either server.controller.ts/client.controller.ts/both).
Pretty often, you might need to create a resource which stores and loads data into and out of the database. In this case, you would most probably benefit from the implementations provided in the ServerDBDependentController base class. In order to make use of the base class, you can do the following:

// server.controller.ts
@FiveMController()
export class Server extends ServerDBDependentController<MyInterface> {
}

export interface MyInterface {
  id: number,
  owner: string,
}

* Notice how we are changing the extended class from “ServerController” to “ServerDBDependentController”

Please visit the list above in order to find out other classes which might help you when developing.


Table of contents