Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasak committed Aug 18, 2024
1 parent c4bdaef commit ca219fb
Show file tree
Hide file tree
Showing 38 changed files with 3,546 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ScriptHookDotNet/ScriptHookDotNet.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<ProjectGuid>{5DD209AC-1B5F-483A-BCA9-150CAD228C5A}</ProjectGuid>
<RootNamespace>ScriptHookDotNet</RootNamespace>
<Keyword>Win32Proj</Keyword>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
Expand Down Expand Up @@ -107,6 +108,7 @@
<GenerateXMLDocumentationFiles>true</GenerateXMLDocumentationFiles>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalOptions>/clr:implicitKeepAlive- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<ProjectReference>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
Expand Down
404 changes: 404 additions & 0 deletions dist/ScriptHookDotNet.readme.txt

Large diffs are not rendered by default.

Binary file added dist/aCompleteEditionHook.asi
Binary file not shown.
8 changes: 8 additions & 0 deletions dist/scripts/_PUT .NET SCRIPTS HERE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Put scripts for the GTA IV .Net Script Hook into the "scripts" subfolder of your GTAIV installation. It should be the folder containing this file. DO NOT put code into this file here, it won't run.

The following filetypes are supported:

*.vb - for plain VisualBasic.Net scripts
*.cs - for plain C# scripts
*.net - for compiled scripts in any .Net language
*.net.dll - for compiled scripts in any .Net language
44 changes: 44 additions & 0 deletions dist/scripts/for Developers/PlainScripts/InvincibilityScript.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Windows.Forms;
using GTA;

// ### Press the I key to become invincible against everything (besides falling damage) ###
// ### Niko will still be affected by fire, explosions, etc. but won't die. ###

public class InvincibilityScript : Script {

bool bInvincible = false;
const int HEALTH_VALUE = 500000;

public InvincibilityScript() {
Interval = 250;
BindKey(Keys.I, new KeyPressDelegate(ToggleInvincibility));
this.Tick += new EventHandler(this.InvincibilityScript_Tick);
}

private void InvincibilityScript_Tick(object sender, EventArgs e) {
if (bInvincible) {
Player.Character.Health = HEALTH_VALUE;
Player.Character.Armor = HEALTH_VALUE;
}
}

private void ToggleInvincibility() {
bInvincible = !bInvincible;
Player.Character.ForceHelmet(bInvincible); // Show a helmet to visualize the invincibility
if (bInvincible) {
Player.MaxHealth = HEALTH_VALUE;
Player.MaxArmor = HEALTH_VALUE;
Player.Character.Health = HEALTH_VALUE;
Player.Character.Armor = HEALTH_VALUE;
Game.DisplayText("Invincible!");
} else {
Player.MaxHealth = 100;
Player.MaxArmor = 100;
Player.Character.Health = 100;
Player.Character.Armor = 100;
Game.DisplayText("NOT invincible!");
}
}

}
44 changes: 44 additions & 0 deletions dist/scripts/for Developers/PlainScripts/InvincibilityScript.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Imports System
Imports System.Windows.Forms
Imports GTA

' ### Press the I key to become invincible against everything (besides falling damage) ###
' ### Niko will still be affected by fire, explosions, etc. but won't die. ###

Public Class InvincibilityScript
Inherits Script

Private bInvincible As Boolean = False
Private Const HEALTH_VALUE As Integer = 500000

Public Sub New()
Me.Interval = 250
BindKey(Keys.I, AddressOf ToggleInvincibility)
End Sub

Private Sub InvincibilityScript_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick
If bInvincible Then
Player.Character.Health = HEALTH_VALUE
Player.Character.Armor = HEALTH_VALUE
End If
End Sub

Private Sub ToggleInvincibility()
bInvincible = Not bInvincible
Player.Character.ForceHelmet(bInvincible) ' Show a helmet to visualize the invincibility
If bInvincible Then
Player.MaxHealth = HEALTH_VALUE
Player.MaxArmor = HEALTH_VALUE
Player.Character.Health = HEALTH_VALUE
Player.Character.Armor = HEALTH_VALUE
Game.DisplayText("Invincible!")
Else
Player.MaxHealth = 100
Player.MaxArmor = 100
Player.Character.Health = 100
Player.Character.Armor = 100
Game.DisplayText("NOT invincible!")
End If
End Sub

End Class
15 changes: 15 additions & 0 deletions dist/scripts/for Developers/PlainScripts/PositionScript.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Windows.Forms;
using GTA;

public class PositionScript : Script {

public PositionScript() {
this.KeyDown += new GTA.KeyEventHandler(this.PositionScript_KeyDown);
}

private void PositionScript_KeyDown(object sender, GTA.KeyEventArgs e) {
if (e.Key == Keys.Home) Game.DisplayText(Player.Character.Position.ToString());
}

}
12 changes: 12 additions & 0 deletions dist/scripts/for Developers/PlainScripts/PositionScript.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Imports System
Imports System.Windows.Forms
Imports GTA

Public Class PositionScript
Inherits Script

Private Sub PositionScript_KeyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
If e.Key = Keys.Home Then Game.DisplayText(Player.Character.Position.ToString)
End Sub

End Class
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TestScriptCS")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("TestScriptCS")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cad8122d-51c0-40c1-b0ee-5ba42044a065")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ca219fb

Please sign in to comment.