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

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

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

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

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

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

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

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

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. 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. News

    2. Forum Support

    3. Site Suggestions

HazardX

[BETA] GTAIV .Net ScriptHook

Recommended Posts

CleanShot

Hi Hazard,

 

seems that AddExplosion caused AccessViolation in your new ScriptHook:

 

System.AccessViolationException: Es wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. Dies ist häufig ein Hinweis darauf, dass anderer Speicher beschädigt ist.

bei Scripting.?A0x44ed51f9.AddExplosion(Single , Single , Single , UInt32 , Single , UInt32 , UInt32 , Single )

 

Please, if you find the time, try to answear my recent question. Tx.

Share this post


Link to post
Share on other sites
HazardX
seems that AddExplosion caused AccessViolation in your new ScriptHook:

...

 

Please, if you find the time, try to answear my recent question. Tx.

Thanks, it will be fixed.

 

Sorry about your question, i just missed it somehow. mercie_blink.gif I guess you were using wrong datatypes in the native calls. At least i never noticed any errors when calling APPLY_FORCE_TO_PED. However, Peds, Vehicles and Objects have a ApplyForce function now, so you don't need to call the native anymore. smile.gif I'll also take a look at the cameras, i can't tell much about them ATM.

Share this post


Link to post
Share on other sites
CleanShot

I encountered a game crash and the following exception after i was in multiplayer server selection menu for a while (4-5 minutes):

 

Unhandled Exception: System.Runtime.Remoting.RemotingException: Das Objekt "/7f7c15cb_06fe_4136_b22f_82b1f88e0c80/o0kcritbxn9y50ybpxhnvy54_1032.rem" wurde getrennt oder ist nicht auf dem Server vorhanden.

bei GTA.RemoteScriptDomain.TriggerEvent(ScriptEvent Event, EventArgs args)

bei GTA.ScriptDomain.TriggerEvent(ScriptEvent Event, EventArgs args)

bei GTA.NetHook.KeyDown(Object sender, KeyEventArgs e)

bei GTA.KeyWatchDog.OnKeyDown(KeyEventArgs e)

bei GTA.KeyWatchDog.Check()

bei GTA.NetHook.Tick()

bei StartupThreadC.RunTick(StartupThreadC* )

 

Thanx for the reply, Hazard. Still a question: When do I need GTA.Native.Parameter class for passing parameters to native functions?

Always? Some functions work if I don't use this class and pass parameters (Strings, ints, Player.Character etc.) directly.

 

Ciao.

Share this post


Link to post
Share on other sites
HazardX
I encountered a game crash and the following exception after i was in multiplayer server selection menu for a while (4-5 minutes):

Unhandled Exception: System.Runtime.Remoting.RemotingException: ...

 

Thanx for the reply, Hazard. Still a question: When do I need GTA.Native.Parameter class for passing parameters to native functions?

Always? Some functions work if I don't use this class and pass parameters (Strings, ints, Player.Character etc.) directly.

Thanks, this was a pretty bad error. I guess i found a fix for it. smile.gif

 

You don't need to use GTA.Native.Parameter at all. All values will automatically be processed when given to the Native.Function.Call . You only need to use the GTA.Native.Pointer class when some parameters are pointers.

Share this post


Link to post
Share on other sites
CoMPMStR

Excellent work Hazard!! icon14.gifbiggrin.gif

 

Now everything works as I initially expected. smile.gif I placed all my scripts with their INI counterparts to be loaded and guess what... no crash! I even reloaded the game quite a few times to see if any crashes and guess what... no crash!! Great work! The new architecture works really well, and it was easy to adjust all my console commands for the new parameter collection. colgate.gif

Share this post


Link to post
Share on other sites
HazardX

 

Excellent work Hazard!! icon14.gifbiggrin.gif

 

Now everything works as I initially expected. smile.gif I placed all my scripts with their INI counterparts to be loaded and guess what... no crash! I even reloaded the game quite a few times to see if any crashes and guess what... no crash!! Great work! The new architecture works really well, and it was easy to adjust all my console commands for the new parameter collection. colgate.gif

Amazing! Great to hear that all those days of work were actually for a good cause! biggrin.gif If you've found any functions that lead to a crash, just tell me. I'm preparing the new public version for a release in the next hours. Expect some interesting new features not included in the current test release... wink.gif

Edited by HazardX

Share this post


Link to post
Share on other sites
Intosia

Wierd. I replaced the Hook.dll, and readded it to my project. When i compile i get:

 

 

TestScriptCS.Scripts.Test.ConsoleCommand(string, string[])': no suitable method found to override

 

Share this post


Link to post
Share on other sites
HazardX

 

Wierd. I replaced the Hook.dll, and readded it to my project. When i compile i get:

 

 

TestScriptCS.Scripts.Test.ConsoleCommand(string, string[])': no suitable method found to override

 

The second parameter is now a ParameterCollection instead of a string array, to make parameters a lot easier to use. The functions of ParameterCollection will change again in the upcoming release (yeah, i'm a perfectionist biggrin.gif ), but you won't have to wait long for the next version.

 

[EDIT]

 

Also a new (optional) way to handle Key and Console input, as diryboy suggested (not included in the current testversion):

 

 

   Protected Overrides Sub Startup()     BindConsoleCommand("Explode", AddressOf ExplodeCommand)     BindConsoleCommand("SpawnCar", AddressOf CarCommand)     BindKey(Keys.F7, AddressOf SpawnInfernus)  End Sub  Public Sub ExplodeCommand()     World.AddExplosion(Player.Character.Position)  End Sub  Public Sub CarCommand(ByVal Parameter As ParameterCollection)     Dim CarType As String     Select Case Parameter.ToInteger(0) ' convert the first parameter (0) into an integer value        Case 1 : CarType = "INFERNUS"        Case 2 : CarType = "COMET"        Case 3 : CarType = "SULTANRS"        Case 4 : CarType = "PATRIOT"        Case 5 : CarType = "NRG900"        Case 6 : CarType = "ANNIHILATOR"        Case Else : CarType = "AIRTUG"     End Select     Dim v As Vehicle = World.CreateVehicle(CarType, Player.Character.Position.Around(5.0F))  End Sub  Public Sub SpawnInfernus()     World.CreateVehicle("INFERNUS", Player.Character.Position.Around(5.0F))  End Sub

 

Edited by HazardX

Share this post


Link to post
Share on other sites
Intosia
Wierd. I replaced the Hook.dll, and readded it to my project. When i compile i get:

 

 

TestScriptCS.Scripts.Test.ConsoleCommand(string, string[])': no suitable method found to override

 

The second parameter is now a ParameterCollection instead of a string array, to make parameters a lot easier to use. The functions of ParameterCollection will change again in the upcoming release (yeah, i'm a perfectionist biggrin.gif ), but you won't have to wait long for the next version.

 

[EDIT]

 

Also a new (optional) way to handle Key and Console input, as diryboy suggested (not included in the current testversion):

 

 

   Protected Overrides Sub Startup()     BindConsoleCommand("Explode", AddressOf ExplodeCommand)     BindConsoleCommand("SpawnCar", AddressOf CarCommand)     BindKey(Keys.F7, AddressOf SpawnInfernus)  End Sub  Public Sub ExplodeCommand()     World.AddExplosion(Player.Character.Position)  End Sub  Public Sub CarCommand(ByVal Parameter As ParameterCollection)     Dim CarType As String     Select Case Parameter.ToInteger(0) ' convert the first parameter (0) into an integer value        Case 1 : CarType = "INFERNUS"        Case 2 : CarType = "COMET"        Case 3 : CarType = "SULTANRS"        Case 4 : CarType = "PATRIOT"        Case 5 : CarType = "NRG900"        Case 6 : CarType = "ANNIHILATOR"        Case Else : CarType = "AIRTUG"     End Select     Dim v As Vehicle = World.CreateVehicle(CarType, Player.Character.Position.Around(5.0F))  End Sub  Public Sub SpawnInfernus()     World.CreateVehicle("INFERNUS", Player.Character.Position.Around(5.0F))  End Sub

 

Ok then i was right. I browsed using the Object Browser ^^

Share this post


Link to post
Share on other sites
diryboy

 

Also a new (optional) way to handle Key and Console input, as diryboy suggested (not included in the current testversion)

Great to hear that!

 

well i am trying to compile aru's project with /clr as you did in the early time, i just want to study some interop stuff, could you provide me with some guidance? i am now able to let the code execute managed code in another mixed dll, but when the managed code try to call the native function, the game crash confused.gif

 

i just wonder how did you managed to produce just one dll. Great work Hazard. i PMed you, hope you can give me a hand, thank you, really.

Edited by diryboy

Share this post


Link to post
Share on other sites
CoMPMStR

The only native command I tried messing with recently was SET_CHAR_WANTED_BY_POLICE. I noticed setting it to true wasn't making any peds wanted by the cops, including myself. I decided to see if the parameters were reversed or something like the CantBeDamagedByRelationshipGroup native. Calling the function normally with a ped as the first param and boolean as the second doesn't produce errors (yet it doesn't work), but when I reverse them, i get the Error during RemoteEvent 'nativecall' message. This is what it says:

 

 

2009-02-12 13:03:33 - Error during RemoteEvent 'nativecall':                     System.NullReferenceException: Object reference not set to an instance of an object.                        at GTA.RemoteScriptDomain.get_CurrentScript()                        at GTA.Native.Function.BaseCall(String Name, Parameter[] Arguments)                        at GTA.Native.Function.Call(String Name, Parameter[] Arguments)                        at GTA.Native.Template.Invoke()                        at GTA.ScriptDomain.RemoteEvent(RemoteEventArgs ev)

 

 

The same thing happens for the native SET_PED_IS_DRUNK. I'm guessing this means not to reverse the params. Just wanted to see if it would work since the way they currently are don't work.

 

Also I figured out 2 of the char proofs. The 3rd unknown is explosion proof, and the 4th is no fall damage. I still can't figure out the other 3, but if I do I'll let you know. wink.gif

Share this post


Link to post
Share on other sites
HazardX

 

Also I figured out 2 of the char proofs. The 3rd unknown is explosion proof, and the 4th is no fall damage. I still can't figure out the other 3, but if I do I'll let you know. wink.gif

Hmm, it seems like they are in sync with the car proofs: Bullets, Fire, Explosions, Collisions/Falling, MeleeAttacks. I'll try if i'm able to verify this theory. smile.gif

 

@diryboy: i'll send you a PM after i'm done with the current release.

Share this post


Link to post
Share on other sites
diryboy
Also I figured out 2 of the char proofs. The 3rd unknown is explosion proof, and the 4th is no fall damage. I still can't figure out the other 3, but if I do I'll let you know. wink.gif

Hmm, it seems like they are in sync with the car proofs: Bullets, Fire, Explosions, Collisions/Falling, MeleeAttacks. I'll try if i'm able to verify this theory. smile.gif

 

@diryboy: i'll send you a PM after i'm done with the current release.

cool, i'm looking forward to receiving it, once i'm able to deal with the interop things, i switch to your scripthook and provide some help or suggestion if i can.

Share this post


Link to post
Share on other sites
CoMPMStR

 

Hmm, it seems like they are in sync with the car proofs: Bullets, Fire, Explosions, Collisions/Falling, MeleeAttacks. I'll try if i'm able to verify this theory. smile.gif

Yup, I believe you're correct. I just tested the first 2 char proofs and they are in sync with the car proofs as well. Just wanted to confirm. wink.gif

 

EDIT: Is it possible to call natives during game runtime? I have a script set up to receive console commands to call natives, the problem is they don't take effect. I call a native, it lets me know that it succeeds and yet the effect doesn't take place. confused.gif Any reason why? Nevermind, I had conflicting scripts.. lol.gif I got it working. colgate.gif

Edited by CoMPMStR

Share this post


Link to post
Share on other sites
HazardX

Finally... biggrin.gif

 

NEW VERSION:

 

GTAIV .Net Script Hook v0.84 BETA

 

Changes in Version 0.84 BETA:

- Complete rewrite of the internal scripting and thread structure. Crashes on Game & Script reloading should be gone now!

- added easy to use Euphoria (NaturalMotion) helpers to the Ped class

- added BindKey and BindConsoleCommand to Scripts - thanks to diryboy for the idea!

- added ApplyForce function to Peds, Vehicles and Objects

- the Font width is now determined based on the screen resulution. Use Font.EnforcedWidth to set a custom width.

- added "Scaling" to the Font class, which allows you to scale fonts by Pixels, FontSize or ScreenUnits.

- added Euphoria example (demonstrating Zombie-like movement)

- added BindKey, BindConsoleCommand and PerFrameDrawing examples

- even more stuff

Share this post


Link to post
Share on other sites
boomer678
Finally... biggrin.gif

 

NEW VERSION:

 

GTAIV .Net Script Hook v0.84 BETA

 

Changes in Version 0.84 BETA:

- Complete rewrite of the internal scripting and thread structure. Crashes on Game & Script reloading should be gone now!

- added easy to use Euphoria (NaturalMotion) helpers to the Ped class

- added BindKey and BindConsoleCommand to Scripts - thanks to diryboy for the idea!

- added ApplyForce function to Peds, Vehicles and Objects

- the Font width is now determined based on the screen resulution. Use Font.EnforcedWidth to set a custom width.

- added "Scaling" to the Font class, which allows you to scale fonts by Pixels, FontSize or ScreenUnits.

- added Euphoria example (demonstrating Zombie-like movement)

- added BindKey, BindConsoleCommand and PerFrameDrawing examples

- even more stuff

Awesomeness biggrin.gif i hope my mod doesnt get screwed up though wow.gif

Share this post


Link to post
Share on other sites
boomer678
Finally... biggrin.gif

 

NEW VERSION:

 

GTAIV .Net Script Hook v0.84 BETA

 

Changes in Version 0.84 BETA:

- Complete rewrite of the internal scripting and thread structure. Crashes on Game & Script reloading should be gone now!

- added easy to use Euphoria (NaturalMotion) helpers to the Ped class

- added BindKey and BindConsoleCommand to Scripts - thanks to diryboy for the idea!

- added ApplyForce function to Peds, Vehicles and Objects

- the Font width is now determined based on the screen resulution. Use Font.EnforcedWidth to set a custom width.

- added "Scaling" to the Font class, which allows you to scale fonts by Pixels, FontSize or ScreenUnits.

- added Euphoria example (demonstrating Zombie-like movement)

- added BindKey, BindConsoleCommand and PerFrameDrawing examples

- even more stuff

Awesomeness biggrin.gif i hope my mod doesnt get screwed up though wow.gif

THe download is still the 82 version

 

GTAIV .Net Script Hook v0.82 BETA

i checked readme and its still that wow.gif

 

 

Share this post


Link to post
Share on other sites
HazardX
THe download is still the 82 version

 

GTAIV .Net Script Hook v0.82 BETA

i checked readme and its still that wow.gif

Hmm, not here. You should try to clear your browser cache.

Share this post


Link to post
Share on other sites
boomer678
THe download is still the 82 version

 

GTAIV .Net Script Hook v0.82 BETA

i checked readme and its still that wow.gif

Hmm, not here. You should try to clear your browser cache.

hold on ill retry ..

 

Share this post


Link to post
Share on other sites
boomer678

 

THe download is still the 82 version

 

GTAIV .Net Script Hook v0.82 BETA

i checked readme and its still that wow.gif

Hmm, not here. You should try to clear your browser cache.

hold on ill retry ..

It still says .82 BETA sad.gif hmmm could you mirror it somewhere like filefront and pm me link****************NEVER MIND I CLEARED IT AND IT WORKED NVMVMVMVMVMVMV*******edit only a few errors in my mod. ( Font width, but i can delete that because you made it based on resoltuion)

Edited by boomer678

Share this post


Link to post
Share on other sites
HazardX

Great. smile.gif

 

Make sure not to miss my new GrabScript. wink.gif *shameless selfadvertisement*

Share this post


Link to post
Share on other sites
boomer678
THe download is still the 82 version

 

GTAIV .Net Script Hook v0.82 BETA

i checked readme and its still that wow.gif

Hmm, not here. You should try to clear your browser cache.

hold on ill retry ..

It still says .82 BETA sad.gif hmmm could you mirror it somewhere like filefront and pm me link****************NEVER MIND I CLEARED IT AND IT WORKED NVMVMVMVMVMVMV*******edit only a few errors in my mod. ( Font width, but i can delete that because you made it based on resoltuion)

Hazard. About the Player.Character.ApplyForce(-_-) What do the directional/ angular mean. Like 90.0F if i want to get launched straight up? plz give a small example

Share this post


Link to post
Share on other sites
HazardX
Hazard. About the Player.Character.ApplyForce(-_-) What do the directional/ angular mean. Like 90.0F if i want to get launched straight up? plz give a small example

Okay, i gues i should have split them up into two seperate functions to make things more clear... use directional force if you want to push the object into a direction ad use angular force if you want to apply a rotation to the object. straight up would be:

 

ApplyForce( new Vector3(0,0,10), new Vector3 )

Share this post


Link to post
Share on other sites
boomer678
Hazard. About the  Player.Character.ApplyForce(-_-) What do the directional/ angular mean. Like 90.0F if i want to get launched straight up? plz give a small example

Okay, i gues i should have split them up into two seperate functions to make things more clear... use directional force if you want to push the object into a direction ad use angular force if you want to apply a rotation to the object. straight up would be:

 

ApplyForce( new Vector3(0,0,10), new Vector3 )

kk thanks

Share this post


Link to post
Share on other sites
Dangta

Hi HazardX, excellent project you got here. I played a little with it and was very impressed, it's extremely easy to work with.

 

user posted image

 

http://pastebin.com/f4c303a5e

 

Here is a nice car spawning script that i made that has a nice menu. You can have as much cars as you want although i didn't program it to try to fit them all on screen.

 

Use Numpad0 to bring up the menu, use Numpad1 to go to the next menu item and Numpad1 to spawn the car.

 

The items are coloured based on the type of vehicle it is, to make it a bit more user friendly.

 

Enjoy!

 

Thanks,

DanGTA

Share this post


Link to post
Share on other sites
fengyeblade

Great ¡£¡£¡£¡£¡£¡£¡£¡£ New edtion¡£¡£

Share this post


Link to post
Share on other sites
Phnx

Looking forward to finally seeing some great camhack!!! biggrin.gif

Share this post


Link to post
Share on other sites
diryboy

hi Hazard i poke around the Task related types and feel it weird to use. maybe it's possible to re-architect to enable the idea of chainning, it may looks like the following outline to fit the general use of Tasks:

 

all codes below are written in C#

 

1. Simplest way to make sb. perform a sequence of task:

 

Ped ped = GetAnInterestedPed();ped.BeginTask()  // This line new up a PedTask object associated with ped and return it   .SwapWeapon(Weapon.Handgun_Glock)   .FightAgainst(Player, 5000)   .FleeFromChar(Player, false, 5000)   .Die()   .End();       // Once we're done configuring the tasks, call PedTask.End()

 

 

2. Create a reusable TaskSequence object for later use:

 

TaskSequence ts   = TaskSequence.BeginSequence()//Internally new up a Task not assciated and return it                .SwapWeapon(Weapon.Handgun_Glock)                .FightAgainst(Player, 5000)                .End();   // Once we're done  configuring, call Task.End()

 

 

as we can see PedTask should inherit Task and override End() method to perform task immediatly.

 

3. Some peds wants to perform a TaskSequence, two possible ways:

 

// 1st way, easyped1.PerformTaskSequence(ts);ped2.PerformTaskSequence(ts);...// 2nd way, may need some dirty work internally, i dont know if it can be implementedts.Attach(ped1).Attach(ped2).Attach(ped3) ...  .Perform(Mode.Concurrently); // or sequentially

 

 

Chainning tasks would be another great feature, i hope this would be included in the next version.

Edited by diryboy

Share this post


Link to post
Share on other sites
fengyeblade

Hi Hazard

I changed Niko's Skin and i save the game. This GameSave was invalidate. If i restart game, it will crash when loading.....

 

How can i change niko's skin ny safely. or return niko's skin?

 

thanks

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

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