Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[C#] Grand Theft Auto V: Modding Guide Part 1 - Setting up your workspace

Joined
Feb 22, 2012
Messages
2,100
Reaction score
1,271
Hello guys. Well, I'm going to make an (hopefully) easy-to-follow tutorial, on how to develop for GTA V using ScriptHookV.net.

On this tutorial I'll explain quickly on how to make your workspace ready for development.

With ScriptHookVdotnet you can simply add yourmod.cs in the scripts folder and start writing your script, but we are going to do this the right way, for bigger projects.

Requirements:

  • Visual Studio (or any other C# compiler)
    • I'm using Visual Studio 2015 Professional
  • .NET Framework ≥ 4.5.2 ( fixed, thanks Hashed )
    • I'm using .Net Framework 4.6
  • Understanding how to install mods (not going much into this subject, assuming you already know the basics)
  • Latest
    • No need to use the SDK version, since in this tutorial we'll be using ScriptHookVdotNet.
    • If you don't update this constantly, chances are that your game might brick in the next update. If it happens, just update the scripthook...
  • Latest ( in this case: )
    • Make sure to always keep this updated!

Installing Visual Studio:

0. Installing the Mods

a. Install ScriptHookV
  1. Open ScriptHookV_xxx.zip , and open "bin" folder.
  2. Extract dinput8.dll and ScriptHookV.dll inside GTAV's root folder; NativeTrainer.asi is optional (it's a simple trainer).

b. Install ScriptHookV.net

  1. Open ScriptHookVDotNet.zip
  2. Extract ScriptHookVDotNet.asi, ScriptHookVDotNet.dll, ScriptHookVDotNet.xml into the GTAV's root folder.
  3. Create a folder called "scripts" inside GTAV's root folder.

1. The Project

a. Setting up the project
First, open Visual Studio. In the tab, click in "File" > "New" > "Project..."

c1964e5c29703bef555f70df7f4fd138 - [C#] Grand Theft Auto V: Modding Guide Part 1 - Setting up your workspace - RaGEZONE Forums


You'll be prompted with this screen:

aebf6820f281853ab8e6d3af40f85ad8 - [C#] Grand Theft Auto V: Modding Guide Part 1 - Setting up your workspace - RaGEZONE Forums


Make sure it's in Installed > Templates > Visual C# > Windows ( left area ), and select Class Library.

In the bottom, you'll have Name, Location and Solution Name. In this case, Name will be "RagezoneTest".

Click in OK to create the project.

b. Adding the references

You will now have to add some references. They are libraries for your project.

You'll have a screen like this:

4849a2e4904538fa92c4d8ebdf9a8e36 - [C#] Grand Theft Auto V: Modding Guide Part 1 - Setting up your workspace - RaGEZONE Forums


You may or may not have the Solution Explorer ( ) showing as default. If you do not, please press Ctrl + Alt + L.

In the Solution Explorer, right click in References > Add Reference...

6f078a58980dbbf2049f36e4db4940ed - [C#] Grand Theft Auto V: Modding Guide Part 1 - Setting up your workspace - RaGEZONE Forums


You'll be prompted with the Reference Manager.

c00a8343e71f57b8fa9dbc68ccaafd23 - [C#] Grand Theft Auto V: Modding Guide Part 1 - Setting up your workspace - RaGEZONE Forums


On the top you'll see "Search Assemblies", and then input: System.Windows.Forms and check the box.

902f7001b6d7c49c88f3654c5385aa83 - [C#] Grand Theft Auto V: Modding Guide Part 1 - Setting up your workspace - RaGEZONE Forums


Do the same for System.Windows.Drawing.

Go to Browse ( ) and click on the button "Browse...", located at the bottom.

Go to GTA V path, and select the "ScriptHookVDotNet.dll" you've extracted before. And then click in OK.

Rename Class1.cs to RZTest.cs ( and then click in Rename, then YES).

Replace your code to:

PHP:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GTA;

namespace RagezoneTest
{
    public class RZTest : Script
    {
        public RZTest()
        {
            UI.Notify("Hello World");
        }
    }
}

This is going to prompt an Notification with the text "Hello World" on the screen once everything is done.

I'm going to explain how it works in the next part, but for now, only replace it!

Click in Start
6487d85511e0deb4d48152a5d745b490 - [C#] Grand Theft Auto V: Modding Guide Part 1 - Setting up your workspace - RaGEZONE Forums


Hopefully, you will see a screen like this:

fb53e1e6ca90115bff8d8f7128431de1 - [C#] Grand Theft Auto V: Modding Guide Part 1 - Setting up your workspace - RaGEZONE Forums


It means that it has been successfully compiled!

Click in OK.


3. Installing the Trainer

Go to the folder where you have created your project (you can easily find it right-clicking on the filename tab and clicking on "Open Containing Folder").

18f039bdfa043e8c31c69f936a6f6e8d - [C#] Grand Theft Auto V: Modding Guide Part 1 - Setting up your workspace - RaGEZONE Forums


Go to folder bin > debug and copy RagezoneTest.dll (normally it is your ProjectName.dll).

Paste it on the GTAV's root path > scripts folder (if it doesn't exist, create it!)

If your GTA V is open, unpause the game, and press the button Insert! This is going to reload all mods inside the scripts folder so it will freeze for a second.

If it's not open, just turn it on.

At the moment you turn it on you may see: .

Every time you click in the "Start" to recompile the .dll, the new version will go to the Debug folder. So either you manually copy it into the games folder every time you compile, or you set a post-build command to make the copy automatically ( ).


Next part soon (maybe today later)! Sorry for my terrible English though, guys :(:...

mudkip MentaL TimeBomb

Part 2: http://forum.ragezone.com/f578/grand-theft-auto-modding-guide-1100784/#post8623894
 

Attachments

You must be registered for see attachments list
Last edited:
Back
Top