Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
crosire

Community Script Hook V .NET

Recommended Posts

stef538

Alexander Blade made an update to his scripthook and it all seems to work now!

Download here

 

(Download link is thanks to Hertzofottoman)

Edited by stef538

Share this post


Link to post
Share on other sites
Nada_4D

Yeah, now we need new update of "ScriptHookVDotNet.dll" by Crosire. :lol:

Share this post


Link to post
Share on other sites
Cyron43

I am about to migrate my IV mods to V and I need to make a native function call but I can't do it via string literals like in the IV .net script hook. Can you please tell me where I can find the hash codes please? I mean, for example, what are the hash codes for
PRINT_STRING_WITH_LITERAL_STRING_NOW
TASK_HELI_MISSION

(Note: I posted the function names from IV as I don't know the names from V).

 

I just found out the Hash enum also provides the function names. Sorry, my bad. But I have another question: In IV I could call PRINT_STRING_WITH_LITERAL_STRING_NOW to get a text displayed in the upper left corner. How do I do that in V?

Edited by Cyron43

Share this post


Link to post
Share on other sites
unknown modder

 

 

Umm..can we modify the players Money? (Add or subtract) becoz I didn't found a native :/

There is a way to add money by using STAT_GET_INT and STAT_SET_INT, which is used in Alexander Blade's native trainer.

Here's my translated code:

void AddCash(int amount){    for (int i = 0; i < 3; i++) {        string statNameFull = string.Format("SP{0}_TOTAL_CASH", i);        int hash = Function.Call<int>(Hash.GET_HASH_KEY, statNameFull);        int val = 0;        OutputArgument outArg = new OutputArgument();        Function.Call<bool>(Hash.STAT_GET_INT, hash, outArg, -1);        val = outArg.GetResult<int>() + amount;        Function.Call(Hash.STAT_SET_INT, hash, val, true);    }} 
I tested it a little, and it seems to work just fine.rather than adding to everyone's bank, you could compare player model to see which person is currently active and only add to their bank

Share this post


Link to post
Share on other sites
crosire

Updated to latest Script Hook V.

Share this post


Link to post
Share on other sites
Nada_4D

Thanks Crosire! :santa:

Share this post


Link to post
Share on other sites
stef538

Is it possible to add some kind of keybinding like it was possible in IV ?

this.BindKey(Key, new KeyPressDelegate(void));

Share this post


Link to post
Share on other sites
crosire

 

Is it possible to add some kind of keybinding like it was possible in IV ?

Didn't add that, because you can do the exact same in the KeyDown event handler (in fact that's what IV .NET ScriptHook did internally too), so it's superfluous.

Share this post


Link to post
Share on other sites
stef538

Oh oke! :D thanks!

Share this post


Link to post
Share on other sites
FabioGNR

Uh, is it me or did you remove the reload feature? Both "Ins" and Numlock 0 ( "Ins" ) don't do anything for me, also browsing through the repository on github I found nothing about it. Am I missing something?

 

EDIT: found it on github, but it isn't working yet.

EDIT 2: Rebuilt it with VK_F10 isntead of VK_INSERT, no luck.

Edited by FabioGNR

Share this post


Link to post
Share on other sites
Nada_4D

Hey, I'm try to make missile function with vehicle but how we can spawn vehicle front us using GTA.Math? Before on the old "ScriptHook.dll" for Grand Theft Auto IV/ Episodes from Liberty City it worked using: Game.LocalPlayer.Character.GetOffsetPosition(New Vector3(0.0F, 7.5F, 0.0F)) > (Example). :whuh:

Edited by Nada_4D

Share this post


Link to post
Share on other sites
edgekiller

Hi,

 

have got this error when i select history mode :

wLPqLnj.png

 

Any solution ?

Share this post


Link to post
Share on other sites
Nada_4D

You need download the last version of "ScriptHookVDotNet".

Share this post


Link to post
Share on other sites
edgekiller

The latest version from github or the latest binary ?

Share this post


Link to post
Share on other sites
Nada_4D

Yes, the last binary release come from Crosire. Check first page. :)

Share this post


Link to post
Share on other sites
FabioGNR

Uh, is it me or did you remove the reload feature? Both "Ins" and Numlock 0 ( "Ins" ) don't do anything for me, also browsing through the repository on github I found nothing about it. Am I missing something?

 

EDIT: found it on github, but it isn't working yet.

EDIT 2: Rebuilt it with VK_F10 isntead of VK_INSERT, no luck.

So, it's probably an error on my end, haven't completely confirmed it yet but it's likely I got something stuck in a loop.

Obviously my fault, but, it would be useful to have protection against this kind of thing since it freezes the entire hook.

Share this post


Link to post
Share on other sites
edgekiller

Yes, the last binary release come from Crosire. Check first page. :)

 

But i have the latest version (0.4), and the latest version of ScriptHook too :(

Share this post


Link to post
Share on other sites
FabioGNR

 

Yes, the last binary release come from Crosire. Check first page. :)

But i have the latest version (0.4), and the latest version of ScriptHook too :(

 

I just crashed with the same 'error', which basically just indicated ANY kind of error in .net scripthook. Not sure what you mean by "history mode" but it crashed when I switched back to the game.

Share this post


Link to post
Share on other sites
Nada_4D

Did you checked if you have the last version of "ScriptHookV" from Alexander Blade?

Share this post


Link to post
Share on other sites
Raxdiam

 

 

Umm..can we modify the players Money? (Add or subtract) becoz I didn't found a native :/

There is a way to add money by using STAT_GET_INT and STAT_SET_INT, which is used in Alexander Blade's native trainer.

Here's my translated code:

 

void AddCash(int amount){    for (int i = 0; i < 3; i++) {        string statNameFull = string.Format("SP{0}_TOTAL_CASH", i);        int hash = Function.Call<int>(Hash.GET_HASH_KEY, statNameFull);        int val = 0;        OutputArgument outArg = new OutputArgument();        Function.Call<bool>(Hash.STAT_GET_INT, hash, outArg, -1);        val = outArg.GetResult<int>() + amount;        Function.Call(Hash.STAT_SET_INT, hash, val, true);    }} 
I tested it a little, and it seems to work just fine.

 

rather than adding to everyone's bank, you could compare player model to see which person is currently active and only add to their bank

 

void AddCash(int amount){    string statNameFull = string.Format("SP{0}_TOTAL_CASH", (Game.Player.Character.Model.Hash == new Model("player_zero").Hash) ? 0 :    //Michael                                                            (Game.Player.Character.Model.Hash == new Model("player_one").Hash) ? 1 :     //Franklin                                                            (Game.Player.Character.Model.Hash == new Model("player_two").Hash) ? 2 : 0); //Trevor    int hash = Function.Call<int>(Hash.GET_HASH_KEY, statNameFull);    int val = 0;    OutputArgument outArg = new OutputArgument();    Function.Call<bool>(Hash.STAT_GET_INT, hash, outArg, -1);    val = outArg.GetResult<int>() + amount;    Function.Call(Hash.STAT_SET_INT, hash, val, true);}
Edited by Raxdiam

Share this post


Link to post
Share on other sites
FabioGNR

Did you checked if you have the last version of "ScriptHookV" from Alexander Blade?

Yes, latest. Others don't even work on 350.2

Share this post


Link to post
Share on other sites
edgekiller

Did you checked if you have the last version of "ScriptHookV" from Alexander Blade?

Yes me too

Share this post


Link to post
Share on other sites
XBLToothPik

 

Umm..can we modify the players Money? (Add or subtract) becoz I didn't found a native :/

 

There is a way to add money by using STAT_GET_INT and STAT_SET_INT, which is used in Alexander Blade's native trainer.

Here's my translated code:

void AddCash(int amount){    for (int i = 0; i < 3; i++) {        string statNameFull = string.Format("SP{0}_TOTAL_CASH", i);        int hash = Function.Call<int>(Hash.GET_HASH_KEY, statNameFull);        int val = 0;        OutputArgument outArg = new OutputArgument();        Function.Call<bool>(Hash.STAT_GET_INT, hash, outArg, -1);        val = outArg.GetResult<int>() + amount;        Function.Call(Hash.STAT_SET_INT, hash, val, true);    }} 

I tested it a little, and it seems to work just fine.

 

 

 

You could just use the unsafe keyword.

 

NOTE: To use this, enable "unsafe code" in the properties of your project!

 

 

int _totalCash = 0;int charIndex = 0;unsafe{     if (Function.Call<bool>(Hash.STAT_GET_INT(string.Format("SP{0}_TOTAL_CASH", charIndex), &_totalCash, -1))     {          //..Successful stat_get operation!          //..Do things with total cash here     }}

Share this post


Link to post
Share on other sites
Raxdiam

 

 

Umm..can we modify the players Money? (Add or subtract) becoz I didn't found a native :/

 

There is a way to add money by using STAT_GET_INT and STAT_SET_INT, which is used in Alexander Blade's native trainer.

Here's my translated code:

void AddCash(int amount){    for (int i = 0; i < 3; i++) {        string statNameFull = string.Format("SP{0}_TOTAL_CASH", i);        int hash = Function.Call<int>(Hash.GET_HASH_KEY, statNameFull);        int val = 0;        OutputArgument outArg = new OutputArgument();        Function.Call<bool>(Hash.STAT_GET_INT, hash, outArg, -1);        val = outArg.GetResult<int>() + amount;        Function.Call(Hash.STAT_SET_INT, hash, val, true);    }} 

I tested it a little, and it seems to work just fine.

 

 

 

You could just use the unsafe keyword.

 

NOTE: To use this, enable "unsafe code" in the properties of your project!

int _totalCash = 0;int charIndex = 0;unsafe{     if (Function.Call<bool>(Hash.STAT_GET_INT(string.Format("SP{0}_TOTAL_CASH", charIndex), &_totalCash, -1))     {          //..Successful stat_get operation!          //..Do things with total cash here     }}

 

Good idea, though it doesn't make much of a difference.

Here's the function with the unsafe keyword:

unsafe void AddCash(int amount){    string statNameFull = string.Format("SP{0}_TOTAL_CASH",     (Game.Player.Character.Model.Hash == new Model("player_zero").Hash) ? 0 :    //Michael    (Game.Player.Character.Model.Hash == new Model("player_one").Hash) ? 1 :     //Franklin    (Game.Player.Character.Model.Hash == new Model("player_two").Hash) ? 2 : 0); //Trevor    int hash = Function.Call<int>(Hash.GET_HASH_KEY, statNameFull);    int val;    Function.Call(Hash.STAT_GET_INT, hash, &val, -1);    val += amount;    Function.Call(Hash.STAT_SET_INT, hash, val, true);}

Share this post


Link to post
Share on other sites
JohnnyCrazy

Just a quick heads-up:

Support for drawing rectangles + text on-screen should come within the next days. Of course with some nice Component-System :D

Share this post


Link to post
Share on other sites
Nada_4D

Sorry for this reply so late. Can you tell me where your files are located in "Grand Theft Auto V" folder. That's weird for me it work perfectly with all latest updates from Alexander Blade & Crosire... ^^

Between, "dinput8.dll" replace "dsound.dll", check also in your game folder if you deleted "dsound.dll". :)

Edited by Nada_4D

Share this post


Link to post
Share on other sites
likebosS26

I want draw

Speedometer maxresdefault.jpg

//static void DRAW_SPRITE(Any p0, Any p1, Any p2, Any p3, Any p4, Any p5, Any p6, Any p7, Any p8, Any p9, Any p10) { invoke<Void>(0xE7FFAE5EBF23D890, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); } // E7FFAE5EBF23D890 1FEC16B0

 

I found this code for gta iv but i try use in gta v anyone can help pls

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows.Forms;using GTA;using System.Drawing;using GTA.Math;namespace Gta {    public class Class1 : Script    {        GTA.texture texture;        public Class1()        {            this.KeyDown += new GTA.KeyEventHandler(kdHandler);            this.PerFrameDrawing += new GraphicsEventHandler(gfxDraw);            texture = Resources.GetTexture("speedNeedle.png");        }        public void gfxDraw(object sender, GraphicsEventArgs e)        {            e.Graphics.DrawSprite(texture, 20, 20, 300, 300, 0);        }        public void kdHandler(object sender, GTA.KeyEventArgs e)        {            if (e.Key == Keys.B)            {                Vehicle vehicle = Game.Player.Character.CurrentVehicle;                vehicle.InteriorLightOn = true;            }        }    }}
Edited by likebosS26

Share this post


Link to post
Share on other sites
edgekiller

This is my installation folder :

ATjyOh5.png

 

That still does not work :(

Share this post


Link to post
Share on other sites
Nada_4D

Hi edgekiller,

 

I think you got "wrong" file of "ScriptHookV.dll".

 

I will upload my mine here: http://www.mediafire.com/download/t7fr7xhn6tnu85r/ScriptHookV.dll (350.1/ 350.2)

 

If it doesn't work, please repport here what you have in your "scripts" folder.

Edited by Nada_4D

Share this post


Link to post
Share on other sites
edgekiller

Hi edgekiller,

 

I think you got "wrong" file of "ScriptHookV.dll".

 

I will upload my mine here: http://www.mediafire.com/download/t7fr7xhn6tnu85r/ScriptHookV.dll

 

If it doesn't work, please repport here what you have in your "scripts" folder.

 

Thank's but it still not work, and i have nothing in the scripts folder.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 3 Users Currently Viewing
    0 Members, 0 Anonymous, 3 Guests

×

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.