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

    1. GTANet.com

    1. GTA Online

      1. The Cayo Perico Heist
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Red Dead Online

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

    1. Red Dead Redemption 2

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

    1. Grand Theft Auto Series

      1. 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. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    7. GTA III

      1. Guides & Strategies
      2. 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. 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

      1. GTANet 20th Anniversary
    2. Support

    3. Suggestions

[WIP|REL] San Andreas .NET Script Hook


NTAuthority

Recommended Posts

What is this mod?

 

This modification is, like other script hooks, adds a external scripting possibility to SA. I know CLEO already exists, but SA's SCM language has some major limitations -- so I wrote this .NET scripting hook. It is inspired by HazardX's IV scripting hook, and based on the existing C++ SA script hook.

 

This version is a pretty tiny initial testing version, with just a few APIs (and a CallOpcode function smile.gif )

 

How to use this mod?

 

Just copy the scripts directory and the .asi file to your SA directory. The .NET Framework 3.5, and the Visual C++ 2008 Runtime are required. For development I recommend using Visual Studio/Visual C# Express's IntelliSense feature, example scripts for C# are in the scripts/development/ directory.

 

The hook will read both compiled .dll files, and .cs/.vb files, though Visual Basic is untested. To open or close the console, just press `.

 

TestScript2.cs has a keybinding of 'U': spawn a Ballas member and add some health to the player.

RandomStuff.cs has more key bindings:

 

- 'I': display a text box

- 'O': Spawn a Vagos member.

- 'kill' in console: Kill the player.

- 'spawn groves' in console: spawn 3 GSF members around the player

 

Where to download?

 

Version 0.0.3

 

You will need at least the DirectX November 2008 runtimes to use the script hook!

 

I look forward to your comments. smile.gif

Edited by NTAuthority
  • Like 3
Link to post
Share on other sites
Really interesting, but it seems that there aren't any references, or am I wrong?

You can simply add the .asi file as reference in Visual Studio if you copy it to a .dll -- didn't know VS would give errors if it's not a .dll file, will fix it in the next version. smile.gif

Link to post
Share on other sites

 

cool! but this means i have to learn C++ to code for this hook? I only know Java, VB.Net and Cleo confused.gif

Nope, you can't even use C++ 'officially' biggrin.gif The examples are just C#, but I have also written in support for VB.NET scripts, though you will need to discover the syntax yourself. By the way, C# is almost Java syntax with VB.NET's class libraries. smile.gif Next up for this hook: car APIs, and some more character stuff.

 

EDIT: ported RandomStuff.cs to VB.NET:

 

 

Imports SystemImports System.Collections.GenericImports System.TextNamespace TestScript1   Public Class TestScript       Inherits GTA.Script       Public Sub TestScript()           BindKey(System.Windows.Forms.Keys.O, New GTA.KeyPressDelegate(AddressOf SpawnVago))           BindKey(System.Windows.Forms.Keys.I, New GTA.KeyPressDelegate(AddressOf ShowText))           BindConsoleCommand("kill", New GTA.ConsoleCommandDelegate(AddressOf Kill), Me)           BindConsoleCommand("spawn groves", New GTA.ConsoleCommandDelegate(AddressOf NewGroves), Me)       End Sub       Public Sub Kill(ByVal args As String())           PlayerObject.Character.Health = 0           GTA.Console.WriteLine("Killed the player!")       End Sub       Public Sub NewGroves(ByVal args As String())           Dim ped As GTA.Char = GTA.World.CreateChar(GTA.PedID.FAM1, PlayerObject.Character.Position.Around(2), 4)           ped = GTA.World.CreateChar(GTA.PedID.FAM2, PlayerObject.Character.Position.Around(2), 4)           ped = GTA.World.CreateChar(GTA.PedID.FAM3, PlayerObject.Character.Position.Around(2), 4)       End Sub       Public Sub SpawnVago()           Dim vector As GTA.Vector3 = PlayerObject.Character.Position           vector.pY += 1           Dim ped As GTA.Char = GTA.World.CreateChar(GTA.PedID.LSV2, vector, 4)       End Sub       Public Sub ShowText()           GTA.Game.DisplayTextBox("You pressed I")       End Sub   End ClassEnd Namespace

 

Edited by NTAuthority
Link to post
Share on other sites
  • 2 months later...
  • 3 weeks later...

Sorry for bump, But I downloaded this and started testing it. It's really nice. The only thing I found wrong with it is that I can't get it to read .dll's, but thats not really a big deal, as it reads the C# source file biggrin.gif

 

By the way, is there a documentation on it, like for what it supports, like vehicle API's for example? I was also wondering if it had a weapons API in it

Link to post
Share on other sites
Sorry for bump, But I downloaded this and started testing it. It's really nice. The only thing I found wrong with it is that I can't get it to read .dll's, but thats not really a big deal, as it reads the C# source file biggrin.gif

 

By the way, is there a documentation on it, like for what it supports, like vehicle API's for example? I was also wondering if it had a weapons API in it

(sorry for bumping, have been away from april 30th to today)

 

It should be able to use .dll files, if not, could you please post the log file entries? Also, the GTA.Next version of the hook supports weapon changing (but Native.CallOpcode is a good help) -- I'll update the links later this week.

Link to post
Share on other sites
Sorry for bump, But I downloaded this and started testing it. It's really nice. The only thing I found wrong with it is that I can't get it to read .dll's, but thats not really a big deal, as it reads the C# source file biggrin.gif

 

By the way, is there a documentation on it, like for what it supports, like vehicle API's for example? I was also wondering if it had a weapons API in it

(sorry for bumping, have been away from april 30th to today)

 

It should be able to use .dll files, if not, could you please post the log file entries? Also, the GTA.Next version of the hook supports weapon changing (but Native.CallOpcode is a good help) -- I'll update the links later this week.

Well, My second hard drive got formatted the other day and I still need to re install San Andreas. When I re install it, I will get the logs and upload them for you biggrin.gif.

 

Thank you for your answer, when I get every thing set back up I will be experimenting with this more.

Link to post
Share on other sites
  • 2 months later...
I don't think it is

It is, though I haven't gotten around to releasing the new version (with HUGE updates) tounge.gif

Link to post
Share on other sites
  • 2 weeks later...

A tiny hint of one of the more special features in the next version... texture drawing. And by that, I mean with the old DX hooking code, but with a feature the IV hook doesn't have. If you know some C#, check out the code below:

 

 

this.tex = new Texture(256, 32);// ...Graphics rbg = this.tex.LockBitmap();rbg.DrawString("Woef", this.font, new SolidBrush(Color.Black), 125, 0);this.tex.UnlockBitmap();// and... in another 'event'Direct3D.DrawSprite(tex, new RectangleF(vPos.X, vPos.Y, GetX(105), GetY(28)), Color.White, 256f, 32f);

 

 

Indeed, the most annoying thing in the world (LockRectangle) now in a easy-to-use package for drawing your own dynamic textures. biggrin.gif

 

 

Link to post
Share on other sites

biggrin.gif

 

Very nice

 

EDIT : Oh yeah, forgot to say. Well, in C# I added SanAndreasScriptHook as a reference, and even when I have

using SanAndreasScriptHook;

I get the error :

The type or namespace name 'SanAndreasScriptHook' could not be found (are you missing a using directive or an assembly reference?)

 

I never got it before cause I never added the reference.

 

Any way to fix this?

Edited by joemomma53
Link to post
Share on other sites
EDIT : Oh yeah, forgot to say. Well, in C# I added SanAndreasScriptHook as a reference, and even when I have
using SanAndreasScriptHook;

I get the error :

The type or namespace name 'SanAndreasScriptHook' could not be found (are you missing a using directive or an assembly reference?)

 

I never got it before cause I never added the reference.

 

Any way to fix this?

Sorry for the late response... but as you may have already figured out, the assembly name is indeed SanAndreasScriptHook, but the namespace everything's in is named GTA. By the way, the next release will have another very cool feature that allows you to 'hack' into the control state stuff... I have already made a cool gamepad control mod for the next version! I just want to release it now since it's so cool, but I can't tounge.gif

Link to post
Share on other sites

Thanks for the help man, I can't believe I didn't think of that, with everything being GTA, haha

 

Yeah man i'm looking forward to the new version, That sounds awesome!. Keep up the good work biggrin.gif

Link to post
Share on other sites
  • 1 month later...
  • 2 weeks later...

I just tested this on Windows 7 (64) and it doesn't seem to goto plan.

 

It crashed once at the loading screen before you spawn, it just froze at the end when the white bar was full. This was when I forgot to put my scripts asi into the scripts folder, I dropped it in the root along with your scripthook asi but when I put it in the script folder it didn't crash but didn't appear to load as the console wouldn't activate and I couldn't test the button binds as it gives me an error on compile so I removed the lines that binds 'i' & 'o' ("Windows is not a member of System").

 

I'm using VB Express (free, just downloaded it now), I added the reference dll to my project and compiled after removing the bind lines so it's the RandomStuff.vb file without the binds on Windows 7 x64 and the 'gta_sa.exe' is set to run compatible for XP SP3 (can I do this for a dll, it's not a program so I haven't checked).

 

Does this have a log file it outputs ? I couldn't find one to explore the issue myself, I'll keep it testing and see if I can get it working but I thought I'd report this incase you already have a fix.

 

Cheers.

Link to post
Share on other sites

 

I just tested this on Windows 7 (64) and it doesn't seem to goto plan.

 

It crashed once at the loading screen before you spawn, it just froze at the end when the white bar was full. This was when I forgot to put my scripts asi into the scripts folder, I dropped it in the root along with your scripthook asi but when I put it in the script folder it didn't crash but didn't appear to load as the console wouldn't activate and I couldn't test the button binds as it gives me an error on compile so I removed the lines that binds 'i' & 'o' ("Windows is not a member of System").

 

I'm using VB Express (free, just downloaded it now), I added the reference dll to my project and compiled after removing the bind lines so it's the RandomStuff.vb file without the binds on Windows 7 x64 and the 'gta_sa.exe' is set to run compatible for XP SP3 (can I do this for a dll, it's not a program so I haven't checked).

 

Does this have a log file it outputs ? I couldn't find one to explore the issue myself, I'll keep it testing and see if I can get it working but I thought I'd report this incase you already have a fix.

 

Cheers.

This current version is really buggy and out-of-date, a more recent version can be found here (copy the .asi to a .dll for a reference, you need a scripts folder and datafiles folder... all old code should still work after recompiling. and please, remove the old .asi), but it does not contain the console. Also, for key bindings, you need to add a reference to System.Windows.Forms to your project. (though I usually prefer the new GTAKey in a OnTick event... it's what you prefer)

 

(that version in the mod has some of the bugs still in, but a lot more features and such smile.gif )

 

Also, did you really have the code 'extend'-ing ('Inherits' in VB, possibly?) Script? Your file structure should, by the way, be for example:

 

GTASA\

-- citizenhook.asi

-- scripts\

---- DBNetwork.Citizen.Game.dll (your DLL file)

------ datafiles\ (nothing specific needed in there)

 

Another thing is that the mod still is incompatible with the CLEO GXTHook, but it's possible to emulate it using the new Game.CustomGXTs property. smile.gif Also, it hasn't been used much with VB, but since both are full .NET languages, it should still work. smile.gif

 

(offtopic: decided you didn't like C++? tounge.gif )

 

PS: Do you intend on releasing a mod made with this? If so, it's just about time. tounge.gif

Edited by NTAuthority
Link to post
Share on other sites

I'm going to reinstall XP on another drive soon so I'll have another go with this then dude, nothing seems to work no matter what I do, everything is setup correctly like you explained so I'm either being retarded or it's this bloody OS messing with me (probably the case).

 

No I like C++ just fine, it's C++ that doesn't like me biggrin.gif

 

I plan on doing a few mods if I ever get anything working, I have many ideas that I would like to put into action, once I go back to XP then I'll start on them for sure.

 

Cheers for the help, I apreciate it.

Link to post
Share on other sites
  • 3 months later...
I tried the link,it seems to get some sort of error confused.gif .I'll post the link to the GTAGaming download page just in-case someone else is getting the same thing icon14.gif :

 

http://www.gtagaming.com/downloads/gta-san...reas/tools/2354

Thanks for the link man! biggrin.gif

Noooooooooooooooooooooooo, do not use that very old version! Until I write a new topic for the new GTAScriptHook, you should use the pre-release instead... unless you like compatibility with the 2 crap scripts I've written tounge.gif

Link to post
Share on other sites
  • 7 months later...
  • 1 month later...

I know this is a bump and I'm also doubleposting suicidal.gif

 

But: Can it be that some incompability problems occour when VC++ 2010 Runtime is installed? Because I noticed starnge behaviour of scripts since i updated the Runtime...

I also know .NET 4 is compatible downwards but could it be a cause for problems too?

cheers

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
  • 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.