Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    2. News

    1. Red Dead Redemption 2

      1. News
      2. Red Dead Online
      3. The Armadillo Inn
    1. GTA Online

      1. After Hours
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

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

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Site Suggestions

crosire

Community Script Hook V .NET

Recommended Posts

Nada_4D

Okay, you need wait Crosire. He can help you. :cool:

Share this post


Link to post
Share on other sites
unknown modder

 

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;            }        }    }}
were a long way off loading custom resources in the script hook

Share this post


Link to post
Share on other sites
stef538

Nah I can already load custom wav files into my script :p

Share this post


Link to post
Share on other sites
unknown modder

Nah I can already load custom wav files into my script :p

and play them through gta and not with some generic .net wav player

Share this post


Link to post
Share on other sites
Cyron43

Hello @Crosire. I am currently implementing some extension methods which wrap certain native function calls, especially
GET_DISTANCE_BETWEEN_COORDS
GET_PED_IN_VEHICLE_SEAT
SET_DRIVE_TASK_CRUISE_SPEED
SET_DRIVE_TASK_DRIVING_STYLE
CREATE_RANDOM_PED_AS_DRIVER
TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE
TASK_VEHICLE_DRIVE_WANDER

Is it worth the effort for me or will we get those with your script hook in the next days anyway?

Another question: What's this about waypoint recording and playback? I don't know this from IV.

Share this post


Link to post
Share on other sites
YouRik

Hey Crosire!

First of all, so that I don't forget about it later, thank you for your awesome work! Without you I wouldn't have this much fun with GTA V ;)

 

Now, I have received a few reports of the following error: "CORE: An exception occurred while executing 'ScriptHookVDotNet.asi'" via the comment section of a script of mine on http://gtainside.com/.

Maybe you can take a look and see if it has to do with my script or your ScriptHookV .NET (or maybe Alexander Blade's ScriptHookV?). I myself have not had this problem. :)

 

PS: It seems this has already been reported to you via this thread :panic:

Edited by YouRik

Share this post


Link to post
Share on other sites
edgekiller

Hey Crosire!

First of all, so that I don't forget about it later, thank you for your awesome work! Without you I wouldn't have this much fun with GTA V ;)

 

Now, I have received a few reports of the following error: "CORE: An exception occurred while executing 'ScriptHookVDotNet.asi'" via the comment section of a script of mine on http://gtainside.com/.

Maybe you can take a look and see if it has to do with my script or your ScriptHookV .NET (or maybe Alexander Blade's ScriptHookV?). I myself have not had this problem. :)

 

PS: It seems this has already been reported to you via this thread :panic:

 

I have this error too.

Share this post


Link to post
Share on other sites
crosire

Is it worth the effort for me or will we get those with your script hook in the next days anyway?

Absolutly, please send a pull request once done and I'll merge it into the codebase.

 

Now, I have received a few reports of the following error: "CORE: An exception occurred while executing 'ScriptHookVDotNet.asi'" via the comment section of a script of mine on http://gtainside.com/.

 

Maybe you can take a look and see if it has to do with my script or your ScriptHookV .NET (or maybe Alexander Blade's ScriptHookV?). I myself have not had this problem. :)

Could you add a link to the specific script? =)

Edited by Crosire

Share this post


Link to post
Share on other sites
YouRik

 

Hello @Crosire. I am currently implementing some extension methods which wrap certain native function calls, especially

GET_DISTANCE_BETWEEN_COORDS

GET_PED_IN_VEHICLE_SEAT

SET_DRIVE_TASK_CRUISE_SPEED

SET_DRIVE_TASK_DRIVING_STYLE

CREATE_RANDOM_PED_AS_DRIVER

TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE

TASK_VEHICLE_DRIVE_WANDER

 

Is it worth the effort for me or will we get those with your script hook in the next days anyway?

Another question: What's this about waypoint recording and playback? I don't know this from IV.

Absolutly, please send a pull request once done and I'll merge it into the codebase.

 

Hey Crosire!

First of all, so that I don't forget about it later, thank you for your awesome work! Without you I wouldn't have this much fun with GTA V ;)

 

Now, I have received a few reports of the following error: "CORE: An exception occurred while executing 'ScriptHookVDotNet.asi'" via the comment section of a script of mine on http://gtainside.com/.

Maybe you can take a look and see if it has to do with my script or your ScriptHookV .NET (or maybe Alexander Blade's ScriptHookV?). I myself have not had this problem. :)

 

PS: It seems this has already been reported to you via this thread :panic:

Could you add a link to the specific script? =)

 

Oh yeah of course, I forgot.

http://www.gtainside.com/download.php?do=comments&cat=603&id=72304

Share this post


Link to post
Share on other sites
Cyron43

Hello @YouRik. I would gladly do this but there is a problem with Tasks so far. In the .net script hook for GTA IV it was a property. In Crosire's script hook isn't anything like this. What are your plans regarding tasks?

 

I have done some other things meanwhile. Here is an extension for the driver behavior:

      public static void SetDriverBehavior(this Ped driver, DriverBehavior behavior)      {         var args = new InputArgument[] {driver, behavior.Ability};         // note: deactivated as long as I don't know about the value range for the ability.         //Function.Call(Hash.SET_DRIVER_ABILITY, args);         args = new InputArgument[] {driver, behavior.Aggressiveness};         Function.Call(Hash.SET_DRIVER_AGGRESSIVENESS, args);         args = new InputArgument[] {driver, behavior.SteersAroundObjects};         Function.Call(Hash.SET_PED_STEERS_AROUND_OBJECTS, args);         args = new InputArgument[] {driver, behavior.SteersAroundPeds};         Function.Call(Hash.SET_PED_STEERS_AROUND_PEDS, args);         args = new InputArgument[] {driver, behavior.SteersAroundVehicles};         Function.Call(Hash.SET_PED_STEERS_AROUND_VEHICLES, args);      }

DriverBehavior is a simple container class with appropriate properties.

CreatePedOnSeat, GetPedOnSeat, DistanceTo and DistanceTo2D are done. Usually I do unit tests but alas that's not possible in this case (afaik) but correct me if I'm wrong.
I'm going to make a pull request anyway. :)

 

EDIT: I was just about to make that pull request but I found out there is only a master branch. That's a bad idea, sorry. There should also be a develop branch at least.

Edited by Cyron43

Share this post


Link to post
Share on other sites
crosire

EDIT: I was just about to make that pull request but I found out there is only a master branch. That's a bad idea, sorry. There should also be a develop branch at least.

I would normally agree, but I don't see the point in this case. Stable versions are tagged and can be downloaded via the release tab, so we don't really need a master branch here, which makes the master branch the develop branch.

 

Can't seem to reproduce an exception with the latest code...

Edited by Crosire

Share this post


Link to post
Share on other sites
Cyron43

 

EDIT: I was just about to make that pull request but I found out there is only a master branch. That's a bad idea, sorry. There should also be a develop branch at least.

I would normally agree, but I don't see the point in this case. Stable versions are tagged and can be downloaded via the release tab, so we don't really need a master branch here, which makes the master branch the develop branch.

 

Ah okay. :)

So I'm using C#. What do you suggest to merge the code?

Share this post


Link to post
Share on other sites
JohnnyCrazy

 

 

EDIT: I was just about to make that pull request but I found out there is only a master branch. That's a bad idea, sorry. There should also be a develop branch at least.

I would normally agree, but I don't see the point in this case. Stable versions are tagged and can be downloaded via the release tab, so we don't really need a master branch here, which makes the master branch the develop branch.

 

Ah okay. :)

So I'm using C#. What do you suggest to merge the code?

 

 

You need to convert your C# classes to C++ CLI classes, since the script is using the C++ CLI for all bindings. (Look at the "Scripting" Folder for examples)

It should be easy to convert, it's nearly the same as C# :)

Edited by JohnnyCrazy

Share this post


Link to post
Share on other sites
YouRik

 

EDIT: I was just about to make that pull request but I found out there is only a master branch. That's a bad idea, sorry. There should also be a develop branch at least.

I would normally agree, but I don't see the point in this case. Stable versions are tagged and can be downloaded via the release tab, so we don't really need a master branch here, which makes the master branch the develop branch.

 

Can't seem to reproduce an exception with the latest code...

 

yeah... me neither... I'll keep trying to help these guys and if I find a fix I'll post it here :)

Share this post


Link to post
Share on other sites
identitymatrix

Is Player.ID return the same as PLAYER_PED_ID

 

Some native functions just don't do anything, unless params are messed up.

Share this post


Link to post
Share on other sites
unknown modder

Is Player.ID return the same as PLAYER_PED_ID

 

Some native functions just don't do anything, unless params are messed up.

Game.Player.ID returns PLAYER_ID

Game.Player.Char.ID returns PLAYER_PED_ID

Edited by unknown modder

Share this post


Link to post
Share on other sites
unknown modder

 

EDIT: I was just about to make that pull request but I found out there is only a master branch. That's a bad idea, sorry. There should also be a develop branch at least.

I would normally agree, but I don't see the point in this case. Stable versions are tagged and can be downloaded via the release tab, so we don't really need a master branch here, which makes the master branch the develop branch.

 

Can't seem to reproduce an exception with the latest code...

 

made it write the error that causes it to fail to the log

[20:32:24] [DEBUG] Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Share this post


Link to post
Share on other sites
crosire

 

made it write the error that causes it to fail to the log

[20:32:24] [DEBUG] Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

 

Make sure your ASI and DLL used for building the script match. Also make sure you are using the latest version from Github, the exception thrown when being idle for a while was fixed a few hours ago.

Share this post


Link to post
Share on other sites
identitymatrix

 

Is Player.ID return the same as PLAYER_PED_ID

 

Some native functions just don't do anything, unless params are messed up.

Game.Player.ID returns PLAYER_ID

Game.Player.Char.ID returns PLAYER_PED_ID

 

 

BRkm0vw_700wa_0.gif

Share this post


Link to post
Share on other sites
identitymatrix

Why is 'isOnFire' as a read only property? It is actually method.

Edited by TheVideoVolcano

Share this post


Link to post
Share on other sites
crosire

Why is 'isOnFire' as a read only property? It is actually method.

Because spawning a fire is more than just switching a boolean to true.

Share this post


Link to post
Share on other sites
xsploit
Error	2	Expression is not an array or a method, and cannot have an argument list.	C:\Users\subsect\Documents\Visual Studio 2013\Projects\ClassLibrary4\Class1.vb	25	46	ClassLibrary4Imports System.Collections.GenericImports System.IOImports System.LinqImports System.TextImports System.Threading.TasksImports GTAImports GTA.MathNamespace ScriptHookVDotNetExample    Public Class MainScript        Inherits Script        Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Short        Private mIndicatorLeft As Boolean = False        Private mIndicatorRight As Boolean = False        Private Sub OnTick(sender As Object, e As EventArgs)            If (GetAsyncKeyState(118)) Then                Dim zombieSkinID As GTA.Model = ("u_m_y_zombie_01")                Dim player As Ped = Game.Player.Character                Dim peds() As Ped = World.GetNearbyPeds(Game.Player.Character, 1000)                For i As Integer = 0 To 10 Step 1                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PED_AS_COP(peds(i), True))                Next            End If        End Sub             Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, value As T) As T            target = value            Return value        End Function    End ClassEnd Namespace

just trying to get this simple code to work

Share this post


Link to post
Share on other sites
unknown modder
Error	2	Expression is not an array or a method, and cannot have an argument list.	C:\Users\subsect\Documents\Visual Studio 2013\Projects\ClassLibrary4\Class1.vb	25	46	ClassLibrary4Imports System.Collections.GenericImports System.IOImports System.LinqImports System.TextImports System.Threading.TasksImports GTAImports GTA.MathNamespace ScriptHookVDotNetExample    Public Class MainScript        Inherits Script        Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Short        Private mIndicatorLeft As Boolean = False        Private mIndicatorRight As Boolean = False        Private Sub OnTick(sender As Object, e As EventArgs)            If (GetAsyncKeyState(118)) Then                Dim zombieSkinID As GTA.Model = ("u_m_y_zombie_01")                Dim player As Ped = Game.Player.Character                Dim peds() As Ped = World.GetNearbyPeds(Game.Player.Character, 1000)                For i As Integer = 0 To 10 Step 1                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PED_AS_COP(peds(i), True))                Next            End If        End Sub             Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, value As T) As T            target = value            Return value        End Function    End ClassEnd Namespace

just trying to get this simple code to work

 

dont use getasynckeystate, just use the KeyDown event handler and declare it in the constructor for the class (Sub New()....End Sub)

Share this post


Link to post
Share on other sites
xsploit

 

 


 

Imports System.Collections.Generic

Imports System.IO

Imports System.Linq

Imports System.Text

Imports System.Threading.Tasks

Imports System.Windows.Forms.Keys

Imports System.Windows.Forms.KeyEventArgs

 

Imports GTA

Imports GTA.Math

 

Namespace ScriptHookVDotNetExample

Public Class MainScript

Inherits Script

'Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Short

'Declaration

'Declaration

 

Private mIndicatorLeft As Boolean = False

Private mIndicatorRight As Boolean = False

 

Private Sub OnTick(sender As Object, e As EventArgs)

 

Native.Function.Call("SET_ENTITY_INVINCIBLE", Game.Player.Character, True)

'

 

 

 

 

'

End Sub

 

Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, value As T) As T

target = value

Return value

End Function

 

 

 

Public Sub New()

Me.Interval = 1

End Sub

 

Protected Overrides Sub Finalize()

MyBase.Finalize()

End Sub

 

Private Sub MainScript_KeyDown(sender As Object, e As Windows.Forms.KeyEventArgs) Handles Me.KeyDown

If e.KeyCode = [End] Then

'Dim zombieSkinID As GTA.Model = ("u_m_y_zombie_01")

 

' Dim i As Integer

 

Dim peds() As Ped = World.GetNearbyPeds(Game.Player.Character, 1000, 50)

For i As Integer = 0 To 50

'Wait(50)

' Native.Function.Call("SET_PED_AS_COP", peds(i), True)

' Native.Function.Call(HSET"SET_PED_AS_ENEMY", peds(i), True)

GTA.Native.Function.Call(GTA.Native.Hash.SET_PED_AS_COP, peds(i), True)

Next

End If

End Sub

 

Private Sub MainScript_Tick(sender As Object, e As EventArgs) Handles Me.Tick

Dim player As Ped = Game.Player.Character

Me.Interval = 1

End Sub

End Class

End Namespace

 

 

 

Edited by xsploit

Share this post


Link to post
Share on other sites
crosire

 

dont use getasynckeystate, just use the KeyDown event handler and declare it in the constructor for the class (Sub New()....End Sub)

 

Or alternativly "GTA.Script.IsKeyPressed" in case you want to check repeatingly in the Tick event instead of waiting for a key to be pressed.

Share this post


Link to post
Share on other sites
xsploit

 

 

dont use getasynckeystate, just use the KeyDown event handler and declare it in the constructor for the class (Sub New()....End Sub)

 

Or alternativly "GTA.Script.IsKeyPressed" in case you want to check repeatingly in the Tick event instead of waiting for a key to be pressed.

 

 Private Sub MainScript_Tick(sender As Object, e As EventArgs) Handles Me.Tick            ' Dim player As Ped = Game.Player.Character            If GTA.Script.IsKeyPressed([End]) = True Then                Dim loc As New Vector3(Game.Player.Character.Position.X, Game.Player.Character.Position.Y, Game.Player.Character.Position.Z)                Dim peds() As Ped = World.GetNearbyPeds(Game.Player.Character, 9000.0F)                For i As Integer = 0 To 5                    Wait(50)                    ' Native.Function.Call("SET_PED_AS_COP", peds(i), True)                    '  Native.Function.Call(HSET"SET_PED_AS_ENEMY", peds(i), True)                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PED_COMBAT_ABILITY, V, 2)                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PED_AS_ENEMY, peds(i), True)                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PED_COMBAT_RANGE, peds(i), 9000)                    GTA.Native.Function.Call(GTA.Native.Hash.TASK_COMBAT_PED, peds(i), Game.Player.Character, 0, 0)                    GTA.Native.Function.Call(GTA.Native.Hash.SET_PED_KEEP_TASK, peds(i), True)                Next            End If        End Sub    End Class

This is fun...

now i can start maybe making sort of a zombie code.

Can you swap models of peds, i seen stuff like create_model_swap

also i'm trying to make people still attack you when you pont a weapon at them marines and stuff still attack, i seen there is flee attributes but not sure if that does want i want

Edited by xsploit

Share this post


Link to post
Share on other sites
Cyron43

Quick question: .net script hook for GTA IV had it's own KeyEventArgs class. Are you planning to do the same in your script hook or can we skip this when migrating mods from IV to V and use the KeyEventArgs class of the .net framework?

Share this post


Link to post
Share on other sites
crosire

Quick question: .net script hook for GTA IV had it's own KeyEventArgs class. Are you planning to do the same in your script hook or can we skip this when migrating mods from IV to V and use the KeyEventArgs class of the .net framework?

I didn't see much benefit in that custom class over the standard System.Windows.Forms.KeyEventArgs, so used that one and you can safely use it too.

Share this post


Link to post
Share on other sites
Cyron43

 

Quick question: .net script hook for GTA IV had it's own KeyEventArgs class. Are you planning to do the same in your script hook or can we skip this when migrating mods from IV to V and use the KeyEventArgs class of the .net framework?

I didn't see much benefit in that custom class over the standard System.Windows.Forms.KeyEventArgs, so used that one and you can safely use it too.

 

You and me both. Thanks for the info. :)

Share this post


Link to post
Share on other sites
Nada_4D

Hi, I want to know how to "spawn" vehicle/ped or explosion front us using X, Y, Z coordinates. Because on the old "ScriptHookDotNet.dll" for Grand Theft Auto IV/ Episodes from Liberty City we can use: Game.LocalPlayer.Character.GetOffsetPosition(New Vector3(0.0F, 7.5F, 0.0F)) > (Example)

 

Thanks for your reply!

Edited by Nada_4D

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

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

×

Important Information

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