Scaleforms Module
The scaleforms module offers you the option to draw/hide gta scaleforms for the specific player. At the moment its only possible to draw an industrial button menu but we already have more ideas for the future.
Requirements
This module requires you to have some kind of dependency injection set up in your project that uses the Microsoft's Dependency Injection.
Not sure how to implement that? We've got you covered! Our boilerplate has everything you need to get started.
Getting started
Start by installing the latest version from Nuget. You will need to install both server-side and client-side packages for the module to work properly.
Initialization
A quick and simple example:
Note
This has to be done on client-side!
var builder = Host.CreateDefaultBuilder( );
builder.ConfigureServices( (context, services) =>
{
services.RegisterScaleformModule( ); // <--- Register the scaleforms module
} );
var host = builder.UseConsoleLifetime( ).Build( );
_ = host.Services.InitializeScaleformModule( ); // <-- Initialize the scaleforms module
await host.RunAsync();
Tip
If you still have problems initializing the module you can check out the scaleforms module example in our boilerplate!
Using the module
You can use the module both on client-side and server-side.
Client-side
var myButtons = List<IndustrialButton>( )
{
new IndustrialButton
{
InstructionalButtonsString = Alt.Natives.GetControlInstructionalButtonsString( 0, 21, true ),
DisplayText = "Atlas"
}
};
AtlasScaleform.DrawIndustrialMenuEveryTick( myButtons ); // this has to be used when you are not in an everytick
Server-side
var myButtons = List<IndustrialButton>( )
{
new IndustrialButton
{
InstructionalButtonsString = Alt.Natives.GetControlInstructionalButtonsString( 0, 21, true ),
DisplayText = "Atlas"
}
};
player.DrawIndustrialMenuScaleform( myButtons );
//if you later wanna hide the menu you can call
player.HideIndustrialMenuScaleform();
Examples
You can find examples for all our modules in our boilerplates client-side and server-side