|
 |
|
|
|
|
|
GTA Modification Forums
[WIP|REL] San Andreas .NET Script Hook Code SA scripts without the fuzz of CLEO
 |
|
 |
| |
NTAuthority  |
|
member_title

Group: Members
Joined: Sep 9, 2008



|
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  ) 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.3You will need at least the DirectX November 2008 runtimes to use the script hook!I look forward to your comments. This post has been edited by NTAuthority on Thursday, Apr 16 2009, 19:40
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
NTAuthority  |
|
member_title

Group: Members
Joined: Sep 9, 2008



|
| QUOTE (Grove Street Boy @ Mar 9 2009, 16:30) | cool! but this means i have to learn C++ to code for this hook? I only know Java, VB.Net and Cleo |
Nope, you can't even use C++ 'officially'  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.  Next up for this hook: car APIs, and some more character stuff. EDIT: ported RandomStuff.cs to VB.NET: | CODE | Imports System Imports System.Collections.Generic Imports System.Text
Namespace 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 Class End Namespace
| This post has been edited by NTAuthority on Monday, Mar 9 2009, 15:53
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
NTAuthority  |
|
member_title

Group: Members
Joined: Sep 9, 2008



|
| QUOTE (joemomma53 @ Jun 2 2009, 23:18) | 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 
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.
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
joemomma53  |
Posted: Thursday, Jun 11 2009, 01:14
|
Ohai

Group: Members
Joined: Jun 10, 2007


|
| QUOTE (NTAuthority @ Jun 9 2009, 14:32) | | QUOTE (joemomma53 @ Jun 2 2009, 23:18) | 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 
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  . Thank you for your answer, when I get every thing set back up I will be experimenting with this more.
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
NTAuthority  |
Posted: Saturday, Sep 5 2009, 17:36
|
member_title

Group: Members
Joined: Sep 9, 2008



|
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: | CODE | 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.
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Pages:
(2) [1] 2
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
| |
 |
|
 |
|
|
|
|