Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commands registration

Emre Kara edited this page Sep 20, 2021 · 4 revisions

Which methods will be registered?

If you register the commands, the system will search in that specific assembly for all methods with a "CustomCommand" attribute.
The command can be private, public, static, non-static etc., it doesn't matter.

Anything to be worried about?

Yes! If you have non-static command methods, the system will need exactly one instance of that class.
For more information, read this article:
Instance for instance methods

Register

To register custom commands, use on of these codes.

using CustomCommandSystem.Integration;
using AltV.Net;

Alt.Core.RegisterCustomCommands();
Alt.Core.RegisterCustomCommands(Assembly assembly);

The first one will register all the commands in the current assembly (project).
With the second one you can also register commands from any other assembly.

Unregister

To unregister custom commands, use on of these codes.

using CustomCommandSystem.Integration;
using AltV.Net;

Alt.Core.UnregisterCustomCommands();
Alt.Core.UnregisterCustomCommands(Assembly assembly);

The first one will unregister all the commands in the current assembly (project).
With the second one you can also unregister commands from any other assembly.

Clone this wiki locally