-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
401 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,284 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
using System.Drawing; | ||
using GTA; | ||
using GTA.Native; | ||
using GTA.Math; | ||
using NativeUI; | ||
|
||
namespace GTAMod | ||
{ | ||
class Class1 : Script | ||
{ | ||
|
||
MenuPool modMenuPool; | ||
UIMenu mainMenu; | ||
|
||
UIMenu playerMenu; | ||
UIMenu weaponsMenu; | ||
UIMenu vehicleMenu; | ||
UIMenu creditsMenu; | ||
|
||
UIMenuItem resetWantedLevel; | ||
UIMenuItem CreditsShow; | ||
|
||
public Class1() | ||
{ | ||
Setup(); | ||
|
||
Tick += onTick; | ||
KeyDown += onKeyDown; | ||
} | ||
|
||
void Setup() | ||
{ | ||
modMenuPool = new MenuPool(); | ||
mainMenu = new UIMenu("Mod Menu", "Select an option"); | ||
modMenuPool.Add(mainMenu); | ||
|
||
playerMenu = modMenuPool.AddSubMenu(mainMenu, "Player"); | ||
weaponsMenu = modMenuPool.AddSubMenu(mainMenu, "Weapons"); | ||
vehicleMenu = modMenuPool.AddSubMenu(mainMenu, "Vehicles"); | ||
|
||
SetupPlayerFunctions(); | ||
SetupWeaponsFunctions(); | ||
SetupVehicleFunctions(); | ||
} | ||
void SetupVehicleFunctions() | ||
{ | ||
VehicleSelectorMenu(); | ||
VehicleSpawnByName(); | ||
} | ||
|
||
void SetupPlayerFunctions() | ||
{ | ||
ResetWantedLevel(); | ||
GodMode(); | ||
} | ||
|
||
void SetupWeaponsFunctions() | ||
{ | ||
weaponSelectorMenu(); | ||
GetAllWeapons(); | ||
RemoveAllWeapons(); | ||
} | ||
|
||
void VehicleSpawnByName() | ||
{ | ||
UIMenuItem vehicleSpawnItem = new UIMenuItem("Spawn vehicle by name"); | ||
vehicleMenu.AddItem(vehicleSpawnItem); | ||
|
||
Ped gamePed = Game.Player.Character; | ||
|
||
vehicleMenu.OnItemSelect += (sender, item, index) => | ||
{ | ||
if (item == vehicleSpawnItem) | ||
{ | ||
string modelName = Game.GetUserInput(50); | ||
Model model = new Model(modelName); | ||
model.Request(); | ||
|
||
if (model.IsInCdImage && model.IsValid) | ||
{ | ||
Vehicle v = World.CreateVehicle(model, gamePed.Position, gamePed.Heading); | ||
v.PlaceOnGround(); | ||
gamePed.Task.WarpIntoVehicle(v, VehicleSeat.Driver); | ||
} | ||
} | ||
}; | ||
} | ||
|
||
void GetAllWeapons() | ||
{ | ||
UIMenuItem allWeapons = new UIMenuItem("Get all weapons"); | ||
weaponsMenu.AddItem(allWeapons); | ||
|
||
weaponsMenu.OnItemSelect += (sender, item, index) => { | ||
if (item == allWeapons) | ||
{ | ||
WeaponHash[] allWeaponHashes = (WeaponHash[])Enum.GetValues(typeof(WeaponHash)); | ||
for (int i = 0; i < allWeaponHashes.Length; i++) | ||
{ | ||
Game.Player.Character.Weapons.Give(allWeaponHashes[i], 9999, true, true); | ||
} | ||
} | ||
}; | ||
} | ||
|
||
|
||
bool godModeOn = false; | ||
void GodMode() | ||
{ | ||
UIMenuItem godMode = new UIMenuItem("God Mode: " + godModeOn.ToString()); | ||
|
||
playerMenu.AddItem(godMode); | ||
|
||
playerMenu.OnItemSelect += (sender, item, index) => | ||
{ | ||
if (item == godMode) | ||
{ | ||
godModeOn = !godModeOn; | ||
|
||
if (godModeOn) | ||
{ | ||
Game.Player.IsInvincible = true; | ||
Game.Player.Character.IsInvincible = true; | ||
|
||
godMode.Text = "God Mode: " + true.ToString(); | ||
} | ||
else | ||
{ | ||
Game.Player.IsInvincible = false; | ||
Game.Player.Character.IsInvincible = false; | ||
|
||
godMode.Text = "God Mode " + false.ToString(); | ||
} | ||
} | ||
}; | ||
} | ||
|
||
bool neverWantedLevelOn = false; | ||
void NeverWantedLevel() | ||
{ | ||
UIMenuItem neverWanted = new UIMenuItem("Never Wanted Level " + neverWantedLevelOn.ToString()); | ||
|
||
playerMenu.AddItem(neverWanted); | ||
playerMenu.OnItemSelect += (sender, item, index) => | ||
{ | ||
if (item == neverWanted) | ||
{ | ||
neverWantedLevelOn = !neverWantedLevelOn; | ||
|
||
if (neverWantedLevelOn) | ||
neverWanted.Text = "Never Wanted Level: " + true.ToString(); | ||
else | ||
neverWanted.Text = "Never Wanted Level " + false.ToString(); | ||
} | ||
}; | ||
} | ||
|
||
void RemoveAllWeapons() | ||
{ | ||
UIMenuItem removeButton = new UIMenuItem("Remove All Weapons"); | ||
|
||
WeaponHash[] allWeaponHashes = (WeaponHash[])Enum.GetValues(typeof(WeaponHash)); | ||
weaponsMenu.AddItem(removeButton); | ||
weaponsMenu.OnItemSelect += (sender, item, index) => | ||
{ | ||
if (item == removeButton) | ||
{ | ||
foreach (WeaponHash hash in allWeaponHashes) | ||
{ | ||
if (Game.Player.Character.Weapons.HasWeapon(hash)) | ||
Game.Player.Character.Weapons.Remove(hash); | ||
} | ||
} | ||
}; | ||
} | ||
|
||
void ResetWantedLevel() | ||
{ | ||
resetWantedLevel = new UIMenuItem("Reset Wanted Level"); | ||
playerMenu.AddItem(resetWantedLevel); | ||
|
||
playerMenu.OnItemSelect += (sender, item, index) => | ||
{ | ||
if (item == resetWantedLevel) | ||
{ | ||
if (Game.Player.WantedLevel == 0) | ||
{ | ||
UI.ShowSubtitle("Get a wanted level first!"); | ||
} | ||
else | ||
{ | ||
Game.Player.WantedLevel = 0; | ||
} | ||
} | ||
}; | ||
} | ||
|
||
void weaponSelectorMenu() | ||
{ | ||
UIMenu submenu = modMenuPool.AddSubMenu(mainMenu, "Weapon Selector Menu"); | ||
|
||
List<dynamic> listOfWeapons = new List<dynamic>(); | ||
WeaponHash[] allWeaponHashes = (WeaponHash[])Enum.GetValues(typeof(WeaponHash)); | ||
for (int i = 0; i < allWeaponHashes.Length; i++) | ||
{ | ||
listOfWeapons.Add(allWeaponHashes[i]); | ||
} | ||
|
||
UIMenuListItem list = new UIMenuListItem("Weapons: ", listOfWeapons, 0); | ||
submenu.AddItem(list); | ||
|
||
UIMenuItem getWeapon = new UIMenuItem("Get weapon: "); | ||
submenu.AddItem(getWeapon); | ||
|
||
submenu.OnItemSelect += (sender, item, index) => | ||
{ | ||
if (item == getWeapon) | ||
{ | ||
int listIndex = list.Index; | ||
WeaponHash currentHash = allWeaponHashes[listIndex]; | ||
Game.Player.Character.Weapons.Give(currentHash, 9999, true, true); | ||
} | ||
}; | ||
} | ||
|
||
void VehicleSelectorMenu() | ||
{ | ||
UIMenu subMenu = modMenuPool.AddSubMenu(weaponsMenu, "Vehicle Selector"); | ||
|
||
List<dynamic> listOfVehicles = new List<dynamic>(); | ||
VehicleHash[] allVehicleHashes = (VehicleHash[])Enum.GetValues(typeof(VehicleHash)); | ||
for (int i = 0; i < allVehicleHashes.Length; i++) | ||
{ | ||
listOfVehicles.Add(allVehicleHashes[i]); | ||
} | ||
|
||
UIMenuListItem list = new UIMenuListItem("Vehicle: ", listOfVehicles, 0); | ||
subMenu.AddItem(list); | ||
|
||
UIMenuItem getVehicle = new UIMenuItem("Get Vehicle"); | ||
subMenu.AddItem(getVehicle); | ||
|
||
subMenu.OnItemSelect += (sender, item, index) => | ||
{ | ||
if (item == getVehicle) | ||
{ | ||
int listIndex = list.Index; | ||
VehicleHash hash = allVehicleHashes[listIndex]; | ||
|
||
Ped gamePed = Game.Player.Character; | ||
|
||
Vehicle v = World.CreateVehicle(hash, gamePed.Position, gamePed.Heading); | ||
v.PlaceOnGround(); | ||
gamePed.Task.WarpIntoVehicle(v, VehicleSeat.Driver); | ||
} | ||
}; | ||
} | ||
|
||
void onTick(object sender, EventArgs e) | ||
{ | ||
if (modMenuPool != null) | ||
modMenuPool.ProcessMenus(); | ||
|
||
if(neverWantedLevelOn) | ||
{ | ||
Game.Player.WantedLevel = 0; | ||
} | ||
} | ||
|
||
void onKeyDown(object sender, KeyEventArgs e) | ||
{ | ||
if (e.KeyCode == Keys.F10 && !modMenuPool.IsAnyMenuOpen()) | ||
{ | ||
mainMenu.Visible = !mainMenu.Visible; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{074C866B-3DB4-4C5E-BD30-B6EB50B9A92D}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>GTAMod</RootNamespace> | ||
<AssemblyName>GTAMod</AssemblyName> | ||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="NativeUI"> | ||
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\scripts\NativeUI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="ScriptHookVDotNet2"> | ||
<HintPath>..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\ScriptHookVDotNet2.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Drawing" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Class1.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.28803.202 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GTAMod", "GTAMod.csproj", "{074C866B-3DB4-4C5E-BD30-B6EB50B9A92D}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{074C866B-3DB4-4C5E-BD30-B6EB50B9A92D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{074C866B-3DB4-4C5E-BD30-B6EB50B9A92D}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{074C866B-3DB4-4C5E-BD30-B6EB50B9A92D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{074C866B-3DB4-4C5E-BD30-B6EB50B9A92D}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {078DEB43-2CD9-4D85-A0AD-F109B8EFAD8F} | ||
EndGlobalSection | ||
EndGlobal |
Oops, something went wrong.