Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Forum Support

    3. Suggestions

Community Script Hook V .NET


crosire
 Share

Recommended Posts

Updated the official release to v1.0. =)

Any idea how bad this will break scripts compiled around v0.9? There are a couple mods I want to keep from 0.9 but there are also some mods from 1.0 I want to use.

I was going to do the recompile myself but, unfortunately, these mods don't have source code available and (from my limited knowledge of .net) recompiling from a dll is not possible?

Link to comment
Share on other sites

And also 2 little notes with the new 1.0 release:

 

Please compile your mods against the new 1.0 release

You would do all users a favor if you compile your dll/(.cs) against the new 1.0 release. By doing this, every user can use the same new ScriptHookVDotNet version and does not have to downgrade if he wants to use your mod. We also implemented a lot of new cool stuff, so make sure you checkout the github page!

 

Stick to the released 1.* versions (no nightlies/custom built versions)

This is also in the users interest. We will make sure all 1.* versions will contain either no breaking changes or will support proper backwards compatability. This will make sure all scripts compiled against 1.0 will work with them and the user can keep the 1.0 DLL.

 

Thanks :)

Will do. :^:

Link to comment
Share on other sites

Prof_Farnsworth

Nevermind, thanks anyway.

Edited by Prof_Farnsworth
Link to comment
Share on other sites

i can't use Hash vehicleModel in my code

Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, racer1, veh_racer1, chackpoints[racer1_ch].X, chackpoints[racer1_ch].Y, chackpoints[racer1_ch].Z
, Function.Call<float>(Hash._0xF417C2502FFFED43, veh_racer1.GetHashCode()), 1, VehicleHash.Comet2, (int)DrivingStyle.AvoidTrafficExtremely, 0xC00AB, -1);

i have this error

cannot convert from 'GTA.Native.VehicleHash' to 'GTA.Native.InputArgument'

Link to comment
Share on other sites

 

Cast to int:

(int)VehicleHash.Comet2

i make it like this

Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, racer1, veh_racer1, chackpoints[racer1_ch].X, chackpoints[racer1_ch].Y, chackpoints[racer1_ch].Z

, Function.Call<float>(Hash._GET_VEHICLE_MAX_SPEED, veh_racer1.GetHashCode()), 1, (int)VehicleHash.Comet2, (int)DrivingStyle.AvoidTrafficExtremely, 0xC00AB, -1);

 

then i have this error

Constant value '3249425686' cannot be converted to a 'int' (use 'unchecked' syntax to override)

 

Link to comment
Share on other sites

How would i use this? I download the files and open visual studio and create a new windows form application and import the .net script hook as a reference..

now what?

 

All i've seen people all over this forum do is download and instantly start coding, Confusing because there is no tutorial available that i can find about starting coding for .NET Visual Basic...

 

I have the C++ version working though, I'm able to spawn random pedestrians with guns that follow me, but i want to do this is visual basic... Any help would be greatly aprechiated

Vector3 me_local_coords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 0.0, 0.0);Ped rped1 = PED::CREATE_RANDOM_PED(me_local_coords.x, me_local_coords.y, me_local_coords.z);if (rped1 != playerPed){  PED::SET_PED_MAX_HEALTH(rped1, 9999999);  PED::SET_PED_AS_GROUP_MEMBER(rped1, PLAYER::GET_PLAYER_GROUP(PLAYER::GET_PLAYER_INDEX()));  WEAPON::GIVE_WEAPON_TO_PED(rped1, 0xAF113F99, 999, true, true);  PED::SET_PED_ACCURACY(rped1, 100);  PED::SET_PED_CAN_SWITCH_WEAPON(rped1, true);  PED::SET_PED_COMBAT_ABILITY(rped1, 2);}
Edited by Enumerator
Link to comment
Share on other sites

 

How would i use this? I download the files and open visual studio and create a new windows form application and import the .net script hook as a reference..

now what?

 

All i've seen people all over this forum do is download and instantly start coding, Confusing because there is no tutorial available that i can find about starting coding for .NET Visual Basic...

 

I have the C++ version working though, I'm able to spawn random pedestrians with guns that follow me, but i want to do this is visual basic... Any help would be greatly aprechiated

Vector3 me_local_coords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 0.0, 0.0);Ped rped1 = PED::CREATE_RANDOM_PED(me_local_coords.x, me_local_coords.y, me_local_coords.z);if (rped1 != playerPed){  PED::SET_PED_MAX_HEALTH(rped1, 9999999);  PED::SET_PED_AS_GROUP_MEMBER(rped1, PLAYER::GET_PLAYER_GROUP(PLAYER::GET_PLAYER_INDEX()));  WEAPON::GIVE_WEAPON_TO_PED(rped1, 0xAF113F99, 999, true, true);  PED::SET_PED_ACCURACY(rped1, 100);  PED::SET_PED_CAN_SWITCH_WEAPON(rped1, true);  PED::SET_PED_COMBAT_ABILITY(rped1, 2);}

you can start with those like i did:

Link to comment
Share on other sites

you can start with those like i did:

[EDIT] this is for C# not Visual Basic, I'm looking for the visual basic version.

Edited by Enumerator
Link to comment
Share on other sites

 

 

Cast to int:

(int)VehicleHash.Comet2

i make it like this

Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, racer1, veh_racer1, chackpoints[racer1_ch].X, chackpoints[racer1_ch].Y, chackpoints[racer1_ch].Z

, Function.Call<float>(Hash._GET_VEHICLE_MAX_SPEED, veh_racer1.GetHashCode()), 1, (int)VehicleHash.Comet2, (int)DrivingStyle.AvoidTrafficExtremely, 0xC00AB, -1);

 

then i have this error

Constant value '3249425686' cannot be converted to a 'int' (use 'unchecked' syntax to override)

https://msdn.microsoft.com/en-us/library/a569z7k8.aspx

Link to comment
Share on other sites

 

 

 

Cast to int:

(int)VehicleHash.Comet2

i make it like this

Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, racer1, veh_racer1, chackpoints[racer1_ch].X, chackpoints[racer1_ch].Y, chackpoints[racer1_ch].Z

, Function.Call<float>(Hash._GET_VEHICLE_MAX_SPEED, veh_racer1.GetHashCode()), 1, (int)VehicleHash.Comet2, (int)DrivingStyle.AvoidTrafficExtremely, 0xC00AB, -1);

 

then i have this error

Constant value '3249425686' cannot be converted to a 'int' (use 'unchecked' syntax to override)

https://msdn.microsoft.com/en-us/library/a569z7k8.aspx

 

thenk you

Link to comment
Share on other sites

please help me how can add this task to TaskSequence

TASK_VEHICLE_DRIVE_TO_COORD

TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE

and thx

Link to comment
Share on other sites

Can someone just upload their [VISUAL BASIC.NET] project file so i can dive straight into it?

preferebly with a menu and atleast one hotkey triger.

 

NOT C# or C++

Edited by Enumerator
Link to comment
Share on other sites

unknown modder

Anyone?

havent used VB in about 5 years, but this is basically what you need

Imports GTAImports System.Windows.FormsPublic Class EmptyScript    Inherits Script    Sub New()        Interval = 0    End Sub    Sub Ontick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick    End Sub    Sub OnKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyDown    End Sub    Sub OnKeyUp(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyUp    End SubEnd Class

Remember to create the project as a class library (if using visual studio), add a reference to the ScriptHookVDotNet.dll and System.Windows.Forms.dll. Change the build properties of the project under the compile tab from target cpu = anycpu to x64 and you're good to go

Link to comment
Share on other sites

 

Anyone?

havent used VB in about 5 years, but this is basically what you need

Imports GTAImports System.Windows.FormsPublic Class EmptyScript    Inherits Script    Sub New()        Interval = 0    End Sub    Sub Ontick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick    End Sub    Sub OnKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyDown    End Sub    Sub OnKeyUp(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyUp    End SubEnd Class

Remember to create the project as a class library (if using visual studio), add a reference to the ScriptHookVDotNet.dll and System.Windows.Forms.dll. Change the build properties of the project under the compile tab from target cpu = anycpu to x64 and you're good to go

 

How do i get that to export the ASI?

Also does the scripting also allow threading?

Edited by Enumerator
Link to comment
Share on other sites

unknown modder

 

 

Anyone?

havent used VB in about 5 years, but this is basically what you need

Imports GTAImports System.Windows.FormsPublic Class EmptyScript    Inherits Script    Sub New()        Interval = 0    End Sub    Sub Ontick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick    End Sub    Sub OnKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyDown    End Sub    Sub OnKeyUp(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyUp    End SubEnd Class

Remember to create the project as a class library (if using visual studio), add a reference to the ScriptHookVDotNet.dll and System.Windows.Forms.dll. Change the build properties of the project under the compile tab from target cpu = anycpu to x64 and you're good to go

 

How do i get that to export the ASI?

Also does the scripting also allow threading?

 

when you compile it it will create a dll which you can copy to a folder called script in the gtav directory, or you can just put the raw .vb file in that folder

Link to comment
Share on other sites

when you compile it it will create a dll which you can copy to a folder called script in the gtav directory, or you can just put the raw .vb file in that folder

 

Good stuff, Now all i need to know is where are all the functions like CREATE_RANDOM_PED?

Link to comment
Share on other sites

Nevermind i found most of the stuff, but it's really strange.... I need both ScripthookV and ScripthookVNet right?

Link to comment
Share on other sites

unknown modder

Nevermind i found most of the stuff, but it's really strange.... I need both ScripthookV and ScripthookVNet right?

Yes, and dinput8.dll, should come with scripthookV

Link to comment
Share on other sites

Yes, and dinput8.dll, should come with scripthookV

 

 

Thanks, I'm able to kill all pedestrians within a certain radius of the player

Dim peds As Ped() = World.GetNearbyPeds(Game.Player.Character, 1000.0F)For Each Ped As Ped In peds  Ped.Kill()Next

However what i'm more interested in is why do i have to restart GTA V every time i create a new Class.DLL?

I have developer mode enabled 'ScriptHookV.dev' file in GTA V directory but it only works with the ASI, not for reloading the gamedir/script/*dll's

 

Any reason why we can't do this?

Edited by Enumerator
Link to comment
Share on other sites

 

Yes, and dinput8.dll, should come with scripthookV

 

 

Thanks, I'm able to kill all pedestrians within a certain radius of the player

Dim peds As Ped() = World.GetNearbyPeds(Game.Player.Character, 1000.0F)Dim me_pos As Vector3 = Game.Player.Character.PositionFor Each Ped As Ped In peds  Ped.Kill()Next

However what i'm more interested in is why do i have to restart GTA V every time i create a new Class.DLL?

I have developer mode enabled 'ScriptHookV.dev' file in GTA V directory but it only works with the ASI, not for reloading the gamedir/script/*dll's

 

Any reason why we can't do this?

Press Insert to reload .net scripts.

Link to comment
Share on other sites

Here is the code i've built, No one else could use it unless they have an MBED and is using my ILI9340C_Serial_Control Repository code. https://developer.mbed.org/users/Elitism/code/ILI9340C_Serial_Control/

 

However this should give a base of how to connect through serial ports and sending data via scripthookvdotnet

Imports GTAImports GTA.MathImports GTA.NativeImports System.IO.PortsImports System.Windows.FormsPublic Class Class1    Inherits Script    ''My Serial Port    Private WithEvents COMPort As New SerialPort    Sub New()        Interval = 0    End Sub    ''Constantly UPDATING Variables    Dim me_pos As Vector3    Dim me_infront As Vector3    Dim me_temp_pos As Vector3        Dim refresh_tick As Integer = 0    Dim connect_count As Integer = 0    Dim tick_wait As Integer = 2    Sub Ontick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick        ''Constantly Updating Variables        With Game.Player.Character            me_pos = .Position ''My Positition            me_infront = .ForwardVector * 10 ''Position infront of me, 10 meters            ''Serial Data            If connect_count = 1 And me_pos <> me_temp_pos Then                If refresh_tick = tick_wait Then                    COMPort.WriteLine("frect,0,0,240,10,255,255,0") ''Clear previous values (Crappy method)                ElseIf refresh_tick = tick_wait * 2 Then                    COMPort.WriteLine("text," + me_pos.X.ToString + "/" + me_pos.Y.ToString + "/" + me_pos.Z.ToString + ",1,1,1,255,0,0") ''Send Location                    me_temp_pos = me_pos                    refresh_tick = 0                End If                refresh_tick += 1            End If        End With        ''Connect to serial port        If Game.IsKeyPressed(Keys.PageUp) Then            If connect_count = 0 Then                connectToPort(921600, "COM3")                connect_count = 1            End If        End If        ''Kill Pedestrians within range 1000        If Game.IsKeyPressed(Keys.K) Then            killPedsInRangeofPed(Game.Player.Character, 1000.0F)        End If    End Sub    Private Sub connectToPort(ByVal Baud As Long, ByVal portName As String)        COMPort.BaudRate = Baud        COMPort.PortName = portName        COMPort.Open()    End Sub    Private Sub killPedsInRangeofPed(ByVal nearWho As Ped, ByVal range As Single)        Dim peds As Ped() = World.GetNearbyPeds(nearWho, range)        For Each Ped As Ped In peds            Ped.Kill()        Next    End Sub#Region "Not required yet"    Sub OnKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyDown    End Sub    Sub OnKeyUp(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyUp    End Sub#End RegionEnd Class
Edited by Enumerator
Link to comment
Share on other sites

unknown modder

 

Here is the code i've built, No one else could use it unless they have an MBED and is using my ILI9340C_Serial_Control Repository code. https://developer.mbed.org/users/Elitism/code/ILI9340C_Serial_Control/

 

However this should give a base of how to connect through serial ports and sending data via scripthookvdotnet

<snip>

Why exactly are you using SerialPorts with shv.net

Link to comment
Share on other sites

 

 

Here is the code i've built, No one else could use it unless they have an MBED and is using my ILI9340C_Serial_Control Repository code. https://developer.mbed.org/users/Elitism/code/ILI9340C_Serial_Control/

 

However this should give a base of how to connect through serial ports and sending data via scripthookvdotnet

<snip>

Why exactly are you using SerialPorts with shv.net

 

To send/receive data to my mbed display,

To display data outside the game, It could be useful for a MPH display

Or

To activate functions without touching the keyboard/mouse using an SPI touch display.

Many possibilities.

unnamed.jpg

As you can see i'm displaying my players coordinates in real time on that display which updates every 2 ticks of gametime.

Edited by Enumerator
Link to comment
Share on other sites

Anyone know why this does not return an entity when i aim at anything?

 

Dim ent As Entity = World.Raycast(Game.Player.Character.Position, Game.Player.GetTargetedEntity.Position, IntersectOptions.Everything).HitEntity

Edited by Enumerator
Link to comment
Share on other sites

unknown modder

Anyone know why this does not return an entity when i aim at anything?

 

Dim ent As Entity = World.Raycast(Game.Player.Character.Position, Game.Player.GetTargetedEntity.Position, IntersectOptions.Everything).HitEntity

What are you trying to achieve with that?

Link to comment
Share on other sites

 

Anyone know why this does not return an entity when i aim at anything?

 

Dim ent As Entity = World.Raycast(Game.Player.Character.Position, Game.Player.GetTargetedEntity.Position, IntersectOptions.Everything).HitEntity

What are you trying to achieve with that?

 

 

It's a ray-tracer, it should draw an invisible line and detect which entity it hits on the second vector and get the details of that HitEntity

It would be useful in figuring out where you're aiming or what entity you're aiming at because i don't see a function to "get aimed entity" nothing works.....

 

What we need is a "get aimed weapon raytrace".... that so that we can get all the details of anything when we point at something with our guns.

 

Rock* did it at the beginning of the game with those bank vault guards detecting if the player is aiming at them...

Edited by Enumerator
Link to comment
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
 Share

  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

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