Create Your Own Trainer - Part 1

Creating The Visual Studio Project

This tutorial assumes you have a working knowledge of Visual Studio and a basic understanding of programming and the C#  language. Good news is that this tutorial will guide you step by step, even if you're an absolute beginner.

With Visual Studio installed (VS 2019 used for tutorial), we will start by creating a new project. From the screenshot below we select Create a new project at the bottom right of the screen.

Throughout this tutorial, and the site in general,  clicking on an image will provide you with a much bigger and  easier to read image.

From the next screen, we will select Class Library, .NET Framework and C#. Please note that you are not limited to C# but this is the most commonly used language for GTA 5 scripts. Select Next to continue the project creation.

For our next step you can give your project any name you want. The project save location is shown as the default for Visual Studio but you can choose your location. Keep the net framework as 4.8. Now you can select Create and this will open the project.

In the screenshot below we can see our project is open. You'll also note that we've copy pasted the minimal code required to create a LemonUI Trainer and the first step is a simple menu. Remember that the code provided, from the link, will replace the default visual studio code which appears when you created and first opened your project.

For our project to use the proper programming libraries, we need to select them from the Solution Explorer on the right side of our screen. We select References,  then right click and from the context menu we can select Add Reference which will display available assemblies and allow us to browse for our GTA 5 mod libraries such as SHVDN and LemonUI.

Some of the references, for example ScriptHookVDotNet (version 3) and LemonUI.SVHDN3 will be installed in our GTA 5 game folder, so we need to click Browse to find them. Once found we make sure they are checked as in the screenshot below.

For this particular project we will also need System.Windows.Forms and since this is a Windows reference we click Assemblies this time. We can use the search box to quickly find this reference by typing in forms. Once more make sure the box is checked.

Once you've finished adding references you need to add them to the code as well with a statement called using. For example, using GTA. We had already done this and you can see the references are all displayed in white. 

Note: if you are missing a mandatory reference, or one not used by the project, the using statement will appear in grey. Missing references, meaning those that will indeed be used, will generate compiler errors if missing or improperly installed.

Go To Part 2 of this Tutorial