What's new

[How-To] GTAV - Create a Plugin/Script

Ironz

Ironz

Newbie
Messages
6
Reaction score
1
Points
45
Sin$
7
Grand Theft Auto V - Plugin/Script Creation
Requirements:
Windows System
Microsoft Visual Studio 2010 (or Higher)
Notepad++ (Optional)
Basic Knowledge of C++
Open Microsoft Visual Studio and start a new project.​




tAIZMhq.gif


Under Visual C++ templates, select 'Win32 Console Application', name your project and press OK.




0Aw9Bau.gif


This will take you to the application wizard, press next and select 'DLL' as the application type and 'Empty Project' under additional options, then press finish.


gAcMxoA.png


You now have a blank DLL project that you can work with.




YUs6SmQ.png


Add "GtaSDK.h" and "GtaSDK.cpp" to the project by right clicking the project and navigating to "Add->New Item". Remember that .cpp is 'Source Files' and .h is 'Header Files'.


http://i.imgur.com/nrTtjgW.gif



75G0dUU.gif


Code:
#include "GtaSDK.h"

/* Called every game tick */
PLUGIN_API VOID OnTick()
{
Player player = GPLAYER->PLAYER_ID();

GGAMEPLAY->SET_FIRE_AMMO_THIS_FRAME(player);
GGAMEPLAY->SET_EXPLOSIVE_AMMO_THIS_FRAME(player);
}

/* Called once when the plugin is loaded */
PLUGIN_API VOID OnLoad(CPluginSDK* PluginSDK)
{
LOAD_PLUGINSDK();
}

/* Called once when the plugin is unloaded */
PLUGIN_API VOID OnUnload()
{

}

Now add a new source file called "Anything.cpp"




iKhSOU1.gif


Code:
#include "GtaSDK.h"

DWORD GTimer = 0;
Any GBagHash = 0;
Any GCaseHash = 0;

PLUGIN_API VOID OnTick()
{
if (GetTickCount() - GTimer >= 500)
{
Vector3 pos = GENTITY->GET_ENTITY_COORDS(GPLAYER->PLAYER_PED_ID(), 0);

GSTREAMING->REQUEST_MODEL(GBagHash);
if (GSTREAMING->HAS_MODEL_LOADED(GBagHash))
{
GOBJECT->CREATE_AMBIENT_PICKUP(GCaseHash, pos.x, pos.y, pos.z + 1, 0, 40000, GBagHash, 0, 1);
GSTREAMING->SET_MODEL_AS_NO_LONGER_NEEDED(GBagHash);
}

GTimer = GetTickCount();
}
}

PLUGIN_API VOID OnLoad(CPluginSDK* PluginSDK)
{
LOAD_PLUGINSDK();

GBagHash = GGAMEPLAY->GET_HASH_KEY("prop_money_bag_01");
GCaseHash = GGAMEPLAY->GET_HASH_KEY("PICKUP_MONEY_CASE");
}

PLUGIN_API VOID OnUnload()
{

}

Right click your project and press properties at the very bottom, you should see a button near the top right that says 'Configuration Manager' that you'll want to open.


Press the drop down box on platform and select new. Under new platform, navigate to x64 and press Ok, In the Configuration drop down select Release then Close.


Now simply build your project and it should generate \x64\Release\Anything.dll


Place that DLL in the GTAPlugins directory of your loader and you should be able to now run it from the cheat.




7qouhIc.png
 
Gta_Modz

Gta_Modz

SanjuroDev
Messages
474
Reaction score
192
Points
155
Sin$
0
Nice tutorial this should help a lot of people good work.
 
Modder v7

Modder v7

Getting There
Messages
2,060
Reaction score
494
Points
220
Sin$
0
How to convert it to .asi extension or is that no longer used? I'm just a beginner.
 
Feder123

Feder123

Enthusiast
Messages
44
Reaction score
13
Points
65
Sin$
0
Hey, I really don't know too much about modding and codding but.... Is there an easy way to make our own "scripthookv.dll" to load up online, because the hooks we've been seeing are almost the Alexander's blade stuff, but modified... like clonehoov2, ghostv1, niggerhookv..... paying for hooks is a pretty bad idea, if we could make or own hook, it would be harder for R* to detect, I guess....
 
Modder v7

Modder v7

Getting There
Messages
2,060
Reaction score
494
Points
220
Sin$
0
Hey, I really don't know too much about modding and codding but.... Is there an easy way to make our own "scripthookv.dll" to load up online, because the hooks we've been seeing are almost the Alexander's blade stuff, but modified... like clonehoov2, ghostv1, niggerhookv..... paying for hooks is a pretty bad idea, if we could make or own hook, it would be harder for R* to detect, I guess....

No. There is no way to make your "own" scripthookv.dll because Alexander Blade has not released the full source code for it and never will. This is why you see mostly the same thing amongst the hooks; no one can really make their own version; they can just "reskin it and call it their own.

Do you know hexadecimal or C++? You said you have very little experience in this so, even if you knew what made up the ScripthookV code, you'd find it difficult to decipher. The paid menus are made by players who actually know this stuff so they can produce a "quality" hook for their customers. Making your own or using a free one has less security because the code is barely scrambled and/or changed. R* can easily make out the differences. The paid ones, however, R* has to invest more time in finding out the differences as the code is not jut twisted around.

I could go on about how paid hooks are better and how those who disagree are seriously mistaken but I'm not in the mood.
 
ubermensch007

ubermensch007

Newbie
Messages
28
Reaction score
9
Points
45
Sin$
7
ok now how do i do it with visual studio 2015? because I got errors up the wazzu...
wTWtf0R.png
 
Modder v7

Modder v7

Getting There
Messages
2,060
Reaction score
494
Points
220
Sin$
0
ok now how do i do it with visual studio 2015? because I got errors up the wazzu...
wTWtf0R.png

Hello, uber. I used to program in MSVS C++ and am trying to get back into it. I can help you with some of your errors (that are able to be viewed in the image provided).

Error 1: "Identifier ANY is undefined"
-If you haven't used this program before, the compiler (or the linker; I forget) is telling you that "ANY" is undefined and that you don't have a proper type defined. ANY is not a type recognized by VS 2015, so you need to look in the "types.h" or "enums.h" to find what kind of types you can use. You might have to include "types.h"/"enums.h" then. Usually it's an ENUM, so you'll have to look under the ENUM types defined. That should resolve the problem.

Error 2: "This declaration has no storage class or type specifier"
-Not sure about this one but I'm assuming you are tyring to call a class function and the program can't find it. Make sure that these functions are in the provided header: "GtaSDK.h".

Error 3: "Expected a ;"
-The program tells you you need to provide a semicolon at the end of your "OnTick() function.

Error 4: "identifier GETTICKCOUNT is undefined"
-Unless this function is mentioned under your header "GtaSDK.h", the program can't find this function and wants you to define it first before it is accepted. Usually RETURN TYPE (void if none) GETTICKCOUNT(PARAM1, PARAM2, etc);

Error 5: "identifier VECTOR3 is undefined"
-Same as Error 4. Vector3 is a class type of a struct called Vector3, so it would be "Vector3 pos" as you provided. The problem is the program can't find where this is defined so you need to define it before the program will allow you to use it.

Error 6, 7, 8, etc: identifier "X" is undefined"
-For some reason, the program can't find where you have declared/define these specific types/values/functions. Your compiler is yelling out you to find the file where these are located and include them. Even though you are telling the compiler to include "GtaSDK.h", make sure you actually have that file included. It should fix most of your problems. Your compiler is probably yelling out you for not including it in your project.

Whelp, that's all I can do for you. Provide more screenshots and I'll see if I can diagnose the rest of the errors. From the looks if it, you probably have repeating errors like the ones I solved.

Add "GtaSDK.h" and "GtaSDK.cpp" to the project by right clicking the project and navigating to "Add->New Item". Remember that .cpp is 'Source Files' and .h is 'Header Files'.
 
ubermensch007

ubermensch007

Newbie
Messages
28
Reaction score
9
Points
45
Sin$
7
Thanks Modder v7. I am a total noob. Im pretty sure I understand most of what you're saying. Ill try to correct these things. All i did here was follow intructions and copy and paste the OPs stuff so yeah im sure my gtaSDK.h and .cpp are just generic and empty. I have a long way to go I think. Ill get it, with a little help from my friends...
 
Modder v7

Modder v7

Getting There
Messages
2,060
Reaction score
494
Points
220
Sin$
0
Thanks Modder v7. I am a total noob. Im pretty sure I understand most of what you're saying. Ill try to correct these things. All i did here was follow intructions and copy and paste the OPs stuff so yeah im sure my gtaSDK.h and .cpp are just generic and empty. I have a long way to go I think. Ill get it, with a little help from my friends...

No problem, man. I'm happy to help. I'm getting back into C++ myself so you caught me at a great time. You know where to find me if you want quicker help :wink:
 
Top Bottom
Login
Register