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

GhostGum

[GTAIV|REL|SRC] GTAScript.Net

Recommended Posts

GhostGum

Hi,

 

I have been creating a CLI Wrapper class library & .Net script loader for Aru's GTAIV C++ Script Hook.

Allows writing of scripts for GTA IV in any dotnet language (C#, VB.Net, VC++).

It is very much in beta stage, but it works.

I haven't really done much testing, seems to be stable though.

Full source code is included!

 

If anyone wants to help, i would love some help writing the classes for Ped, Vehicle, GameObject, Player, Screen, etc. As there are a LOT of native functions to add methods for in there. See existing methods in those classes for example.

 

 

 

GTAScript - 0.0.3.0

GhostGum - 2009

GhostGum85(at)gmail(dot)com

 

 

 

GTAScript:

An open source GTA IV .Net Scripthook.

C++ CLI Wrapper class library & .Net script loader for Aru's GTAIV C++ Script Hook.

Based on the GTAIV C++ Script Hook by Aru <oneforaru at gmail dot com>.

Full source available at: http://gtascript.codeplex.com/

 

Requirements:

* Grand Theft Auto IV 1.0.4 r5 by Rockstar Games - http://www.rockstargames.com/IV/

* Microsoft .Net Framework 3.5 by Microsoft - http://www.microsoft.com/downloads/details...&displaylang=en

* GTA IV C++ Script Hook by Aru - http://www.gtaforums.com/index.php?showtopic=390582

* any GTA IV asi loader. eg. Asi loader by Alexander Blade - http://www.gtaforums.com/index.php?showtopic=380830

 

- The following are not required, but may help:

* GTA IV FileCheck fix by Alexander Blade; for multiplayer - http://alexander.sannybuilder.com/?category=iv_patchesfixes

* GTA IV EFC20 Error fix by Alexander Blade; fixes EFC20 error - http://alexander.sannybuilder.com/?category=iv_patchesfixes

 

Installation:

* Put files 'GTAScript.dll' & 'GTAScriptEntry.asi' in your GTA IV directory. (eg, c:\Games\GTA IV\Grand Theft Auto IV\)

* Put any script files (eg, 'TestScript.Net.dll') in your GTA IV\scripts\ directory. (eg, c:\Games\GTA IV\Grand Theft Auto IV\scripts\)

* All script files should be named '*.Net.dll';

 

Uninstall:

* Just delete 'GTAScript.dll' & 'GTAScriptEntry.asi'.

 

 

Changelog:

 

0.0.3.0 - 2010.02.10

* Added keyboard & mouse hook for better capture of input.

* Added simple forms class for drawing of windows forms to GTA screen.

* Added drawing & input for forms controls: Text, Button, Checkbox

* Changed script overrides to event based approach.

* Numerous misc fixes & cleanups.

 

0.0.2.0 - 2009.12.19

* Added Scrips Unload & Scripts Reload function. Press CTRL-F11 to unload all scripts, CTRL-F12 to reload scripts.

* Optimization to world class so it doesnt use to much processor time scanning objects.

* A few other misc additions.

 

0.0.1.0 - 2009.12.16

* First public release.

 

Download:

 

* Binary - http://gtascript.codeplex.com/Release/Proj...ReleaseId=40239

* Source - http://gtascript.codeplex.com/SourceControl/list/changesets

 

 

Some scripts:

 

GravityGun:

http://www.gtaforums.com/index.php?showtopic=435833

 

 

 

Vehicle Weapons Mod:

http://www.gtaforums.com/index.php?showtopic=435633

 

Edited by GhostGum

Share this post


Link to post
Share on other sites
NTAuthority

Gr, another guy who decides on writing a IV C++/CLI wrapper for the existing script hook. Oh well, since I need compatibility with my SA hook anyway, I'll just not release the hook separately from my planned CitizenIV project. smile.gif

 

Anyway, nice hook you got there... it's better than my SA hook's Initialize.cpp, which is full of crap. Seriously. smile.gif It needs a rewrite, and I might refer to your hook for a few concept ideas for that rewrite. (seriously, I didn't know about AppDomain stuff tounge.gif )

 

 

* more methods in OO classes for Player, Vehicle, Ped, World, GameObject, Screen, etc

 

 

Oh, yeah, I know that problem. Heck, CitizenSA is full of direct GTA function calls. tounge.gif Anyway, it seems it really was unneeded for me to actually create a tree of 3 functions in DllMain until I could run my own managed code; but don't know why I did so. I told you it was crappy? tounge.gif

 

(hm, AppDomains run in-process? didn't know that was actually true! another thing I want to try smile.gif )

 

EDIT: oh, and your World::SearchX looks a lot like mine. Crappy and taking a lot of frames, but with IV's constantly changing nature it'd be a problem to loop through the CPed instances tounge.gif

Edited by NTAuthority

Share this post


Link to post
Share on other sites
XXLpeanuts

it wont load my scripts, LCPD FR...........?

Share this post


Link to post
Share on other sites
GhostGum

I take it you too were working on a C++/CLI wrapper NTAuthority? Dont let this stop you from releasing!

 

Creating all those methods in OO classes is gonna be painful. However I have converted most of aru's Scripting.h into a a CLI wrapper class ScriptAPI.h (actualy i wrote an app to do it for me(i hate writing string minipulation!)), which allows calling those functions from scripts, so the OO classes are not seriously required, but they make things much simpler for scripters.

 

App domains will run in process, but have their own memory space (so require thier own object instances, etc). But objects can be shared over app domain via proxy, if they inherit from MarshalByRefObject.

 

 

yeah bloody oath the world::SearchX is certainly an ugly & expensive hack. Hell, its handling exceptions as a part of its search! sad.gif ugly.

 

 

 

edit - XXLpeanuts this will not load scripts that are written(wrote?) for HazardX's .Net scripthook.

Edited by GhostGum

Share this post


Link to post
Share on other sites
sjaak327

Another one for the .net people, and open source to boot, nice one.

 

Been looking at your getallobjects stuff, (yes I am still interested in playing with that), wonder if I can make something similar just using aru's hook. Not sure how to cut down the performance issues though:)

 

Share this post


Link to post
Share on other sites
NTAuthority

 

I take it you too were working on a C++/CLI wrapper NTAuthority? Dont let this stop you from releasing!

 

Initially for SA, but I'm planning to after finishing 'GTAScriptHook 2' to port it to VC and IV, with IV also used for a port of my own project... and three incompatible hooks is going to be a bit painful smile.gif

 

 

Creating all those methods in OO classes is gonna be painful. However I have converted most of aru's Scripting.h into a a CLI wrapper class ScriptAPI.h (actualy i wrote an app to do it for me(i hate writing string minipulation!)), which allows calling those functions from scripts, so the OO classes are not seriously required, but they make things much simpler for scripters.

 

Heck, my SA hook is even more fun... since the base C++ hook I used didn't have function calls to use and name hashes were only used externally since GTA IV, most things need to be referenced using the function number... I once wrote some code which was full of 'Opcode.Call' calls; for IV I'd likely just make a mapping of function names to their GTA3 ID. And still, I use regexes all the time for parsing such stuff... using string.Substring is really, well, strange. tounge.gif

 

My process when I need a function actually goes like this:

 

- write it using Opcode.Call

- if I use it a lot, think about coding it in the hook itself

- use Opcode.Call some more

- code it in the hook

- do not replace the old calls

 

... hacky smile.gif

 

 

App domains will run in process, but have  their own memory space (so require thier own object instances, etc). But objects can be shared over app domain via proxy, if they inherit from MarshalByRefObject.

 

Hm, that means it won't really be a solution for me (or I could write my hook so that every assembly has its own AppDomain, and pre-exist sharing stuff); my (pretty large, > 100 kB of MSIL) generic game script code contains a lot of static methods which need to share stuff in-between... or do static properties get shared?

 

yeah bloody oath the world::SearchX is certainly an ugly & expensive hack. Hell, its handling exceptions as a part of its search! sad.gif ugly.

 

 

My current one is a lot simpler (it actually calls Wait a lot of times without specific tick, takes 20 frames to look for things; during which the returned values might already be de-streamed!) and might even be incompatible with IV's handle IDs... but getting the CPed stuff would require reading the assembly code since I also target SA v1.01 and v2, but it would be even more stupid in IV. need to find a way to do that correctly tounge.gif

 

Heck, how much I love poking around the internal technology of GTA games. tounge.gif

Edited by NTAuthority

Share this post


Link to post
Share on other sites
GhostGum

 

Heck, my SA hook is even more fun... since the base C++ hook I used didn't have function calls to use and name hashes were only used externally since GTA IV, most things need to be referenced using the function number... I once wrote some code which was full of 'Opcode.Call' calls;

 

Damn, now that would be painful indeed cry.gif

 

 

And still, I use regexes all the time for parsing such stuff... using string.Substring is really, well, strange. 

 

String minipulation is ugly stuff, i have never quite got my head around regex, just too damn confuzzling confused.gif .

 

 

My process when I need a function actually goes like this:

 

- write it using Opcode.Call

- if I use it a lot, think about coding it in the hook itself

- use Opcode.Call some more

- code it in the hook

- do not replace the old calls

 

LMAO, damn, i see myself following that process with this already sad.gif . Thankfully i dont have to use opcode calls though, that would just be hell.

 

 

Static properties are not shared over app domains, but can you not just initialize what you need in your scripts app domain, and create proxy refs to anything that does need to be shared over domains?

With this, im initializing an inst of my app domain class in main domain, the app domain class then creates the actual app domain & initializes an inst of script loader class in the app domain & create a proxy ref to the scriptloader instance for access to scripts from main domain.; everything else is initialized in the script domain.

 

 

  Another one for the .net people, and open source to boot, nice one.

 

Been looking at your getallobjects stuff, (yes I am still interested in playing with that), wonder if I can make something similar just using aru's hook. Not sure how to cut down the performance issues though:)

smile.gif I wanted to script in .Net but relying on closed source scares me, too much chance that my time scripting spent could turn to dust.

Its an ugly method to getallobjects, but better than scanning network id's right? wink.gif

 

Share this post


Link to post
Share on other sites
XXLpeanuts

Oh sad.gif lol thats okay.

 

 

Oh no it wont load your vehicle weapons mod either though, i must have done something wrong, help?!

Edited by XXLpeanuts

Share this post


Link to post
Share on other sites
GhostGum

Oh no it wont load your vehicle weapons mod either though, i must have done something wrong, help?!

Yeah sorry, i uploaded a version of that mod that wasnt compatible with this version of GTAScript.Net. I have updated the link for Vehicle Weapons Mod. Download it again & it *should* work. I havnt tested though. If it still doesnt work then pls post the contents of GTAScript.log (found in your GTA directory).

Share this post


Link to post
Share on other sites
abcadgfawghaeheheahaeh

you should try to work with hazardx. you two would make a fantastic tool! tounge.gif

Share this post


Link to post
Share on other sites
groeneweg

Do mods that were written for HazardX's .net script loader need to be tweaked to work for this one, or will they work automagically?

Share this post


Link to post
Share on other sites
Murcchachosa

Is it possible to pick up one object?

Like the gastank and gravityin it and throw it at peds/cars and off buildings?

 

Though finally a Gravity Gun wich picks like this.

 

And could you make it compatible for patch under No. 5?

The latest patch f*cked up the game very hard.

And more sad, it doesnt work on patch 1, very nice...

Edited by Murcchachosa

Share this post


Link to post
Share on other sites
abcadgfawghaeheheahaeh

um by the way. are there a console in this plugin? and how do i use the ggun? theres no readme.

Share this post


Link to post
Share on other sites
GhostGum

There is a method World::GetClosestObjectInArea(Vector3 coords, float area) which you can use to pickup 1 object.

 

This only compatible with patch 5 (1.0.4 u5) which is the latest patch. I do not intend on adding support for older patches, but full source is available so if you want support then it shouldnt be too much trouble to add it yourself. (Unofficialy, my dev machine is still on patch 4 (1.0.0.4) so i know that atleast works too).

 

 

groeneweg, mods written for HazardX's .Net hook will not automagically work. while technicaly it would be possible to make them automagically work, it would be more work than its worth to do so.

Although i will try to name & structure things similar where i can, so mods can easily be converted. If the source code for the mods is available to you then it shouldnt be too much work to convert, if not then sadly no, it wont work.

 

kimr120, HazardX's .Net hook is closed source, else i would have just contributed to it rather than re-inventing the wheel.

 

 

 

edit - No console, the console is a very cool & handy feature of HazardX's hook though, so its on the todo list to add one.

- To use the gravity gun script, equip a pistol (picks up one obj at a time) or a Desert Eagle (picks up multiple objects) and hold RMB to aim, & hold MMB to activate.

Share this post


Link to post
Share on other sites
Murcchachosa

Big bummer it doesnt support patches.

Im sure huge amount wont use the patch5 because of fk up graphicals bugs/glitches.

Seems I have to let it over. (again)

 

Im not a coder so I dont know how to add it.

Share this post


Link to post
Share on other sites
GhostGum

Well it might just work with your patch, try it & see. You must understand that to support all the patches i would need 5 different versions of GTA installed, then i would have to make sure i code support for those 5 different versions, then i would have to test everything in those 5 different versions. I would much prefer to add features for 1 version than waste my time supporting 5 different versions. But AFAIK i havnt coded anything specific to update 5 yet, so try it with your patch, it might just work without any troubles (as i say, my dev machine is still on update 4 (purely due to lazyness) and i know that works fine).

Share this post


Link to post
Share on other sites
Murcchachosa

Alright then, add that script and I'll test it on my machine with u1.

That would spare you much time.

Share this post


Link to post
Share on other sites
atkins513

I have installed the net script twice in a row now on fresh installs. Both times I dropped 10-15 FPS, just running it. Even when the scripts folder is empty, i get this huge drop in FPS just running the script. This may be something you want to address... thanks for all your work.

 

Gary

Share this post


Link to post
Share on other sites
GhostGum

I will address this in next version. Cheers for the feedback.

Edited by GhostGum

Share this post


Link to post
Share on other sites
alios1024

I made it, ggun works on my machine with 1.0.4.0 version (not 1.0.0.4) ,

and scripthook.dll (0.4.0), xlive.dll (0.99b1), filecheck, and EFC20 fix.

 

good job dude!!!

 

 

It also works when loading with Simple Native Trainer 4.8 and I can see the trainer's menu.

But there is a minor trouble while the Num 5 key is getting hard to function to browse trainer's menu

when loading with ggun script together, but the key functions fine when typing in windows.

Makes me have to press several times to get job done...

 

Anyway, ggun is a cool script, I sure enjoy this one and be waiting for the next release, thx!!!

Edited by alios1024

Share this post


Link to post
Share on other sites
atkins513

ok, a few things.

 

A> The net scripthook itself work for patch 5 1.0.0.4. Just kills the FPS for some reason. I drop about 15 just running it, as mentioned above.

 

B> The Gravity gun functions fine with the scripthook on patch 5.

 

C> The Vehicle Weapons that I really really really want to use does not seem to function at all... I really want to use this, as mentioned, lol. This seems like a really cool mod... any suggestions for me, or can you code it for patch 5? or is it already? I dont know... any suggestions?

 

Thanks, Gary

Share this post


Link to post
Share on other sites
GhostGum

Okay i have updated to version 0.0.2.0.

The framerate drop should be much less now.

 

Changelog:

0.0.2.0 - 2009.12.19

* Added Scripts Unload & Scripts Reload function. Press CTRL-F11 to unload all scripts, CTRL-F12 to reload scripts.

* Optimization to world class so it doesnt use to much processor time scanning objects.

* A few other misc additions.

 

 

 

atkins, try the VehicleWeaponsMod with this version, hopefully should work now.

Share this post


Link to post
Share on other sites
francismori7

Will there be an update? because the ELS mod cannot work beside the LCPD FR mod. For ELS to work, you must remove ScriptHookDotNet.asi but then you don't have the LCPD FR mod. Otherwise it crashes after loading a savegame.

Share this post


Link to post
Share on other sites
ZNERB

GhostGum, your a legend! Have been waiting so long for an open source version to come along. Just a while ago, I began working on one myself, but unfortunately everything just gets in the way... confused.gif

 

Looking forward to scripting with your hook, as well as working on it. Don't worry about any bugs, or features you don't have in your hook - it will be fixed in no time, especially with open source!

 

It good to know there are other coders out there. How long did you spend working on your hook for .NET before it became workable?

 

Once again, thanks! biggrin.gif

Share this post


Link to post
Share on other sites
GhostGum

smile.gif Im glad you like it. I will appreciate any code contributions you wish to add.

 

Not sure how long i spent working on it, i started prolly a few weeks ago, not sure, didnt mark the date down anywhere.

 

 

Share this post


Link to post
Share on other sites
Zach

 

..., xlive.dll (0.99b1), filecheck,...

 

I've been out of the game for the last couple of patches, so maybe something has changed, but if you use xliveless, why are you bothering with the filecheck mod? xliveless already includes that feature. (Update: Yeah, I just looked at his readme file, and even with Patch 5, you don't need the filecheck mod. It's redundant. Just so you know. smile.gif)

 

And to anyone, what's the deal with the EFC20 fix? Is that really required? In other words, is that a product of one of the last two patches, or is that just a problem depending on what asi loader you use?

 

Update 2: Yeah, with xliveless, you don't need to worry about EFC checks, either:

 

 

*(DWORD *)(0x5269BD+dwLoadOffset) = 0x90000002;	// jmp 526BC6 (skip RGSC connect and EFC checks)  

 

 

I pity those who are into all that XBox Live and Achievement silliness and, thus, can't use xliveless. biggrin.gif

Edited by Zach

Share this post


Link to post
Share on other sites
Sp4s12

If this script allows LCPDFR running, could anyone explain me how to install it ?

 

i put the LCPDFR script into the scripts directory's, but in game, when i'm pushing ALT P, nothing happens... What must i do ?

Share this post


Link to post
Share on other sites
GhostGum

Zach, i just added to the readme everything that might be required to get it working, to save time on support. GTA doesnt work for me without the EFC20 fix, never has since first(?) patch.I wasnt sure if filecheckfix was required for multi/single/notatall, so added it to readme anyway, even if you dont require it, its good to have links to anything that might be rerquired in one readme. Also i dont use Xliveless, i enjoy the odd multiplayer bash.

 

 

Sp4s12, this does not load mods that are made for ScriptHookDotNet (i think ill have to add that to readme), so no, it wont load LCPDFR.

Share this post


Link to post
Share on other sites
Sp4s12

Ok no problem wink.gif

that's because i can't wait anymore the latest patch of scripthookdotnet biggrin.gif

Share this post


Link to post
Share on other sites
ahatius

I guess this has an multiplayer lock? When loading a script in single player it works. When connection to free mode it crashes, when connecting to team mafia it just doesn't load the script, game itself doesn't crash.

 

Ok I guess the multiplayer lock comes from aru's side. But free mode should work instead of crashing...

Edited by ahatius

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.