|
 |
|
|
|
|
|
GTA Modification Forums
[RELEASE] Sourcecode of the GTAIV .Net ScriptHook Full source, for your modding pleasure.
 |
|
 |
| |
HazardX  |
|
pedestrian mangler

Group: Members
Joined: Dec 13, 2008


|
GTAIV .Net Script Hook SOURCECODE release v1.0 by Hazard (hazard_x@gmx.net / @HazardX) based on and includes parts of the GTAIV C++ Script Hook from Aru Classes Vector2, Vector3, Vector4, Quaternion and Matrix based on sourcecode from SlimDX- DOWNLOAD the SOURCECODE of the GTAIV .Net Script Hook HERE ! Go here if you are looking for the compiled installable version: GTAIV .Net Script Hook release threadDescriptionThis archive contains the complete C++/CLI sourcecode of the GTAIV .Net Script Hook. The compiled ASI plugin allows you to run in-game GTAIV scripts written in any .Net language. The goal of this project is to provide a .Net-typical and easy to use class structure that wraps all scripting functionality of the game. Scripts can be developed directly with Visual Studio, granting you all it's benefits like code highlighting and IntelliSense. WARNING: The code is messy as hell. It was one of my first larger C++ based projects and many very C++ specific things like file structure and includes are a total DISASTER! Potential health risks of trying to understand or restructure the code include, but are not limited to: Loss of sanity, brain damage and irreversible nerdism. Special thanks to Aru for his help and for his C++ Script Hook. This project wouldn't have been possible without it. LicenseThe GTAIV .Net Script Hook sourcecode is published unter the MIT license. The complete license text is included as LICENSE.txt in the archive. When you release sourcecode from this project make sure that you keep the full, unaltered license text at the beginning of the files. When you changed parts of the released sourcecode make sure to include a notice right below the license text in the modified files that states that you altered the sourcecode, to make clear that i am not the sole author of all of the file's contents anymore. You are free to distribute compiled derivative works of this in binary form in any way you see fit and without limitations. It would be nice, though, to give credit to Hazard (hazard_x@gmx.net / twitter.com/HazardX) as author of the original GTAIV .Net Script Hook. See the included LICENSE-ScriptHook.txt for the license of the GTAIV C++ Script Hook, and LICENSE-SlimDX.txt for the license of the SlimDX sourcecode. Requirements and usageRequired to compile the sourcecode are: - Microsoft Visual Studio 2010 (newer versions will probably work too) - Microsoft DirectX SDK March 2008 - Microsoft Windows SDK (maybe? am not entirely sure...) IMPORTANT: After installing the DirectX SDK March 2008 you'll have to set up a system variable in windows named "DXSDK_2008-03" containing the full path to the installation folder of the SDK. This is to allow multiple versions of the SDK to be installed. Make sure to include a final backslash ( \ ) at the end of the path. See the included ScriptHookDotNet.readme.txt on how to actually run the Script Hook with the game. ChangelogRelease 1.0: - First public release of the sourcecode Infos for WebmastersFeel free to add this archive as a download to your site as long as you give proper credit. However, as long as it is technically possible, please DON'T upload it to other webservers. Best way would be to link to this thread or at least direct-link my download from your page to assure that people always get the latest version! This post has been edited by HazardX on Tuesday, Oct 2 2012, 22:02
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
MulleDK19  |
|
1337 Programmer

Group: Members
Joined: May 30, 2009


|
| QUOTE (HazardX @ Tuesday, Oct 2 2012, 22:17) | And sorry for basically vanishing from the GTA IV modding community. I moved on to other things and never really had the time to get back to it. I certainly could have released the source earlier, but just never thought about it after stopping to mod GTA IV myself. I did not release the source during the time when GTA IV was popular to prevent lots of different and incompatible derivates from popping up and turning mod management and installation into a total mess. But this shouldn't really be much of an issue anymore.
Now LMS contacted me and told me that MulleDK19 still has interest to work with the code and so i thought it would be best to just release it for everyone. I hope you guys can still use it to do awesome stuff. If you happen to find your way through this undocumented code-disaster, that is. |
Thanks! Highly appreciated. Already renamed everything public to use a proper .NET naming convention, and made it possible to instantiate Peds and Vehicles, etc. using the new keyword rather than having to go through World.CreatePed. The constructor of those classes are caching themselves. PS: I'm using Visual Studio 2012 on Windows 8, and it works flawlessly. However, the Windows SDK system variable you're using was non-existent on my system, so I had to change that to WindowsSDK_IncludePath. This post has been edited by MulleDK19 on Wednesday, Oct 3 2012, 00:00
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
MulleDK19  |
Posted: Thursday, Oct 4 2012, 21:26
|
1337 Programmer

Group: Members
Joined: May 30, 2009


|
My changes / fixes so far: | QUOTE (Changelog) | - Renamed class members to proper .NET naming conventions. (All scripts prior to this version, calling these members will no longer work. Scripts should be updated to work with this version). - Peds and Vehicles, etc. can now be created using the new keyword, rather than World.CreatePed and World.CreateVehicle. - Vehicle.MemoryAddress is now public. - Added Ped.Speed. - Added GetSpeed() and SetSpeed() methods to the Ped and Vehicle classes, which will get or set the speed of the object in either m/s, kmh or mph. - Added a lot of XML comments. - Renamed many parameters, both to proper naming, and to reflect their actual purpose. - Renamed reverse engineered animation flags. - Corrected some spelling errors. - Added console command SetWindowBorder which hides or shows the border when playing in window mode. (Essentially full screen with instant alt+tab). - Improved support for dependencies. Any dependency placed in the scripts\dependencies folder will no longer be locked when they're loaded. - Added Game.ShowSubtitle(). - Added Player.IsPissedOff. - Fixed phone checks not working on Windows Vista/7/8. (EFLC) - Added Ped.Revive(). - Added Game.PrintHelp(). This will print a message in those familiar, colored rectangles in the top left corner of the window, with any text you specify, like when you first respawn at a hospital, etc. - Renamed Ped.Die() to Ped.Kill(). - Added Ped.GetCurrentTaskType() - Added Ped.WaitForCurrentTaskToComplete(). - Ped.Task.* now returns a Task class that allows checking for the status of a task. (Some tasks does not yet support this, and the returned instance's Type property will return TaskType.Unknown). - Added getter for Ped.MaxHealth. - Changed the text color in the console to blue. - Added Graphics.MeasureText(). - The close button on forms now use a texture instead of a text. - Forms can now have an icon. - Added console command Wash, to wash the player's current vehicle. - Added console command TeleportToLand, to teleport the player to the closest street. - Added World.GetAreaName(). - Setting World.CurrentDayTime no longer changes the weather. - Added console command SetWantedLevel. - Rewrote SetDaytime to take 2 parameters. HH an MM. MM being optional. Eg. "SetDaytime 12 30" or "SetDaytime 12". - Added time stamp to log entries in the console. - Renamed Vehicle.Door to Vehicle.GetDoor(). - Added new class for windows and method Vehicle.GetWindow() to get them. - Added VehicleWindow.IsIntact (get). - Added VehicleWindow.Smash(). - Added VehicleWindow.Remove(). - Added Vehicle.MaintainEngineRPM (get/set). - Added new class for wheels and method Vehicle.GetWheel() to get them. - Removed IsTireBurst(), BurstTire() and FixTire() from Vehicle class. - Added VehicleWheel.IsTireBurst (get/set) - Added VehicleWheel.BurstTire() - Added VehicleWheel.RepairTire(). - Added VehicleWheel.Position (get). - Added VehicleWheel.Health (get/set). - Added VehicleWheel.Air (get/set). - Added VehicleWheel.RotationSpeed (get). - Added VehicleWheel.Angle (get). - Added VehicleWheel.IsOnFire (get/set). - Added VehicleWheel.IsTireFlat (get/set). - Added VehicleWheel.IsAccelerating (get). - Added VehicleWheel.IsLeftSideWheel (get/set). - Added VehicleWheel.SteeringMode (get/set). - Added VehicleWheel.PunctureTire(). - Added Vehicle.IsInAir. - Added Vehicle.IsInWater. - Added static Vehicle.GetSeatFromDoor(). - Added static Vehicle.GetDoorFromSeat(). - Added Vehicle.GetFirstSeatWithOpenDoor(). - Added Vehicle.GetSeatsWithOpenDoor(). - Scripts' default constructor can now have the internal access modifier, and SHDN will still find it. - Removed Script.Player. (Use Game.LocalPlayer instead). - Removed Script.Exists. (Use Game.Exists instead). - Added Game.Console.PrintDebug(). Calls to this method will only get compiled if the calling assembly is compiled in Debug mode. - Game.Exists now takes a base.IBaseObject instead of a base.Object. - Unhid GTA.Native.Function.GetAddress(). - Renamed namespace GTA.base to GTA.Base to remove the clash with the C# keyword. - Renamed GTA.Base.Object to GTA.Base.Entity. - Added GTA.PathNode. - Added GTA.PathNode.GetClosestCarPathNode(). - Added GTA.PathNode.GetClosestMajorCarPathNode(). - GTA.Object.MemoryAddress is now public. - GTA.Ped.MemoryAddress is now public. - Added Vehicle.SetIndicatorLights() to set indicator lights individually (And whether they should blink or be lit constantly). - Added Vehicle.SetSirenLights() to specify which of the seven siren lights should be on when the siren is active. - Added Vehicle.SetSiren() to turn the siren on/off, with or without the siren sound. - Added GTA.Forms.ScriptForm, which will generate a GTA.Forms.Form using a System.Windows.Forms.Form as a template. - Renamed GTA.Forms.Imagebox to GTA.Forms.PictureBox. - Added GTA.Forms.MessageBox. - Script.Bind* and Script.Unbind* are now public. - Added LockedButCanBreakIn to DoorLock. - Added GTA.ParticleSystem.
January 9, 2013 - Added implicit operator in GTA.Native.Parameter for Enum. - Added overload of Player.GetTargetedPed(), with parameter includeLocks, to include locked on characters (Eg. when using knife). - Added Blip.Flash. - Added Game.RadarEnabled. - Added implicit operator for AnimationSet to GTA.Native.Function. - Added Game.AllowGarbageTrucks to enable or disable spawning of garbage trucks. - Fixed invalid peds sometimes being returned by some methods, and Game.Exists still returning true. - Vehicle.GetPedOnSeat() now throws NonExistingSeatException if the specified seat does not exist for the specified vehicle. - Fixed Game.RadarZoom not working. Now accepting an integer instead of a float, as expected by the game.
April 4, 2013 - Added World.SetStarJunctionSouthText(). Sets the Star Junction south text. - Added World.SetBoothTunnelText(). Sets the text in the Booth Tunnel. - Added World.SetStarJunctionSplitSidesText(). Sets the Split Sides text in Star Junction. - Added World.SetStarJunctionNorthStockQuotesText(). Sets the Star Junction north stock quotes text. - Added World.SetStarJunctionNorthText(). Sets the Star Junction north text. - Added World.AllowClipCapture. (EFLC)
April 5, 2013 - Added new console command system. - Ped.Delete() will now throw an exception when called on a player Ped. - Added Ped.IsPlayer.
April 7, 2013 - Added Blip.GetAllBlips(). - Fixed Blip.GetAllBlipsOfType() returning blips with icons matching the id of the specified blip type, instead of blips of the specified type. - Renamed Blip.GetAllBlipsOfType() to Blip.GetBlipsByType(). - Added Blip.GetBlipsByIcon(). - Added Blip.GetBlipsByName(). - Added Vehicle.HasSeat(). - Added Vehicle.IsEmpty. - Added Vehicle.IsFull. - Added Vehicle.Populate(). - Added constructors on Blip for the following target types: Vector3, Vehicle, Ped, Object and Pickup. - Fixed Blip.Name always returning invalid value. - Fixed Blip.Icon setting the name of the Blip.
April 8, 2013 - Added getter for Ped.Voice. - Added Ped.DefaultVoice.
April 11, 2013 - Game.PlayPhoneKeypadTone is now obsolete (Use MobilePhone.PlayPhoneKeypadTone instead). - Added static class MobilePhone. - Added MobilePhone.PlayPhoneKeypadTone(). - Added MobilePhone.IsActive. - Added MobilePhone.IsCalling. - Added MobilePhone.IsMobileRadioEnabled. - Added MobilePhone.BindPhoneNumber(). - Added MobilePhone.UnbindPhoneNumber(). - Added MobilePhone.CurrentPhoneNumber. - Added MobilePhone.LastCallerName. - Added MobilePhone.LastReceiverName. - Added MobilePhone.Position. - Added MobilePhone.Rotation. - Added MobilePhone.Scale. - Fixed Blip.SetColorRGB setting seemingly random colors. - Added class Corona (Works like Checkpoint class).
April 12, 2013 - Added Object.WakePhysics().
April 13, 2013 - Added VehicleWheel.IsDriveWheel (get/set). - Added VehicleWheel.HasWideTire (get/set). - Added VehicleWheel.SkidMarkWidth (get/set). - Added Vehicle.IsAffectedByGravity (get/set). | New console command systemImplemented my console command system into SHDN, that I created for my police mod. It's now a lot less tedious to create console commands. No need to check the parameter count and convert the parameters. Now you simply create a method with the parameters you need, and mark it with an attribute, and you're done. Eg. | CODE | [ConsoleCommand(Description = "Spawns the specified number of vehicles of the specified model in front of the player.")] private void Command_SpawnMulti(string modelName, int count, int spacing = 15) { Vector3 spawnPos = Game.LocalPlayer.Character.GetOffsetPosition(Vector3.RelativeFront * spacing); for (int i = 0; i < count; i++) { Vehicle vehicle = new Vehicle(modelName, spawnPos); if (Game.Exists(vehicle)) { vehicle.Heading = Game.LocalPlayer.Character.Heading; spawnPos += Game.LocalPlayer.Character.Direction * spacing; } } } |
Then if you type the following in the console: | QUOTE | | spawnmulti perennial 3 |
SHDN will automaticly verify that the right amount of parameters are specified, and convert them to the parameter types on the command method. This post has been edited by MulleDK19 on Saturday, Apr 13 2013, 04:44
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
HazardX  |
Posted: Wednesday, Oct 10 2012, 19:52
|
pedestrian mangler

Group: Members
Joined: Dec 13, 2008


|
| QUOTE (MulleDK19 @ Thursday, Oct 4 2012, 22:26) | | My changes / fixes so far: ... |
Awesome! That's a lot of stuff you managed to do already. I'm glad you are finding your way through the code. | QUOTE (thaCURSEDpie @ Saturday, Oct 6 2012, 18:28) | | Your .Net scripthook got me into modding GTA, introduced me to programming and in effect helped me learn a ton of stuff. Thank you. |
You're welcome! Programming is an amazing skill to have and it's great to hear that the ScriptHook motivated people to get into it. This post has been edited by HazardX on Wednesday, Oct 10 2012, 20:06
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
stef538  |
|
Player Hater

Group: Members
Joined: Oct 6, 2012

|
Helllooooooo, I'm making a new mod, called "Back to the Future - Liberty City" Which can be found here : Back to the future - Liberty CityBut I´m stuck, at making sparks etc. and i really want to do that! but i don´t know how. Further the mod works perfect, that's the only thing i'm stuck at, Does anyone how to do that in C# ? Also i want is that, if the car is 80 mph texture "normal" is going to change in texture "Blue" It could be done in C#? Greets Stef538
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Cameryn  |
Posted: Saturday, Oct 27 2012, 01:12
|
Player Hater

Group: Members
Joined: Oct 14, 2012


|
| QUOTE (MulleDK19 @ Thursday, Oct 4 2012, 21:26) | My changes / fixes so far:
| QUOTE (Changelog) | - Renamed class members to proper .NET naming conventions. (All scripts prior to this version, calling these members will no longer work. Scripts should be updated to work with this version). - Peds and Vehicles, etc. can now be created using the new keyword, rather than World.CreatePed and World.CreateVehicle. - Vehicle.MemoryAddress is now public. - Added Ped.Speed. - Added GetSpeed() and SetSpeed() methods to the Ped and Vehicle classes, which will get or set the speed of the object in either m/s, kmh or mph. - Added a lot of XML comments. - Renamed many parameters, both to proper naming, and to reflect their actual purpose. - Renamed reverse engineered animation flags. - Corrected some spelling errors. - Added console command SetWindowBorder which hides or shows the border when playing in window mode. (Essentially full screen with instant alt+tab). - Improved support for dependencies. Any dependency placed in the scripts\dependencies folder will no longer be locked when they're loaded. - Added Game.ShowSubtitle(). - Added Player.IsPissedOff. - Fixed phone checks not working on Windows Vista/7/8. - Added Ped.Revive(). - Added Game.PrintHelp(). This will print a message in those familiar, colored rectangles in the top left corner of the window, with any text you specify, like when you first respawn at a hospital, etc. - Renamed Ped.Die() to Ped.Kill(). - Added Ped.GetCurrentTaskType() - Added Ped.WaitForCurrentTaskToComplete(). - Ped.Task.* now returns a Task class that allows checking for the status of a task. (Some tasks does not yet support this, and the returned instance's Type property will return TaskType.Unknown). - Added getter for Ped.MaxHealth. - Changed the text color in the console to blue. - Added Graphics.MeasureText(). - The close button on forms now use a texture instead of a text. - Forms can now have an icon. - Added console command Wash, to wash the player's current vehicle. - Added console command TeleportToLand, to teleport the player to the closest street. - Added World.GetAreaName(). - Setting World.CurrentDayTime no longer changes the weather. - Added console command SetWantedLevel. - Rewrote SetDaytime to take 2 parameters. HH an MM. MM being optional. Eg. "SetDaytime 12 30" or "SetDaytime 12". - Added time stamp to log entries in the console. - Renamed Vehicle.Door to Vehicle.GetDoor(). - Added new class for windows and method Vehicle.GetWindow() to get them. - Added VehicleWindow.IsIntact (get). - Added VehicleWindow.Smash(). - Added VehicleWindow.Remove(). - Added Vehicle.IsCruiseControlEnabled (get/set). - Added new class for wheels and method Vehicle.GetWheel() to get them. - Removed IsTireBurst(), BurstTire() and FixTire() from Vehicle class. - Added VehicleWheel.IsTireBurst (get/set) - Added VehicleWheel.BurstTire() - Added VehicleWheel.RepairTire(). - Added VehicleWheel.Position (get). - Added VehicleWheel.Health (get/set). - Added VehicleWheel.Air (get/set). - Added VehicleWheel.RotationSpeed (get). - Added VehicleWheel.Angle (get). - Added VehicleWheel.IsOnFire (get/set). - Added VehicleWheel.IsTireFlat (get/set). - Added VehicleWheel.IsAccelerating (get). - Added VehicleWheel.IsLeftSideWheel (get/set). - Added VehicleWheel.IsSteeringWheel (get/set). - Added VehicleWheel.AttemptToMaintainSpeed (get/set). - Added VehicleWheel.PunctureTire(). - Added Vehicle.IsInAir. - Added Vehicle.IsInWater. - Added static Vehicle.GetSeatFromDoor(). - Added static Vehicle.GetDoorFromSeat(). - Added Vehicle.GetFirstSeatWithOpenDoor(). - Added Vehicle.GetSeatsWithOpenDoor(). - Scripts' default constructor can now have the internal access modifier, and SHDN will still find it. - Removed Script.Player. (Use Game.LocalPlayer instead). - Removed Script.Exists. (Use Game.Exists instead). - Added Game.Console.PrintDebug(). Calls to this method will only get compiled if the calling assembly is compiled in Debug mode. - Game.Exists now takes a base.IBaseObject instead of a base.Object. - Unhid GTA.Native.Function.GetAddress(). - Renamed namespace GTA.base to GTA.Base to remove the clash with the C# keyword. - Renamed GTA.Base.Object to GTA.Base.Entity. - Added GTA.PathNode. - Added GTA.PathNode.GetClosestCarPathNode(). - Added GTA.PathNode.GetClosestMajorCarPathNode(). - GTA.Object.MemoryAddress is now public. - GTA.Ped.MemoryAddress is now public. - Added Vehicle.SetIndicatorLights() to set indicator lights individually (And whether they should blink or be lit constantly). - Added Vehicle.SetSirenLights() to specify which of the seven siren lights should be on when the siren is active. - Added Vehicle.SetSiren() to turn the siren on/off, with or without the siren sound. - Added GTA.Forms.ScriptForm, which will generate a GTA.Forms.Form using a System.Windows.Forms.Form as a template. - Renamed GTA.Forms.Imagebox to GTA.Forms.PictureBox. - Added GTA.Forms.MessageBox. - Script.Bind* and Script.Unbind* are now public. - Added LockedButCanBreakIn to DoorLock. - Added GTA.ParticleSystem. | | Will you release it?
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
1 User(s) are reading this topic (1 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.
| |
 |
|
 |
|
|
|
|