-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 parent
1584a33
commit b53caac
Showing
44 changed files
with
5,816 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,88 @@ | ||
using IVSDKDotNet; | ||
using System; | ||
using static IVSDKDotNet.Native.Natives; | ||
using System.Collections.Generic; | ||
|
||
// Credits: catsmackaroo & ItsClonkAndre | ||
|
||
namespace LibertyTweaks | ||
{ | ||
internal class ArmoredCops | ||
{ | ||
private static bool enable; | ||
private static List<int> copsHadArmor = new List<int>(); | ||
public static void Init(SettingsFile settings) | ||
{ | ||
enable = settings.GetBoolean("Improved Police", "Enabled", true); | ||
} | ||
|
||
public static void Tick(int armoredCopsStars) | ||
{ | ||
if (!enable) | ||
return; | ||
|
||
// Grab all peds | ||
IVPool pedPool = IVPools.GetPedPool(); | ||
for (int i = 0; i < pedPool.Count; i++) | ||
{ | ||
UIntPtr ptr = pedPool.Get(i); | ||
|
||
if (ptr != UIntPtr.Zero) | ||
{ | ||
// Ignore player ped | ||
if (ptr == IVPlayerInfo.FindThePlayerPed()) | ||
continue; | ||
|
||
// Grab player ID | ||
uint playerId = GET_PLAYER_ID(); | ||
|
||
// Get ped handles | ||
int pedHandle = (int)pedPool.GetIndex(ptr); | ||
|
||
// Get the model of the ped | ||
GET_CHAR_MODEL(pedHandle, out uint pedModel); | ||
|
||
// Get the models of basic policia | ||
GET_CURRENT_BASIC_COP_MODEL(out uint copModel); | ||
|
||
// Check player's wanted level | ||
STORE_WANTED_LEVEL((int)playerId, out uint currentWantedLevel); | ||
|
||
// Check if the grabbed ped has already been given armor | ||
if (copsHadArmor.Contains(pedHandle)) | ||
continue; | ||
|
||
// Check if it's a cop | ||
if (pedModel != copModel) | ||
continue; | ||
|
||
// Check if ped is dead | ||
if (IS_CHAR_DEAD(pedHandle)) | ||
continue; | ||
|
||
// Check if ped is not for a mission | ||
if (IS_PED_A_MISSION_PED(pedHandle)) | ||
continue; | ||
|
||
// If player has more than 4 or more stars | ||
if (currentWantedLevel < armoredCopsStars) | ||
continue; | ||
|
||
// Finally adds armor to the policia | ||
ADD_ARMOUR_TO_CHAR(pedHandle, 100); | ||
copsHadArmor.Add(pedHandle); | ||
} | ||
} | ||
|
||
// Loop through the list of peds that already got armor and check if we can delete them from the list | ||
for (int i = 0; i < copsHadArmor.Count; i++) | ||
{ | ||
int pedHandle = copsHadArmor[i]; | ||
|
||
// Check if ped still exists | ||
if (!DOES_CHAR_EXIST(pedHandle)) | ||
copsHadArmor.RemoveAt(i); // Remove ped from list because they dont exists anymore | ||
} | ||
} | ||
} | ||
} |
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,40 @@ | ||
using CCL.GTAIV; | ||
using IVSDKDotNet; | ||
using System; | ||
using static IVSDKDotNet.Native.Natives; | ||
|
||
// Credit: catsmackaroo | ||
|
||
namespace LibertyTweaks | ||
{ | ||
internal class CarFireBreakdown | ||
{ | ||
private static bool enable; | ||
|
||
public static void Init(SettingsFile settings) | ||
{ | ||
enable = settings.GetBoolean("Vehicles Break on Fire", "Enable", true); | ||
} | ||
|
||
public static void Tick() | ||
{ | ||
if (!enable) | ||
return; | ||
|
||
IVPed playerPed = IVPed.FromUIntPtr(IVPlayerInfo.FindThePlayerPed()); | ||
|
||
if (IS_CHAR_IN_ANY_CAR(playerPed.GetHandle())) | ||
{ | ||
|
||
GET_CAR_CHAR_IS_USING(playerPed.GetHandle(), out int pVeh); | ||
|
||
if (IS_CAR_ON_FIRE(pVeh)) | ||
{ | ||
SET_CAR_ENGINE_ON(pVeh, false, false); | ||
} | ||
} | ||
|
||
} | ||
} | ||
} | ||
|
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,40 @@ | ||
using System; | ||
|
||
using IVSDKDotNet; | ||
using static IVSDKDotNet.Native.Natives; | ||
|
||
// Credits: catsmackaroo | ||
|
||
namespace LibertyTweaks | ||
{ | ||
internal class HigherPedAccuracy | ||
{ | ||
private static bool enableFix; | ||
|
||
public static void Init(SettingsFile settings) | ||
{ | ||
enableFix = settings.GetBoolean("Improved AI", "Enable", true); | ||
} | ||
|
||
public static void Tick(int pedAccuracy, int pedFirerate) | ||
{ | ||
if (!enableFix) | ||
return; | ||
|
||
|
||
// Grab all peds | ||
IVPool pedPool = IVPools.GetPedPool(); | ||
for (int i = 0; i < pedPool.Count; i++) | ||
{ | ||
UIntPtr ptr = pedPool.Get(i); | ||
if (ptr != UIntPtr.Zero) | ||
{ | ||
int pedHandle = (int)pedPool.GetIndex(ptr); | ||
|
||
SET_CHAR_ACCURACY(pedHandle, (uint)pedAccuracy); | ||
SET_CHAR_SHOOT_RATE(pedHandle, pedFirerate); | ||
} | ||
} | ||
} | ||
} | ||
} |
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,44 @@ | ||
using CCL.GTAIV; | ||
using IVSDKDotNet; | ||
using static IVSDKDotNet.Native.Natives; | ||
|
||
// Credits: catsmackaroo | ||
|
||
namespace LibertyTweaks | ||
{ | ||
internal class HolsterWeapons | ||
{ | ||
private static int playerId; | ||
private static uint currentWeapon; | ||
private static uint lastWeapon; | ||
private static bool enableFix; | ||
|
||
public static void Init(SettingsFile Settings) | ||
{ | ||
enableFix = Settings.GetBoolean("Weapon Holstering", "Enable", true); | ||
} | ||
|
||
public static void Process() | ||
{ | ||
if (!enableFix) | ||
return; | ||
|
||
IVPed playerPed = IVPed.FromUIntPtr(IVPlayerInfo.FindThePlayerPed()); | ||
playerId = IVPedExtensions.GetHandle(playerPed); | ||
GET_CURRENT_CHAR_WEAPON(playerId, out currentWeapon); | ||
|
||
if (!IS_CHAR_IN_ANY_CAR(playerId)) | ||
{ | ||
if (currentWeapon != 0) | ||
{ | ||
GET_CURRENT_CHAR_WEAPON(playerId, out lastWeapon); | ||
GIVE_DELAYED_WEAPON_TO_CHAR(playerId, 0, 1, true); | ||
} | ||
else | ||
{ | ||
GIVE_DELAYED_WEAPON_TO_CHAR(playerId, (int)lastWeapon, 1, true); | ||
} | ||
} | ||
} | ||
} | ||
} |
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,45 @@ | ||
using CCL.GTAIV; | ||
|
||
using IVSDKDotNet; | ||
using static IVSDKDotNet.Native.Natives; | ||
|
||
// Credits: catsmackaroo | ||
|
||
namespace LibertyTweaks | ||
{ | ||
internal class MoveWithSniper | ||
{ | ||
private static int playerId; | ||
private static uint currentWeapon; | ||
private static bool enableFix; | ||
|
||
public static void Init(SettingsFile settings) | ||
{ | ||
enableFix = settings.GetBoolean("Move With Sniper", "Enable", true); | ||
} | ||
|
||
public static void Tick() | ||
{ | ||
if (!enableFix) | ||
return; | ||
|
||
IVPed playerPed = IVPed.FromUIntPtr(IVPlayerInfo.FindThePlayerPed()); | ||
playerId = IVPedExtensions.GetHandle(playerPed); | ||
GET_CURRENT_CHAR_WEAPON(playerId, out currentWeapon); | ||
|
||
if (currentWeapon == (int)IVSDKDotNet.Enums.eWeaponType.WEAPON_M40A1 | ||
|| currentWeapon == (int)IVSDKDotNet.Enums.eWeaponType.WEAPON_SNIPERRIFLE | ||
|| currentWeapon == (int)IVSDKDotNet.Enums.eWeaponType.WEAPON_EPISODIC_15) | ||
{ | ||
if (NativeControls.IsGameKeyPressed(0, GameKey.Aim)) | ||
{ | ||
IVWeaponInfo.GetWeaponInfo(currentWeapon).WeaponSlot = 16; | ||
} | ||
else | ||
{ | ||
IVWeaponInfo.GetWeaponInfo(currentWeapon).WeaponSlot = 6; | ||
} | ||
} | ||
} | ||
} | ||
} |
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,52 @@ | ||
using IVSDKDotNet; | ||
using System; | ||
using static IVSDKDotNet.Native.Natives; | ||
using CCL.GTAIV; | ||
|
||
// Credits: catsmackaroo | ||
|
||
namespace LibertyTweaks | ||
{ | ||
internal class RegenerateHP | ||
{ | ||
private static bool enable; | ||
private static DateTime timer = DateTime.MinValue; | ||
|
||
public static void Init(SettingsFile settings) | ||
{ | ||
enable = settings.GetBoolean("Health Regeneration", "Enable", true); | ||
} | ||
|
||
public static void Tick(DateTime timer, int regenHealthMinTimer, int regenHealthMaxTimer, int regenHealthMinHeal, int regenHealthMaxHeal) | ||
{ | ||
if (!enable) | ||
return; | ||
|
||
IVPed playerPed = IVPed.FromUIntPtr(IVPlayerInfo.FindThePlayerPed()); | ||
|
||
if (RegenerateHP.timer == DateTime.MinValue) | ||
RegenerateHP.timer = DateTime.UtcNow; | ||
|
||
GET_CHAR_HEALTH(playerPed.GetHandle(), out uint playerHealth); | ||
|
||
if (playerHealth < 126) | ||
{ | ||
if (IS_CHAR_DEAD(playerPed.GetHandle())) | ||
{ | ||
RegenerateHP.timer = DateTime.MinValue; | ||
return; | ||
} | ||
|
||
if (RegenerateHP.timer != DateTime.MinValue) | ||
{ | ||
if (DateTime.UtcNow > RegenerateHP.timer.AddSeconds(Main.GenerateRandomNumber(regenHealthMinTimer, regenHealthMaxTimer))) | ||
{ | ||
|
||
SET_CHAR_HEALTH(playerPed.GetHandle(), (uint)(playerHealth+Main.GenerateRandomNumber(regenHealthMinHeal, regenHealthMaxHeal))); | ||
RegenerateHP.timer = DateTime.MinValue; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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,29 @@ | ||
using CCL.GTAIV; | ||
|
||
using IVSDKDotNet; | ||
using static IVSDKDotNet.Native.Natives; | ||
|
||
// Credits: ClonkAndre | ||
|
||
namespace LibertyTweaks | ||
{ | ||
internal class RemoveWeapons | ||
{ | ||
private static bool enableFix; | ||
public static void Init(SettingsFile settings) | ||
{ | ||
enableFix = settings.GetBoolean("Remove Weapons On Death", "Enable", true); | ||
} | ||
|
||
public static void Tick() | ||
{ | ||
if (!enableFix) | ||
return; | ||
|
||
IVPed playerPed = IVPed.FromUIntPtr(IVPlayerInfo.FindThePlayerPed()); | ||
|
||
if (IS_CHAR_DEAD(playerPed.GetHandle())) | ||
REMOVE_ALL_CHAR_WEAPONS(playerPed.GetHandle()); | ||
} | ||
} | ||
} |
Oops, something went wrong.