Below are some steps to install ScriptHookVDotNet and add reference to project.
1. Install ScriptHookVDotNet
- Download the latest version of ScriptHookVDotNet from github.
Releases · scripthookvdotnet/scripthookvdotnet
- Copy the extracted content of the downloaded archive and paste into your GTA V game directory(where the GTA5.exe is located).
2. Add Reference in Your Project
- Open Visual Studio and create a new Class Library project with your preferred targeting framework.
- In your project, right click on “References”,and click “Add References”.
- Browse to the GTA5.exe directory(the game installation directory) and select the ‘ScriptHookVDotNet.dll’. This is the assembly you need to reference.
3. Write Your Script
- Write your script using the namespace provided by ScriptHookVDotNet, like ‘GTA’, ‘GTA.Native’, and others.
- Make sure your class inherits from ‘Script’ as you’ve done.
4. Build Your Project
- Build your project in Visual Studio. This will generate a .DLL file in your project’s bin/Debug or bin/Release directory, depending on your build configuration.
5. Copy Your Script to the Scripts Folder
- After Building your project, copy the generated DLL file(e.g. ‘MyScript.dll’) from your project’s bin/Debug or bin/Release folder to the “scripts” folder within your GTA V game directory.
6. Run the Game
- Start and Run your game GTA 5.