Compare commits
10 Commits
ff8bc95bc7
...
02c166f4a7
Author | SHA1 | Date | |
---|---|---|---|
02c166f4a7 | |||
0a05a87dd4 | |||
5539829046 | |||
1f1137856a | |||
30f9a0427b | |||
2362fd41d7 | |||
c3f56a3c25 | |||
8f469d1c9e | |||
b9a832f15d | |||
3124345d78 |
60
README.md
60
README.md
@ -1,13 +1,21 @@
|
|||||||
# This modification has been deprecated in favor of [GrinchTrainer](https://github.com/user-grinch/GrinchTrainer-III-VC-SA). Future updates will be available there!
|
# I have forked the cheat menu repo
|
||||||
|
This menu is a work in progress, features may be broken or crash your game. It currently only builds and runs for GTA SA.
|
||||||
|
I will add a release for the menu when I feel like it's ready.
|
||||||
|
|
||||||
|
I have disabled logging support in this menu due to it being broken.
|
||||||
|
|
||||||
|
As I learn more C++ I will be adding more to this menu. Eventually, I would like to make some sort of chaos mod too.
|
||||||
|
I have been getting the hang of the functions in GTA SA using the plugin sdk and this menu.
|
||||||
|
|
||||||
|
I would like to make my own menu and name it KCNet-SAMenu or something like that using this one as a base.
|
||||||
|
|
||||||
|
All credit goes to Grinch for the menu [user-grinch](https://github.com/user-grinch)
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/logo.png" width="700" height="180">
|
<img src="https://raw.githubusercontent.com/user-grinch/Cheat-Menu/master/images/logo.png" width="700" height="180">
|
||||||
</p>
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
Press <kbd>Left Ctrl</kbd> + <kbd>M</kbd> to open the menu. Doesn't work in multiplayer
|
Press <kbd>Left Ctrl</kbd> + <kbd>M</kbd> to open the menu. Doesn't work in multiplayer.
|
||||||
</p>
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
READ THE INSTRUCTIONS. EVERYTHING YOU NEED TO KNOW IS ALREADY HERE.
|
READ THE INSTRUCTIONS. EVERYTHING YOU NEED TO KNOW IS ALREADY HERE.
|
||||||
@ -27,10 +35,8 @@ Only these versions of the game is supported. I highly recommand installing the
|
|||||||
- GTA VC v1.0 EN
|
- GTA VC v1.0 EN
|
||||||
- GTA III v1.0 EN
|
- GTA III v1.0 EN
|
||||||
|
|
||||||
If you have those mentioned versions installed, use the installer [here](https://github.com/user-grinch/Cheat-Menu/raw/master/installer/Installer.exe).
|
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Manual ( Not recommanded, use the installer instead! )</summary>
|
<summary>Manual ( I have disabled the installer for my fork. )</summary>
|
||||||
|
|
||||||
1. Install [DirectX9](https://www.microsoft.com/en-us/download/details.aspx?id=35), [Visual C++ Redistributable 2022 x86](https://aka.ms/vs/17/release/vc_redist.x86.exe) & [Ultimate asi loader](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases).
|
1. Install [DirectX9](https://www.microsoft.com/en-us/download/details.aspx?id=35), [Visual C++ Redistributable 2022 x86](https://aka.ms/vs/17/release/vc_redist.x86.exe) & [Ultimate asi loader](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases).
|
||||||
2. Download [**CheatMenuSA/VC/III.7z**](https://github.com/user-grinch/Cheat-Menu/releases) and extract everything in game root directory (NOT MODLOADER). The **CheatMenu** folder & **.asi** file must be placed in the same place.
|
2. Download [**CheatMenuSA/VC/III.7z**](https://github.com/user-grinch/Cheat-Menu/releases) and extract everything in game root directory (NOT MODLOADER). The **CheatMenu** folder & **.asi** file must be placed in the same place.
|
||||||
@ -98,13 +104,45 @@ If you're language isn't supported ( Appears `???` in the menu. Check [here](htt
|
|||||||
## Required to build
|
## Required to build
|
||||||
1. [Build Tools 2022](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022)
|
1. [Build Tools 2022](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022)
|
||||||
2. [DirectX9 SDK](https://www.microsoft.com/en-us/download/details.aspx?id=6812)
|
2. [DirectX9 SDK](https://www.microsoft.com/en-us/download/details.aspx?id=6812)
|
||||||
4. [Plugin SDK](https://github.com/DK22Pac/plugin-sdk)
|
3. [Plugin SDK](https://github.com/DK22Pac/plugin-sdk)
|
||||||
5. [Premake5](https://premake.github.io/) - Comes with already.
|
4. [Premake5](https://premake.github.io/) - Comes with already.
|
||||||
|
|
||||||
|
# Building the menu
|
||||||
|
## To make the solution files for this
|
||||||
|
1. Open a Command Prompt, Windows Terminal or Powershell window into the tools folder.
|
||||||
|
2. Run .\premake5.exe vs2022 (If using a different Visual Studio version, specify it here.)
|
||||||
|
|
||||||
|
## To build the menu
|
||||||
|
I need to look into how I built this, I don't remember the exact steps.
|
||||||
|
But you should be able to open the solution file in Visual Studio 2022 and build it from there.
|
||||||
|
|
||||||
|
## Debug the menu
|
||||||
|
You can use Visual Studio 2022 to debug the menu.
|
||||||
|
|
||||||
|
|
||||||
|
Here is my layout for the Debugging tab (These values should be set to where your GTA SA install is.):
|
||||||
|
* Command: "C:\Rockstar Games\GTA SA orig mod\gta_sa.exe"
|
||||||
|
* Working directory: "C:\Rockstar Games\GTA SA orig mod"
|
||||||
|
|
||||||
|
I have set this in the general tab for output directory: "C:\Rockstar Games\GTA SA orig mod\scripts".
|
||||||
|
This makes it to where it will build the menu straight to my GTA SA folder and I can launch the game using the debugger in Visual Studio 2022.
|
||||||
|
|
||||||
|
Mods helpful to have in GTA SA:
|
||||||
|
* Fast Loader (Make the game faster for debugging): [Fast Loader](https://www.gtagarage.com/mods/show.php?id=25665)
|
||||||
|
* Wide screen fix (Patch the game for proper widescreen support): [Wide screen fix](https://gtaforums.com/topic/547841-gtanfsmpother-widescreen-fixes-pack/)
|
||||||
|
* Windowed Mode (Add windowed mode support for the game.) [Windowed mode](https://github.com/ThirteenAG/III.VC.SA.WindowedMode/releases)
|
||||||
|
* Silent Patch (Fix a bunch of bugs and misc items in the game.) [Silent Patch](https://gtaforums.com/topic/669045-silentpatch/)
|
||||||
|
|
||||||
|
If using multiple monitors:
|
||||||
|
* Skip Device Selection: [Skip Device Selection](https://www.gtainside.com/en/sanandreas/mods/99791-skip-device-selection-window)
|
||||||
|
|
||||||
|
This disabled the device selection screen on startup for faster debugging.
|
||||||
|
|
||||||
## Projects used
|
## Projects used
|
||||||
1. [ImGui](https://github.com/ocornut/imgui)
|
1. [Cheat-Menu](https://github.com/user-grinch/Cheat-Menu)
|
||||||
2. [Kiero](https://github.com/Rebzzel/kiero)
|
2. [ImGui](https://github.com/ocornut/imgui)
|
||||||
3. [MinHook](https://github.com/TsudaKageyu/minhook)
|
3. [Kiero](https://github.com/Rebzzel/kiero)
|
||||||
4. [Plugin SDK](https://github.com/DK22Pac/plugin-sdk)
|
4. [MinHook](https://github.com/TsudaKageyu/minhook)
|
||||||
|
5. [Plugin SDK](https://github.com/DK22Pac/plugin-sdk)
|
||||||
|
|
||||||
All credits are given in Menu/About tab.
|
All credits are given in Menu/About tab.
|
||||||
|
@ -327,7 +327,6 @@ CustomSkinsTab = "Custom skins"
|
|||||||
CustomSkinsTip = "Note: Your txd & dff names can't exceed 8 characters. Don't change names while the game is running."
|
CustomSkinsTip = "Note: Your txd & dff names can't exceed 8 characters. Don't change names while the game is running."
|
||||||
CustomSkinTutorial = """
|
CustomSkinTutorial = """
|
||||||
Custom skin allows to change player skins without replacing any existing game ped skins.
|
Custom skin allows to change player skins without replacing any existing game ped skins.
|
||||||
|
|
||||||
Steps to enable 'Custom Skins',
|
Steps to enable 'Custom Skins',
|
||||||
|
|
||||||
1. Download & install modloader
|
1. Download & install modloader
|
||||||
@ -342,6 +341,10 @@ Limitations:
|
|||||||
3. Do NOT name your files to existing ped names
|
3. Do NOT name your files to existing ped names
|
||||||
|
|
||||||
Doing so will crash your game."""
|
Doing so will crash your game."""
|
||||||
|
TestFeatures = "Test Features"
|
||||||
|
Explosion = "Create an Explosion at your coordinates"
|
||||||
|
IsFlying = "Flying check"
|
||||||
|
|
||||||
CycleJump = "Higher cycle jumps"
|
CycleJump = "Higher cycle jumps"
|
||||||
DownloadModloader = "Download modloader"
|
DownloadModloader = "Download modloader"
|
||||||
DrunkEffect = "Drunk effect"
|
DrunkEffect = "Drunk effect"
|
||||||
@ -399,6 +402,12 @@ TotalSkins = "Total skins: "
|
|||||||
WantedLevel = "Wanted level"
|
WantedLevel = "Wanted level"
|
||||||
WorkSkinOnly = "Only contains the skins that work"
|
WorkSkinOnly = "Only contains the skins that work"
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
TestingTab = "Test Tab"
|
||||||
|
TestFeatures = "Test Features"
|
||||||
|
TestVehicle = "Vehicle"
|
||||||
|
Explosion = "Explosion"
|
||||||
|
|
||||||
[RPC]
|
[RPC]
|
||||||
BrowsingCheatMenu = "Browsing CheatMenu"
|
BrowsingCheatMenu = "Browsing CheatMenu"
|
||||||
Busted = "Busted!"
|
Busted = "Busted!"
|
||||||
@ -849,3 +858,4 @@ TeleportPage = "Teleport"
|
|||||||
VehiclePage = "Vehicle"
|
VehiclePage = "Vehicle"
|
||||||
VisualPage = "Visual"
|
VisualPage = "Visual"
|
||||||
WeaponPage = "Weapon"
|
WeaponPage = "Weapon"
|
||||||
|
TestPage = "Test"
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
#include "pages/teleport.h"
|
#include "pages/teleport.h"
|
||||||
#include "pages/menu.h"
|
#include "pages/menu.h"
|
||||||
|
|
||||||
|
// My headers
|
||||||
|
#include "test/functions/player_functions.h"
|
||||||
|
#include "test/events/test_events.h"
|
||||||
|
|
||||||
// 6-14-2024 @ 11:34AM - kelson8
|
// 6-14-2024 @ 11:34AM - kelson8
|
||||||
// I setup this for building the asi:
|
// I setup this for building the asi:
|
||||||
// https://stackoverflow.com/questions/1776060/how-to-make-visual-studio-copy-a-dll-file-to-the-output-directory
|
// https://stackoverflow.com/questions/1776060/how-to-make-visual-studio-copy-a-dll-file-to-the-output-directory
|
||||||
@ -226,6 +230,7 @@ CheatMenuMgr::CheatMenuMgr()
|
|||||||
// Doesn't work with ThirteenAG's windowed mode while inside initRwEvent
|
// Doesn't work with ThirteenAG's windowed mode while inside initRwEvent
|
||||||
Events::initGameEvent += [this]()
|
Events::initGameEvent += [this]()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!D3dHook::Init(fArgNoneWrapper(CheatMenu.Draw)))
|
if (!D3dHook::Init(fArgNoneWrapper(CheatMenu.Draw)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -234,8 +239,26 @@ CheatMenuMgr::CheatMenuMgr()
|
|||||||
ApplyStyle();
|
ApplyStyle();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// New
|
||||||
|
Events::gameProcessEvent += [this]()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Custom events
|
||||||
|
// Chaos mode, these only run when defined in the test_events.cpp file.
|
||||||
|
TestEvents::KillPlayerIfAiming();
|
||||||
|
TestEvents::ChaosModeEvent();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
Events::processScriptsEvent += [this]()
|
Events::processScriptsEvent += [this]()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//
|
||||||
|
// Custom events
|
||||||
|
// Chaos mode, these only run when defined in the test_events.cpp file.
|
||||||
|
TestEvents::DrowningExplosionEvent();
|
||||||
|
//
|
||||||
|
|
||||||
if (!FrontEndMenuManager.m_bMenuActive)
|
if (!FrontEndMenuManager.m_bMenuActive)
|
||||||
{
|
{
|
||||||
if (menuOpen.Pressed())
|
if (menuOpen.Pressed())
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
#define MENU_VERSION MENU_VERSION_NUMBER
|
#define MENU_VERSION MENU_VERSION_NUMBER
|
||||||
#define MENU_TITLE MENU_NAME " v" MENU_VERSION
|
#define MENU_TITLE MENU_NAME " v" MENU_VERSION
|
||||||
|
|
||||||
|
// Add my custom code to the menu.
|
||||||
#define CUSTOM_CODE
|
#define CUSTOM_CODE
|
||||||
|
|
||||||
#ifdef GTASA
|
#ifdef GTASA
|
||||||
|
4
src/enums/audio_ids.cpp
Normal file
4
src/enums/audio_ids.cpp
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "audio_ids.h"
|
||||||
|
|
||||||
|
// Idk if this file is needed.
|
27
src/enums/audio_ids.h
Normal file
27
src/enums/audio_ids.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class AudioIds {
|
||||||
|
public:
|
||||||
|
// https://sampwiki.blast.hk/wiki/SoundID
|
||||||
|
// This isn't a complete list, just a couple of these that I put together.
|
||||||
|
enum eSoundIds {
|
||||||
|
BLANK_SOUND = 0,
|
||||||
|
CRASH_SOUND = 1009,
|
||||||
|
GARAGE_DOOR_OPENING = 1035,
|
||||||
|
SELECTION_SOUND = 1058,
|
||||||
|
METALLIC_FENCE_RATTLE1 = 1100,
|
||||||
|
METALLIC_FENCE_RATTLE2 = 1101,
|
||||||
|
SPRAY_CAN = 1134,
|
||||||
|
CRASH1_SOUND = 1140,
|
||||||
|
CRASH2_SOUND = 1141,
|
||||||
|
THROW_SATCHEL_SOUND = 1145,
|
||||||
|
CAR_HORN = 1147,
|
||||||
|
BLIP_SOUND = 1149,
|
||||||
|
EXPLOSION_SOUND = 1159,
|
||||||
|
HANGER_DOORS = 1165,
|
||||||
|
DRIVING_SCHOOL_RESULTS_MUSIC = 1183,
|
||||||
|
BIKE_BOAT_SCHOOL_RESULTS_MUSIC = 1183,
|
||||||
|
FLIGHT_SCHOOL_RESULTS_MUSIC = 1187,
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
66
src/test/Readme.md
Normal file
66
src/test/Readme.md
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
## Folder info
|
||||||
|
This folder will contain test code for the KCNet SA Mod menu that I may work on in the future.
|
||||||
|
|
||||||
|
For now I am adding this stuff to the Cheat Menu but I'm using this to learn a lot of C++.
|
||||||
|
|
||||||
|
# Features
|
||||||
|
|
||||||
|
|
||||||
|
## Main test page
|
||||||
|
* Train test (Check if player is in a train)
|
||||||
|
* Health pickup (Spawns a health pickup on the player) - Incomplete
|
||||||
|
* Money pickup (Spawns 50k around the player)
|
||||||
|
* Enter crane (This should make it possible to enter a crane but I don't know how to use it.)
|
||||||
|
* Play mission passed (Plays the mission passed tune)
|
||||||
|
* Current radio station (Prints the current radio station to a textbox)
|
||||||
|
|
||||||
|
## Hud test
|
||||||
|
* Toggle Radar (Turn on/off the radar)
|
||||||
|
* Toggle Hud (Turn on/off the hud)
|
||||||
|
|
||||||
|
## Markers test
|
||||||
|
* Show corona (Show a corona on the map at the players coords) - This isn't setup yet.
|
||||||
|
* Remove corona (Remove the corona) - This isn't setup yet.
|
||||||
|
|
||||||
|
## Ped test
|
||||||
|
* Suicide (Kill the player)
|
||||||
|
* Bomb (Spawn a explosive on the player)
|
||||||
|
* Sound (Play a sound from the list) - This doesn't play the sound yet and is incomplete.
|
||||||
|
* Show coords (Show your current coords in a text box)
|
||||||
|
* Show marker coords (Show current marker coords in a text box) - This isn't setup yet.
|
||||||
|
* Player drowns (Toggles player drowning on/off, if it's disabled you cannot drown underwater)
|
||||||
|
* Gravity (Change the gravity)
|
||||||
|
* Spawn ped (Spawn a random ped)
|
||||||
|
* Area check test (Check if player is in specified coords)
|
||||||
|
* Misc test (So far this just has toggle sprinting but it crashes the menu.)
|
||||||
|
|
||||||
|
## Vehicle test
|
||||||
|
* Blow up all cars (Runs the blow up all cars cheat)
|
||||||
|
* Search Light (Make the helicopter search lights show up) - This doesn't work
|
||||||
|
* Blow up current car (Blows up the car the player is in)
|
||||||
|
* Close doors (Close all doors, doesn't work for hood or trunk)
|
||||||
|
* Lock doors (Lock vehicle doors, I cannot figure out how to unlock them yet)
|
||||||
|
* Unlock doors (Unlock vehicle doors) - This isn't setup yet.
|
||||||
|
* Flying cars (Enables flying cars cheat)
|
||||||
|
* Invincible car (Enables invincibility for your current vehicle)
|
||||||
|
* Is car in water check (Prints "Your car is dry" if not in water or "Your car is in the water" if in the water)
|
||||||
|
* Radio test (Toggle the radio) - This is incomplete.
|
||||||
|
* Burst all tires (Burst all vehicle tires) - This one seems to work but always shows the tires have been burst for a car.
|
||||||
|
|
||||||
|
## World test
|
||||||
|
* Weather (Change current weather) - This one works but it doesn't set the weather to the one in the list.
|
||||||
|
* Create checkpoint (Create a checkpoint on the map) - Incomplete
|
||||||
|
* Remove checkpoint (Remove the checkpoint from the map) - Incomplete
|
||||||
|
* Create corona (Create a corona on the map) - Incomplete
|
||||||
|
* Remove corona (Remove a corona from the map) - Incomplete
|
||||||
|
|
||||||
|
# Functions
|
||||||
|
|
||||||
|
## Player functions
|
||||||
|
These are mostly used internally in the C++ code.
|
||||||
|
* IsPlayerInArea(x1, y1, z1, x2, y2, z2) (Check if the player is in the current coordinates)
|
||||||
|
* IsPlayerInTrain (Check if the player is in a train)
|
||||||
|
* Kill player (Kill the player)
|
||||||
|
* Set never wanted (Set never wanted on/off) - Incomplete
|
||||||
|
* Set invincible (Set incinbility on/off) - Incomplete
|
||||||
|
* Set infinite ammo (Set infinite ammo on/off) - Incomplete
|
215
src/test/events/test_events.cpp
Normal file
215
src/test/events/test_events.cpp
Normal file
@ -0,0 +1,215 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "test_events.h"
|
||||||
|
#include "./test/functions/player_functions.h"
|
||||||
|
#include "./test/utils/timer_util.h"
|
||||||
|
|
||||||
|
#include "CPhysical.h"
|
||||||
|
|
||||||
|
#ifdef GTASA
|
||||||
|
#include "CClock.h"
|
||||||
|
#include "CTimer.h"
|
||||||
|
|
||||||
|
// My code
|
||||||
|
#include "test/test_ped.h"
|
||||||
|
|
||||||
|
#endif //GTASA
|
||||||
|
|
||||||
|
// TODO Move Chaos mode events into its own file.
|
||||||
|
// Most of these events will only run if this is defined
|
||||||
|
//#define _CHAOS_MODE
|
||||||
|
|
||||||
|
|
||||||
|
// Stuff to mess around with
|
||||||
|
// playerPed->m_nFightingStyle = STYLE_BOXING;
|
||||||
|
// playerPed->m_nPhysicalFlags.bApplyGravity = false;
|
||||||
|
|
||||||
|
// Make it to where if the car catches on fire the player can't exit it.
|
||||||
|
// playerPed->m_nPedFlags.bCanExitCar = false;
|
||||||
|
// playerPed->m_nPedFlags.bDontFight = false;
|
||||||
|
// playerPed->m_nPedFlags.CantBeKnockedOffBike = false;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO Move these and other chaos items into a seperate mod named KCNet-SAChaosMod
|
||||||
|
// Most of these are running on the main class which is cheatmenu.cpp
|
||||||
|
|
||||||
|
// TODO Add this into a checkbox for a toggle in the test menu.
|
||||||
|
|
||||||
|
TestEvents::TestEvents()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Kill the player if they are aiming, this didn't work.
|
||||||
|
/// </summary>
|
||||||
|
void TestEvents::KillPlayerIfAiming()
|
||||||
|
{
|
||||||
|
#ifdef _CHAOS_MODE
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
CPed* playerPed = reinterpret_cast<CPlayerPed*>(player);
|
||||||
|
|
||||||
|
if (playerPed->m_nPedFlags.bIsAimingGun)
|
||||||
|
{
|
||||||
|
player->m_fHealth = 0;
|
||||||
|
player->m_fArmour = 0;
|
||||||
|
Util::SetMessage("You have been exterminated!");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //CHAOS_MODE
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event that blows up the player if they are drowning.
|
||||||
|
/// This just constantly blows up the player if they are in the water, not even if they are drowning.
|
||||||
|
/// </summary>
|
||||||
|
void TestEvents::DrowningExplosionEvent()
|
||||||
|
|
||||||
|
{
|
||||||
|
#ifdef _CHAOS_MODE
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
|
||||||
|
// Oh wow this actually worked!
|
||||||
|
CPed* playerPed = reinterpret_cast<CPlayerPed*>(player);
|
||||||
|
//CPhysical* cPhysical = new CPhysical(player);
|
||||||
|
|
||||||
|
// This spawns too many bombs, sometimes hurts the player when they respawn, I wonder how to fix that.
|
||||||
|
if (playerPed->m_nPedFlags.bIsDrowning)
|
||||||
|
{
|
||||||
|
PlayerFunctions::SpawnBombOnPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
//playerPed->m_nPedFlags.
|
||||||
|
|
||||||
|
|
||||||
|
//player->m_b
|
||||||
|
//if(player->)
|
||||||
|
#endif //CHAOS_MODE
|
||||||
|
}
|
||||||
|
|
||||||
|
void CanNotExitCar()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
CPed* playerPed = reinterpret_cast<CPlayerPed*>(player);
|
||||||
|
playerPed->m_nPedFlags.bCanExitCar = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void KillPlayerInVehicle()
|
||||||
|
{
|
||||||
|
// Blow up the player if they enter a car and don't let them escape.. How evil!
|
||||||
|
if (PlayerFunctions::IsPlayerInVehicle())
|
||||||
|
{
|
||||||
|
PlayerFunctions::SpawnBombOnPlayer();
|
||||||
|
// Set it to where the player cannot exit the vehicle.
|
||||||
|
//CanNotExitCar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KillPlayerInMiddleOfMap()
|
||||||
|
{
|
||||||
|
PlayerFunctions* playerFunctions = new PlayerFunctions();
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
#ifdef GTASA
|
||||||
|
|
||||||
|
CVector coords1 = CVector(2, 2, 2);
|
||||||
|
CVector coords2 = CVector(20, 20, 20);
|
||||||
|
if (playerFunctions->IsPlayerInArea(coords1.x, coords1.y, coords1.z, coords2.x, coords2.y, coords2.z))
|
||||||
|
{
|
||||||
|
playerFunctions->KillPlayer();
|
||||||
|
// This just spams the screen, I wonder how to check if they died or update a value
|
||||||
|
if (!player->IsAlive()) {
|
||||||
|
Util::SetMessage("You have been exterminated!");
|
||||||
|
}
|
||||||
|
//Util::SetMessage("Hello");
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//CVehicle* cVehicle;
|
||||||
|
// This seems to work in this class.
|
||||||
|
//#define _CHAOS_MODE
|
||||||
|
void TestEvents::ChaosModeEvent()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// Put this outside of the preprocessors here so the preprocessors don't comment it out.
|
||||||
|
PlayerFunctions* playerFunctions = new PlayerFunctions();
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
|
||||||
|
//if(PlayerFunctions::m_bRespawnMiddleOfMap)
|
||||||
|
// This doesn't seem to toggle it on/off properly
|
||||||
|
#ifdef _TEST
|
||||||
|
if (playerFunctions->m_bRespawnMiddleOfMap)
|
||||||
|
{
|
||||||
|
Command<Commands::OVERRIDE_NEXT_RESTART>(22.0, 22.0, 2.0, 20.0);
|
||||||
|
}
|
||||||
|
// Quick test, this will always run and cancel it all the time most likely.
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Command<Commands::CANCEL_OVERRIDE_RESTART>();
|
||||||
|
}
|
||||||
|
#endif //TEST
|
||||||
|
// This seems to work fine, idk if it'll crash the game though.
|
||||||
|
//#ifdef _TEST
|
||||||
|
// Command<Commands::OVERRIDE_NEXT_RESTART>(22.0, 22.0, 2.0, 20.0);
|
||||||
|
//#endif //_TEST
|
||||||
|
#ifdef _CHAOS_MODE
|
||||||
|
// 6-18-2024 @ 3:37AM
|
||||||
|
// I figured out how to get timers working on here, this is running in Events::gameProcessEvent in cheatmenu.cpp
|
||||||
|
// This does work. Copied from overlay.cpp on lines 429-432
|
||||||
|
//size_t game_ms = CTimer::m_snTimeInMilliseconds;
|
||||||
|
//static size_t interval = 0;
|
||||||
|
|
||||||
|
// Toggle the gravity values, this seems to screw with it for a couple seconds and has a fun effect.
|
||||||
|
PedTestPage::InsaneGravity();
|
||||||
|
PedTestPage::NormalGravity();
|
||||||
|
|
||||||
|
|
||||||
|
// Crashes
|
||||||
|
#ifdef _TEST1
|
||||||
|
// Try to make this blow the player up if they press the horn button 5 times.
|
||||||
|
//m_nHornCounter
|
||||||
|
// This doesn't seem to work.
|
||||||
|
//if(CVehicle::m_nHornCounter > 1)
|
||||||
|
uint hornCounter = cVehicle->m_nHornCounter;
|
||||||
|
|
||||||
|
//if(cVehicle.m_nHornCounter > 1)
|
||||||
|
// Will this work?
|
||||||
|
if(PlayerFunctions::IsPlayerInVehicle() && hornCounter > 5)
|
||||||
|
{
|
||||||
|
// This might fix the timer?
|
||||||
|
if (game_ms - interval > 1000)
|
||||||
|
{
|
||||||
|
PlayerFunctions::SpawnBombOnPlayer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //_TEST1
|
||||||
|
|
||||||
|
// Doesn't work, disabled.
|
||||||
|
#ifdef _TEST1
|
||||||
|
// Spawn a bomb on the players vehicle if it is upside down every second :P
|
||||||
|
if (PlayerFunctions::IsPlayerInVehicle())
|
||||||
|
{
|
||||||
|
if (CVehicle::IsUpsideDown && game_ms - interval > 1000)
|
||||||
|
{
|
||||||
|
PlayerFunctions::SpawnBombOnPlayer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //_TEST1
|
||||||
|
|
||||||
|
// I disabled this code to test something else.
|
||||||
|
#ifdef _TEST1
|
||||||
|
// Add test timer for this, this works!
|
||||||
|
if (game_ms - interval > 1000) {
|
||||||
|
//
|
||||||
|
KillPlayerInVehicle();
|
||||||
|
interval = game_ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
KillPlayerInMiddleOfMap();
|
||||||
|
#endif //_TEStT1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //_CHAOS_MODE
|
||||||
|
}
|
11
src/test/events/test_events.h
Normal file
11
src/test/events/test_events.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#pragma once
|
||||||
|
//#include "pch.h"
|
||||||
|
|
||||||
|
class TestEvents
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TestEvents();
|
||||||
|
static void ChaosModeEvent();
|
||||||
|
static void DrowningExplosionEvent();
|
||||||
|
static void KillPlayerIfAiming();
|
||||||
|
};
|
226
src/test/functions/misc_functions.cpp
Normal file
226
src/test/functions/misc_functions.cpp
Normal file
@ -0,0 +1,226 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "misc_functions.h"
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
// Misc options
|
||||||
|
//////////////////////////
|
||||||
|
|
||||||
|
// Untested
|
||||||
|
/// <summary>
|
||||||
|
/// Opens the save menu, only works if the player is not dead.
|
||||||
|
/// </summary>
|
||||||
|
void MiscFunctions::OpenSaveMenu()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
if (!player->IsAlive())
|
||||||
|
{
|
||||||
|
Command<Commands::ACTIVATE_SAVE_MENU>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggle the player talking or not.
|
||||||
|
/// </summary>
|
||||||
|
void MiscFunctions::TogglePlayerSpeech(bool toggle)
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
|
||||||
|
if (toggle)
|
||||||
|
{
|
||||||
|
Command<Commands::ENABLE_CHAR_SPEECH>(hplayer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Command<Commands::DISABLE_CHAR_SPEECH>(hplayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////
|
||||||
|
// Begin untested functions
|
||||||
|
//////////////////
|
||||||
|
|
||||||
|
// Test messing with a void or boolean from the code in a memory address
|
||||||
|
/*
|
||||||
|
// 0x4B1330
|
||||||
|
bool CEventHitByWaterCannon::AffectsPed
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Will this work? Possibly patch out the code so the player or peds aren't effected by a firetruck water cannon.
|
||||||
|
// I don't think this works like this though but it looks like I can replace functions in the code,
|
||||||
|
// using the reversed code as a guide on what the functions are doing.
|
||||||
|
// TODO Test this later!
|
||||||
|
bool ToggleWaterCannonTest()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ToggleWaterCannonHit()
|
||||||
|
{
|
||||||
|
patch::ReplaceFunction(0x4B1330, *ToggleWaterCannonTest, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is untested but it should work like this.
|
||||||
|
void ChangeClothes(CPed* player, const char* textureName, const char* modelName, int bodyPart)
|
||||||
|
{
|
||||||
|
|
||||||
|
//Command<Commands::GIVE_PLAYER_CLOTHES_OUTSIDE_SHOP>(player, "tshirt2horiz", "tshirt2", 0);
|
||||||
|
Command<Commands::GIVE_PLAYER_CLOTHES_OUTSIDE_SHOP>(player, textureName, modelName, bodyPart);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Change the players current outfit, this isn't tested yet.
|
||||||
|
/// </summary>
|
||||||
|
void ChangePlayerClothes()
|
||||||
|
{
|
||||||
|
CPed* player = FindPlayerPed();
|
||||||
|
// https://wiki.multitheftauto.com/wiki/CJ_Clothes
|
||||||
|
// player, textureName, modelName, bodyPart
|
||||||
|
// Sun glasses
|
||||||
|
//Command<Commands::GIVE_PLAYER_CLOTHES_OUTSIDE_SHOP>(player, "glasses01dark", "glasses01", 15);
|
||||||
|
ChangeClothes(player, "glasses01dark", "glasses01", CLOTHES_MODEL_GLASSES);
|
||||||
|
// White striped shirt.
|
||||||
|
//Command<Commands::GIVE_PLAYER_CLOTHES_OUTSIDE_SHOP>(player, "tshirt2horiz", "tshirt2", 0);
|
||||||
|
ChangeClothes(player, "tshirt2horiz", "tshirt2", CLOTHES_MODEL_TORSO);
|
||||||
|
// Camo green pants
|
||||||
|
ChangeClothes(player, "worktrcamogrn", "worktr", CLOTHES_MODEL_LEGS);
|
||||||
|
// Shoes
|
||||||
|
ChangeClothes(player, "sneakerbincblu", "sneaker", CLOTHES_MODEL_SHOES);
|
||||||
|
// Watch ,this one didn't seem to have an enum for it
|
||||||
|
ChangeClothes(player, "watchcro", "watch", 14);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// // Change the current day of the week, from 1-7. Untested.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dayToSet">Date to set the game time to.</param>
|
||||||
|
void ChangeCurrentDay(int dayToSet)
|
||||||
|
{
|
||||||
|
patch::Set<byte>(0xB7014E, dayToSet, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the current day of the week, from 1-7. Untested.
|
||||||
|
/// </summary>
|
||||||
|
void GetCurrentDay()
|
||||||
|
{
|
||||||
|
patch::Get<byte>(0xB7014E);
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////
|
||||||
|
// End untested functions
|
||||||
|
//////////////////
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
// Blip options
|
||||||
|
//////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
void MiscFunctions::HideAllBlips(bool toggle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (toggle)
|
||||||
|
{
|
||||||
|
Command<Commands::HIDE_ALL_FRONTEND_BLIPS>(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Command<Commands::HIDE_ALL_FRONTEND_BLIPS>(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
// Will it work like this also?
|
||||||
|
//Command<Commands::HIDE_ALL_FRONTEND_BLIPS>(toggle);
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
//
|
||||||
|
//////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
// Garage functions
|
||||||
|
// These are untested but they should work.
|
||||||
|
//////////////////////////
|
||||||
|
|
||||||
|
bool MiscFunctions::IsGarageOpen(int garageId)
|
||||||
|
{
|
||||||
|
if(Command<Commands::IS_GARAGE_OPEN>(garageId))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MiscFunctions::IsGarageClosed(int garageId)
|
||||||
|
{
|
||||||
|
if (Command<Commands::IS_GARAGE_CLOSED>(garageId))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void MiscFunctions::OpenGarage(int garageId)
|
||||||
|
{
|
||||||
|
Command<Commands::OPEN_GARAGE>(garageId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MiscFunctions::CloseGarage(int garageId)
|
||||||
|
{
|
||||||
|
Command<Commands::CLOSE_GARAGE>(garageId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MiscFunctions::ActivateGarage(int garageId)
|
||||||
|
{
|
||||||
|
Command<Commands::ACTIVATE_GARAGE>(garageId);
|
||||||
|
//Util::SetMessage("You have enabled the garage with id " + garageId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MiscFunctions::DeactivateGarage(int garageId)
|
||||||
|
{
|
||||||
|
Command<Commands::DEACTIVATE_GARAGE>(garageId);
|
||||||
|
//Util::SetMessage("You have disabled the garage with id " + garageId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MiscFunctions::SetGarageType(int garageId, int garageType)
|
||||||
|
{
|
||||||
|
Command<Commands::CHANGE_GARAGE_TYPE>(garageId, garageType);
|
||||||
|
Util::SetMessage(std::format("You have changed the garage with id {} to type id {} ", garageId, garageType).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MiscFunctions::SetResprayFree(int garageId, bool toggle)
|
||||||
|
{
|
||||||
|
if (toggle)
|
||||||
|
{
|
||||||
|
Command<Commands::SET_FREE_RESPRAYS>(garageId, true);
|
||||||
|
Util::SetMessage("Resprays are now free at this Pay N Spray!");
|
||||||
|
// Resprays are now free at this Pay N Spray!
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Command<Commands::SET_FREE_RESPRAYS>(garageId, false);
|
||||||
|
Util::SetMessage("Resprays are no longer free at this Pay N Spray!");
|
||||||
|
// Resprays are no longer free at this Pay N Spray!
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
//
|
||||||
|
//////////////////////////
|
26
src/test/functions/misc_functions.h
Normal file
26
src/test/functions/misc_functions.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#pragma once
|
||||||
|
//#include "pch.h"
|
||||||
|
|
||||||
|
// TODO Make this stuff not static
|
||||||
|
class MiscFunctions
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Garage functions
|
||||||
|
static bool IsGarageOpen(int garageId);
|
||||||
|
static bool IsGarageClosed(int garageId);
|
||||||
|
static void OpenGarage(int garageId);
|
||||||
|
static void CloseGarage(int garageId);
|
||||||
|
|
||||||
|
static void ActivateGarage(int garageId);
|
||||||
|
static void DeactivateGarage(int garageId);
|
||||||
|
// https://library.sannybuilder.com/#/sa/enums/GarageType
|
||||||
|
static void SetGarageType(int garageId, int garageType);
|
||||||
|
static void SetResprayFree(int garageId, bool state);
|
||||||
|
|
||||||
|
static void OpenSaveMenu();
|
||||||
|
static void TogglePlayerSpeech(bool toggle);
|
||||||
|
|
||||||
|
// Blip functions
|
||||||
|
static void HideAllBlips(bool toggle);
|
||||||
|
|
||||||
|
};
|
111
src/test/functions/ped_functions.cpp
Normal file
111
src/test/functions/ped_functions.cpp
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "ped_functions.h"
|
||||||
|
#include "enums/audio_ids.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef GTASA
|
||||||
|
#include "CExplosion.h"
|
||||||
|
#include "CPopulation.h"
|
||||||
|
#include "CTaskComplexWanderStandard.h"
|
||||||
|
#include "CSprite.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Enable test features in this class.
|
||||||
|
#define _TEST
|
||||||
|
|
||||||
|
// Spawn random ped
|
||||||
|
|
||||||
|
// Taken from plugin-sdk examples under PedSpawner in Main.cpp
|
||||||
|
// TODO Convert these to an enum sometime.
|
||||||
|
int pedModelIds[] = { 0, 7, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 43, 44, 45, 46,
|
||||||
|
47, 48, 49, 50, 51, 52, 57, 58, 59, 60, 61, 62, 66, 67, 68, 70, 71, 72, 73, 78, 79, 80, 81, 82, 83, 84, 94, 95, 96, 97, 98, 99, 100, 101,
|
||||||
|
102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 132,
|
||||||
|
133, 134, 135, 136, 137, 142, 143, 144, 146, 147, 153, 154, 155, 156, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 170, 171,
|
||||||
|
173, 174, 175, 176, 177, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 200, 202, 203, 204, 206, 209, 210, 212, 213, 217, 220,
|
||||||
|
221, 222, 223, 227, 228, 229, 230, 234, 235, 236, 239, 240, 241, 242, 247, 248, 249, 250, 252, 253, 254, 255, 258, 259, 260, 261, 262,
|
||||||
|
9, 10, 11, 12, 13, 31, 38, 39, 40, 41, 53, 54, 55, 56, 63, 64, 69, 75, 76, 77, 85, 87, 88, 89, 90, 91, 92, 93, 129, 130, 131, 138, 139,
|
||||||
|
140, 141, 145, 148, 150, 151, 152, 157, 169, 172, 178, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 201, 205, 207, 211, 214, 215,
|
||||||
|
216, 218, 219, 224, 225, 226, 231, 232, 233, 237, 238, 243, 244, 245, 246, 251, 256, 257, 263 };
|
||||||
|
|
||||||
|
// Cluckin bell,
|
||||||
|
int miscPedIds[] = { 167, };
|
||||||
|
|
||||||
|
int copModelIds[] = { 280, 281, 282, 283, 284, 285, 286, 287, 288, };
|
||||||
|
|
||||||
|
// I wonder how to return this value to use it in the events, so if the ped talks or dies they blow up.
|
||||||
|
// I would need to return the ped.
|
||||||
|
#ifdef GTASA
|
||||||
|
void PedFunctions::SpawnRandomPed()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
// Taken from plugin-sdk examples under PedSpawner in Main.cpp
|
||||||
|
// https://github.com/DK22Pac/plugin-sdk/blob/master/examples/PedSpawner/Main.cpp
|
||||||
|
// Ped
|
||||||
|
int modelID = pedModelIds[rand() % 250]; // Random model id
|
||||||
|
CStreaming::RequestModel(modelID, 0); // Request the model
|
||||||
|
CStreaming::LoadAllRequestedModels(false); // Whatever this does.
|
||||||
|
CPed* ped = new CCivilianPed(CPopulation::IsFemale(modelID) ? PED_TYPE_CIVFEMALE : PED_TYPE_CIVMALE, modelID);
|
||||||
|
|
||||||
|
|
||||||
|
// New
|
||||||
|
// Idk how this one works
|
||||||
|
//ped->m_pIntelligence
|
||||||
|
|
||||||
|
// Add blip for char
|
||||||
|
#ifdef _TEST
|
||||||
|
// This works but doesn't get removed when the ped dies.
|
||||||
|
// Puts a red marker over them.
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/0187
|
||||||
|
|
||||||
|
// TODO Figure out how to store marker and delete it when they die.
|
||||||
|
Command<Commands::ADD_BLIP_FOR_CHAR>(ped);
|
||||||
|
#endif //_TEST
|
||||||
|
|
||||||
|
if (ped)
|
||||||
|
{
|
||||||
|
// TODO Figure out how to draw a health bar above the peds head.
|
||||||
|
|
||||||
|
// This looks like it's getting the offset of the current players coordinates.
|
||||||
|
ped->SetPosn(FindPlayerPed()->TransformFromObjectSpace(CVector(0.0f, 5.0f, 3.0f)));
|
||||||
|
ped->SetOrientation(0.0f, 0.0f, 0.0f);
|
||||||
|
// This should make the spawned in ped hate the player and want to kill them
|
||||||
|
// Idea taken from here in this cleo script.: https://gtaforums.com/topic/993040-sa-cleo-detect-that-the-char-is-trying-to-attack-another-char/
|
||||||
|
// This didn't work
|
||||||
|
ped->m_acquaintance.m_nHate = PED_TYPE_PLAYER1;
|
||||||
|
ped->m_acquaintance.m_nHate = PED_TYPE_PLAYER2;
|
||||||
|
// Give the ped a MP5
|
||||||
|
//ped->GiveWeapon(WEAPON_MP5, 999, true);
|
||||||
|
|
||||||
|
// Stop the ped from talking
|
||||||
|
//ped->DisablePedSpeech(1);
|
||||||
|
|
||||||
|
// Give them 1000 health
|
||||||
|
ped->m_fHealth = 1000;
|
||||||
|
// Set ped to Regular
|
||||||
|
ped->m_nPedType = PED_TYPE_CIVMALE;
|
||||||
|
// Stop the medics from being able to revive the ped.
|
||||||
|
ped->m_nPedFlags.bAllowMedicsToReviveMe = false;
|
||||||
|
CVector pedPos = ped->GetPosition();
|
||||||
|
|
||||||
|
// This doesn't work, it would need to be in an event.
|
||||||
|
//if (ped->m_nPedFlags.bIsTalking)
|
||||||
|
//{
|
||||||
|
// // Spawn a bomb on them if they speak.
|
||||||
|
// Command<Commands::ADD_EXPLOSION>(pedPos.x, pedPos.y, pedPos.z, EXPLOSION_CAR);
|
||||||
|
// Command<Commands::ADD_ONE_OFF_SOUND>(pedPos.x, pedPos.y, pedPos.z, AudioIds::EXPLOSION_SOUND);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CWorld::Add(ped);
|
||||||
|
ped->PositionAnyPedOutOfCollision();
|
||||||
|
ped->m_pIntelligence->m_TaskMgr.SetTask(new CTaskComplexWanderStandard(4, rand() % 8, true), 4, false);
|
||||||
|
// What is nCommand, for the char value?
|
||||||
|
//ped->m_pIntelligence->m_TaskMgr.SetTask(new CTaskSimpleUseGun(player, player->GetPosition(), 'TT', 1U, false));
|
||||||
|
//ped->m_pIntelligence->m_TaskMgr.SetTask(new CTaskSimpleFight());
|
||||||
|
|
||||||
|
// This makes it to where the ped can be cleared by the game.
|
||||||
|
ped->CanBeDeleted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
10
src/test/functions/ped_functions.h
Normal file
10
src/test/functions/ped_functions.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
class PedFunctions
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// List of the ped model ids
|
||||||
|
//int pedModelIds[];
|
||||||
|
|
||||||
|
static void SpawnRandomPed();
|
||||||
|
};
|
||||||
|
|
335
src/test/functions/player_functions.cpp
Normal file
335
src/test/functions/player_functions.cpp
Normal file
@ -0,0 +1,335 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "player_functions.h"
|
||||||
|
#include "enums/audio_ids.h"
|
||||||
|
#include "test/utils/timer_util.h"
|
||||||
|
|
||||||
|
#include "CExplosion.h"
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Mostly helper functions for the player.
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
|
||||||
|
PlayerFunctions::PlayerFunctions()
|
||||||
|
{
|
||||||
|
//if (m_bRespawnMiddleOfMap)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PlayerFunctions::IsPlayerDead()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
if(!player->IsAlive())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerFunctions::KillPlayer()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
player->m_fHealth = 0;
|
||||||
|
player->m_fArmour = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
// Cheat functions
|
||||||
|
//////////////////////////
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the never wanted value, untested
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="toggle">If never wanted is on</param>
|
||||||
|
void PlayerFunctions::SetNeverWanted(bool toggle)
|
||||||
|
{
|
||||||
|
// TODO Possibly replace these with byte instead of bool.
|
||||||
|
if(toggle)
|
||||||
|
{
|
||||||
|
// Enable never wanted
|
||||||
|
patch::Set<bool>(0x969171, 1, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Disable never wanted
|
||||||
|
patch::Set<bool>(0x969171, 1, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the player as invincible, untested
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="toggle">If the player is invincible.</param>
|
||||||
|
void PlayerFunctions::SetInvincible(bool toggle)
|
||||||
|
{
|
||||||
|
CPed* player = FindPlayerPed();
|
||||||
|
// Taken from player.cpp on line 124, looks like this is running the infinite health cheat using the memory address
|
||||||
|
if (toggle)
|
||||||
|
{
|
||||||
|
// Enable invincibility
|
||||||
|
patch::Set<bool>(0x96916D, 1, true);
|
||||||
|
player->m_nPhysicalFlags.bBulletProof = 1;
|
||||||
|
player->m_nPhysicalFlags.bCollisionProof = 1;
|
||||||
|
player->m_nPhysicalFlags.bExplosionProof = 1;
|
||||||
|
player->m_nPhysicalFlags.bFireProof = 1;
|
||||||
|
player->m_nPhysicalFlags.bMeleeProof = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Disable invincibility
|
||||||
|
patch::Set<bool>(0x96916D, 0, true);
|
||||||
|
player->m_nPhysicalFlags.bBulletProof = 0;
|
||||||
|
player->m_nPhysicalFlags.bCollisionProof = 0;
|
||||||
|
player->m_nPhysicalFlags.bExplosionProof = 0;
|
||||||
|
player->m_nPhysicalFlags.bFireProof = 0;
|
||||||
|
player->m_nPhysicalFlags.bMeleeProof = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the infinte ammo cheat, untested.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="toggle">If infinite ammo is active.</param>
|
||||||
|
void PlayerFunctions::SetInfiniteAmmo(bool toggle)
|
||||||
|
{
|
||||||
|
// TODO Possibly replace these with byte instead of bool.
|
||||||
|
|
||||||
|
if (toggle)
|
||||||
|
{
|
||||||
|
// Enable infinite ammo
|
||||||
|
patch::Set<bool>(0x969178, 1, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Disable infinite ammo
|
||||||
|
patch::Set<bool>(0x969178, 0, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
//
|
||||||
|
//////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Spawn a bomb on the player with sound, like a grenade or satchel charge.
|
||||||
|
/// </summary>
|
||||||
|
void PlayerFunctions::SpawnBombOnPlayer()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
//TODO Test these in the other games, 3 and vc later!
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
|
||||||
|
CVector playerPos = player->GetPosition();
|
||||||
|
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/020C
|
||||||
|
// x, y, z, EXPLOSION_CAR
|
||||||
|
// Will this work for a time delay on this?
|
||||||
|
// No this didn't work at all.
|
||||||
|
|
||||||
|
// This stops the explosions when the player dies.
|
||||||
|
if (!player->IsAlive()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Command<Commands::ADD_EXPLOSION>(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR);
|
||||||
|
|
||||||
|
PlayerFunctions::AddSoundOnPlayer(AudioIds::EXPLOSION_SOUND);
|
||||||
|
|
||||||
|
// Alternative method to do this.
|
||||||
|
//int explosionId = CExplosion::AddExplosion(FindPlayerPed(), FindPlayerPed(), EXPLOSION_CAR, playerPos, 1000, 1, 1.0f, true);
|
||||||
|
//CExplosion::GetExplosionPosition(explosionId);
|
||||||
|
|
||||||
|
//CExplosion::RemoveAllExplosionsInArea();
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
//static bool IsPlayerInCar()
|
||||||
|
//{
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if the player is in the specified area.
|
||||||
|
/// Values are the first set of x,y,z and the second set in a cube, if you have ever messed with mta sa lua it's kind of like that.
|
||||||
|
/// So if you want the player to be killed going from 2,2,2 to 20,20,20 that would be possible.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>If player is in specified area</returns>
|
||||||
|
///
|
||||||
|
//static bool IsPlayerInArea(float x1, float y1, float z1, float x2, float y2, float z2)
|
||||||
|
bool PlayerFunctions::IsPlayerInArea(float x1, float y1, float z1, float x2, float y2, float z2)
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
|
||||||
|
CVector playerPos = player->GetPosition();
|
||||||
|
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/00A4
|
||||||
|
|
||||||
|
if (Command<Commands::IS_CHAR_IN_AREA_3D>(hplayer,
|
||||||
|
x1, y1, z1, x2, y2, z2, false)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
// Vehicle functions
|
||||||
|
//////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
// Check for the player being in all types of vehicles
|
||||||
|
//////////////////////////
|
||||||
|
|
||||||
|
bool IsPlayerInBoat()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
if (Command<Commands::IS_CHAR_IN_ANY_BOAT>(hplayer)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsPlayerInHeli()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
if (Command<Commands::IS_CHAR_IN_ANY_HELI>(hplayer)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsPlayerInPlane()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
if (Command<Commands::IS_CHAR_IN_ANY_PLANE>(hplayer)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if player is in a train
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>If the player is in a train</returns>
|
||||||
|
bool PlayerFunctions::IsPlayerInTrain()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
if (Command<Commands::IS_CHAR_IN_ANY_TRAIN>(hplayer)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the player is in a vehicle
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>If the player is in a vehicle.</returns>
|
||||||
|
bool PlayerFunctions::IsPlayerInVehicle()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
if (Command<Commands::IS_CHAR_IN_ANY_CAR>(hplayer))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
//
|
||||||
|
//////////////////////////
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the player is stuck under a car
|
||||||
|
/// </summary>
|
||||||
|
bool PlayerFunctions::IsPedStuckUnderCar()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
|
||||||
|
|
||||||
|
// I don't think this will work making it like this.
|
||||||
|
bool bIsPlayerStuckUnderCar = Command<Commands::IS_CHAR_STUCK_UNDER_CAR>(player);
|
||||||
|
|
||||||
|
if (bIsPlayerStuckUnderCar)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
//
|
||||||
|
//////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
// Sound testing
|
||||||
|
//////////////////////////
|
||||||
|
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/018C
|
||||||
|
// List of sound ids: https://sampwiki.blast.hk/wiki/SoundID
|
||||||
|
/// <summary>
|
||||||
|
/// Play a sound on the player at their current coordinates.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="audioId">The audio id to play</param>
|
||||||
|
void PlayerFunctions::AddSoundOnPlayer(int audioId)
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
CVector playerPos = player->GetPosition();
|
||||||
|
//Command<Commands::ADD_ONE_OFF_SOUND>(playerPos.x, playerPos.y, playerPos.z, AudioIds::EXPLOSION_SOUND);
|
||||||
|
// Will this work?
|
||||||
|
Command<Commands::ADD_ONE_OFF_SOUND>(playerPos.x, playerPos.y, playerPos.z, audioId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is untested.
|
||||||
|
/// <summary>
|
||||||
|
/// Play a sound at the specifed coordinates, takes an x,y,z and an audio id.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="audioId">The id of the sound to play</param>
|
||||||
|
void AddSoundAtCoords(float posX, float posY, float posZ, int audioId)
|
||||||
|
{
|
||||||
|
Command<Commands::ADD_ONE_OFF_SOUND>(posX, posY, posZ, audioId);
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
//
|
||||||
|
//////////////////////////
|
21
src/test/functions/player_functions.h
Normal file
21
src/test/functions/player_functions.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#pragma once
|
||||||
|
//#include "pch.h"
|
||||||
|
|
||||||
|
class PlayerFunctions
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool m_bRespawnMiddleOfMap;
|
||||||
|
PlayerFunctions();
|
||||||
|
PlayerFunctions(const PlayerFunctions&);
|
||||||
|
static void KillPlayer();
|
||||||
|
static void SpawnBombOnPlayer();
|
||||||
|
static bool IsPlayerInVehicle();
|
||||||
|
static bool IsPlayerInArea(float x1, float y1, float z1, float x2, float y2, float z2);
|
||||||
|
static bool IsPlayerInTrain();
|
||||||
|
static bool IsPedStuckUnderCar();
|
||||||
|
static void AddSoundOnPlayer(int audioId);
|
||||||
|
static bool IsPlayerDead();
|
||||||
|
static void SetNeverWanted(bool toggle);
|
||||||
|
static void SetInvincible(bool toggle);
|
||||||
|
static void SetInfiniteAmmo(bool toggle);
|
||||||
|
};
|
67
src/test/functions/vehicle_functions.cpp
Normal file
67
src/test/functions/vehicle_functions.cpp
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
#include "vehicle_functions.h"
|
||||||
|
#include "player_functions.h"
|
||||||
|
|
||||||
|
void VehicleTest()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
if (PlayerFunctions::IsPlayerInVehicle())
|
||||||
|
{
|
||||||
|
CVehicle* pVeh = player->m_pVehicle;
|
||||||
|
//pVeh->
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Quick test for making sure this class is working.
|
||||||
|
/// </summary>
|
||||||
|
void VehicleFunctions::PlayerInCarMsg()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
if (PlayerFunctions::IsPlayerInVehicle())
|
||||||
|
{
|
||||||
|
Util::SetMessage("You are in a car.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Util::SetMessage("You are not in a car.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VehicleFunctions::IsCarInWater()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
|
||||||
|
if (PlayerFunctions::IsPlayerInVehicle())
|
||||||
|
{
|
||||||
|
CVehicle* pVeh = player->m_pVehicle;
|
||||||
|
// Will this work?
|
||||||
|
int hVeh = CPools::GetVehicleRef(pVeh);
|
||||||
|
bool bIsCarInWater = Command<Commands::IS_CAR_IN_WATER>(hVeh);
|
||||||
|
|
||||||
|
if (bIsCarInWater)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This should make this do nothing.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
10
src/test/functions/vehicle_functions.h
Normal file
10
src/test/functions/vehicle_functions.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
//#include "pch.h"
|
||||||
|
|
||||||
|
class VehicleFunctions
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void PlayerInCarMsg();
|
||||||
|
static bool IsCarInWater();
|
||||||
|
};
|
87
src/test/misc/misc_test.cpp
Normal file
87
src/test/misc/misc_test.cpp
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "misc_test.h"
|
||||||
|
#include "CBirds.h"
|
||||||
|
|
||||||
|
#include "CVehicle.h"
|
||||||
|
#include "CVehicleModelInfo.h"
|
||||||
|
|
||||||
|
// New
|
||||||
|
#ifdef GTASA
|
||||||
|
#include "CExplosion.h"
|
||||||
|
#include "CPopulation.h"
|
||||||
|
#include "CTaskComplexWanderStandard.h"
|
||||||
|
#include "CSprite.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MiscTestPage::MiscTestPage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Testing for messing with the code for the birds in the game.
|
||||||
|
void BirdMenu()
|
||||||
|
{
|
||||||
|
//if(ImGui::Button(""))
|
||||||
|
//{
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
|
||||||
|
// Create 10 birds with 20 added to the z coord.
|
||||||
|
// I don't know if this'll work.
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
CVector playerPos = player->GetPosition();
|
||||||
|
float posX = playerPos.x;
|
||||||
|
float posY = playerPos.y;
|
||||||
|
// Spawn 20 above the player
|
||||||
|
float posZ = playerPos.z + 20;
|
||||||
|
|
||||||
|
// Set the targetPos to a CVector
|
||||||
|
CVector targetPos = CVector(posX, posY, posZ);
|
||||||
|
// Create the birds.
|
||||||
|
CBirds::CreateNumberOfBirds(playerPos, targetPos, 10, 1, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void PlayerPedTest()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
|
||||||
|
// Got this from https://github.com/JuniorDjjr/CLEOPlus/blob/main/CLEOPlus/Coop.cpp#L30
|
||||||
|
// I think I can modify more for the player or other peds using this
|
||||||
|
CPlayerPed* playerTest = CWorld::Players[1].m_pPed;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Figure out how to put a random put in a vehicle.
|
||||||
|
static void PedVehicleTest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void VehicleModelTest()
|
||||||
|
{
|
||||||
|
// Player and vehicle check are needed
|
||||||
|
CPlayerPed* playerPed = FindPlayerPed();
|
||||||
|
CVector playerPos = playerPed->GetPosition();
|
||||||
|
CVehicle* playerVehicle = playerPed->m_pVehicle;
|
||||||
|
|
||||||
|
if(playerVehicle)
|
||||||
|
{
|
||||||
|
//cVehicleParams
|
||||||
|
//CVehicleModelInfo::
|
||||||
|
// Will this work? Toggle the lights off if on.
|
||||||
|
if (CVehicleModelInfo::ms_lightsOn)
|
||||||
|
{
|
||||||
|
!CVehicleModelInfo::ms_lightsOn;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CVehicleModelInfo::ms_lightsOn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//CVehicleModelInfo::m_nVehicleClass;
|
||||||
|
//CVehicleModelInfo::m_nVehicleType;
|
||||||
|
}
|
11
src/test/misc/misc_test.h
Normal file
11
src/test/misc/misc_test.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#pragma once
|
||||||
|
class MiscTestPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Blank constructor, I could do something with these.
|
||||||
|
MiscTestPage();
|
||||||
|
MiscTestPage(const MiscTestPage&);
|
||||||
|
// Menu functions
|
||||||
|
void MiscTestMenu();
|
||||||
|
};
|
||||||
|
|
@ -18,6 +18,28 @@
|
|||||||
https://github.com/user-grinch/Cheat-Menu
|
https://github.com/user-grinch/Cheat-Menu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// TODO Move this into my own menu named KCNet-SAMenu, possibly try to make it work on Vice City and 3.
|
||||||
|
|
||||||
|
|
||||||
|
// TODO Figure out how to get the coordniates of where the player is looking at, I think that should be possible.
|
||||||
|
// TODO Try to get this working on VC and 3 sometime, the menu normally works on those games I would just have to make sure I don't have any SA specific
|
||||||
|
// memory addresses or anything in it.
|
||||||
|
|
||||||
|
// Well this was working with the Visual Studio 2022 debugger now it says cannot find gta_sa.exe or gta-vc.exe.
|
||||||
|
// It still seems to work if I launch the games directly though.
|
||||||
|
|
||||||
|
// 6-17-2024 @ 2:51AM
|
||||||
|
// I fixed it to work with the Visual Studio 2022 debugger again
|
||||||
|
// Useful functions:
|
||||||
|
// Force all cars to be the specified model: https://library.sannybuilder.com/#/sa/default/09BF
|
||||||
|
// Set ped density multiplier: https://library.sannybuilder.com/#/sa/default/03DE
|
||||||
|
// Set ped vehicle multipler: https://library.sannybuilder.com/#/sa/default/01EB
|
||||||
|
//
|
||||||
|
|
||||||
|
// This guide might be useful:
|
||||||
|
// https://www.open.mp/docs/tutorials/PluginDevelopmentGuide
|
||||||
|
|
||||||
|
|
||||||
#ifdef GTASA
|
#ifdef GTASA
|
||||||
#include "CExplosion.h"
|
#include "CExplosion.h"
|
||||||
// New
|
// New
|
||||||
@ -29,9 +51,27 @@
|
|||||||
#include "CCarAI.h"
|
#include "CCarAI.h"
|
||||||
#include "CCarCtrl.h"
|
#include "CCarCtrl.h"
|
||||||
#include "CCarEnterExit.h"
|
#include "CCarEnterExit.h"
|
||||||
|
#include "CHeli.h"
|
||||||
|
|
||||||
//Misc
|
//Misc
|
||||||
#include "CCheat.h"
|
#include "CCheat.h"
|
||||||
|
#include "CCoronas.h"
|
||||||
|
#include "CPickup.h"
|
||||||
|
#include "CPickups.h"
|
||||||
|
#include "CWeather.h"
|
||||||
|
#include "CCheckpoints.h"
|
||||||
|
#include "CGarages.h"
|
||||||
|
|
||||||
|
//Test
|
||||||
|
#include "CGame.h"
|
||||||
|
#include "CWaterLevel.h"
|
||||||
|
#include "CWeather.h"
|
||||||
|
|
||||||
|
// Radio Test
|
||||||
|
#include "CAERadioTrackManager.h"
|
||||||
|
#include "CAudioEngine.h"
|
||||||
|
// I can disable the radio and change its type using this
|
||||||
|
#include "CAEVehicleAudioEntity.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -47,51 +87,30 @@
|
|||||||
#include "utils/util.h"
|
#include "utils/util.h"
|
||||||
#include "pages/ped.h"
|
#include "pages/ped.h"
|
||||||
|
|
||||||
|
// My code
|
||||||
|
#include "test_vehicle.h"
|
||||||
|
#include "test_hud.h"
|
||||||
|
#include "test_ped.h"
|
||||||
|
#include "test_world.h"
|
||||||
|
#include "functions/player_functions.h"
|
||||||
|
#include "functions/vehicle_functions.h"
|
||||||
|
|
||||||
// Well I had this working but then broke it 6-14-2024 @ 3:51PM...
|
// Well I had this working but then broke it 6-14-2024 @ 3:51PM...
|
||||||
// I fixed it 3:53PM.
|
// I fixed it 3:53PM.
|
||||||
|
|
||||||
|
// TODO Fix this to use translations from the English.toml file instead of hardcoding the values.
|
||||||
|
// TODO Seperate these out into multiple tabs within my test tab, so have a Player, Vehicle, Sounds, World, Misc, Test Features and more tabs.
|
||||||
|
|
||||||
TestPage& testPage = TestPage::Get();
|
TestPage& testPage = TestPage::Get();
|
||||||
TestPage::TestPage()
|
TestPage::TestPage()
|
||||||
: IPage<TestPage>(ePageID::Test, "Window.TestPage", true) {
|
: IPage<TestPage>(ePageID::Test, "Window.TestPage", true) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//void TestPage::VehicleTest() {
|
// Booleans
|
||||||
// // These are neat, the BY_GAME defines seem to have everything in this order: SA, VC, 3.
|
bool test = false;
|
||||||
// // This is under defines.h
|
bool enterCrane = false;
|
||||||
// CVehicle* pVeh = BY_GAME(FindPlayerVehicle(-1, false), FindPlayerVehicle(), FindPlayerVehicle());
|
bool toggleRadio = true;
|
||||||
// int hVeh = CPools::GetVehicleRef(pVeh);
|
|
||||||
//
|
|
||||||
// // If the player is in a vehicle.
|
|
||||||
// if (pVeh)
|
|
||||||
// {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // There is a lot of these on the sanny builder website.
|
|
||||||
// //
|
|
||||||
// // Car, TireId (int)
|
|
||||||
// // https://library.sannybuilder.com/#/sa/default/04FE
|
|
||||||
// //Command<Commands::BURST_CAR_TYRE>(hVeh, 1);
|
|
||||||
//
|
|
||||||
// // Get car speed
|
|
||||||
// // https://library.sannybuilder.com/#/sa/default/02E3
|
|
||||||
// //
|
|
||||||
// // Car
|
|
||||||
// //Command<Commands::GET_CAR_SPEED>(hVeh);
|
|
||||||
//
|
|
||||||
// // Lock car doors
|
|
||||||
// // https://library.sannybuilder.com/#/sa/default/020A
|
|
||||||
// // Will this work?
|
|
||||||
// //Command<Commands::LOCK_CAR_DOORS>(hVeh);
|
|
||||||
//
|
|
||||||
// // Explode
|
|
||||||
// // https://library.sannybuilder.com/#/sa/default/020B
|
|
||||||
// //
|
|
||||||
// //Command<Commands::EXPLODE_CAR>(hVeh);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
|
|
||||||
//void TestPage::PlayerTest() {
|
//void TestPage::PlayerTest() {
|
||||||
// CPlayerPed* player = FindPlayerPed();
|
// CPlayerPed* player = FindPlayerPed();
|
||||||
@ -100,9 +119,58 @@ TestPage::TestPage()
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Train test functions.
|
||||||
|
/// </summary>
|
||||||
|
static void TrainTestMenu()
|
||||||
|
{
|
||||||
|
|
||||||
|
ImGui::Text("Train testing.");
|
||||||
|
// This works.
|
||||||
|
if (ImGui::Button("Are you in a train?"))
|
||||||
|
{
|
||||||
|
if (PlayerFunctions::IsPlayerInTrain())
|
||||||
|
{
|
||||||
|
Util::SetMessage("You are in a train.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Util::SetMessage("You are not in a train.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PlayerTestFeatures()
|
void PlayerTestFeatures()
|
||||||
{
|
{
|
||||||
CPlayerPed* player = FindPlayerPed();
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
|
||||||
|
// Not sure how to get the garage id.
|
||||||
|
// TODO
|
||||||
|
//
|
||||||
|
// Work on messing with garages
|
||||||
|
// https://library.sannybuilder.com/#/sa/classes/Garage
|
||||||
|
//
|
||||||
|
// Work on adding objects using code
|
||||||
|
// Add pickups such as money, health, mines, bombs.
|
||||||
|
//
|
||||||
|
// Get, add to and decrement stats.
|
||||||
|
// https://library.sannybuilder.com/#/sa/classes/Stat
|
||||||
|
// https://gtamods.com/wiki/List_of_statistics_(SA)
|
||||||
|
|
||||||
|
// Mess around with tasks
|
||||||
|
// https://library.sannybuilder.com/#/sa/classes/Task
|
||||||
|
|
||||||
|
// Weather
|
||||||
|
// https://library.sannybuilder.com/#/sa/classes/Weather
|
||||||
|
|
||||||
|
// World
|
||||||
|
// https://library.sannybuilder.com/#/sa/classes/World
|
||||||
|
|
||||||
|
// Zone
|
||||||
|
// https://library.sannybuilder.com/#/sa/classes/Zone
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int hplayer = CPools::GetPedRef(player);
|
int hplayer = CPools::GetPedRef(player);
|
||||||
CVehicle* pVeh = nullptr;
|
CVehicle* pVeh = nullptr;
|
||||||
CVector pos = player->GetPosition();
|
CVector pos = player->GetPosition();
|
||||||
@ -111,135 +179,60 @@ void PlayerTestFeatures()
|
|||||||
|
|
||||||
void TestPage::Draw()
|
void TestPage::Draw()
|
||||||
{
|
{
|
||||||
|
// I am testing moving everything from static to not using static.
|
||||||
|
#ifdef _TEST
|
||||||
|
// Init for the menu
|
||||||
|
WorldTestPage* worldTestPage = new WorldTestPage();
|
||||||
|
HudTestPage* hudTestPage = new HudTestPage();
|
||||||
|
PedTestPage* pedTestPage = new PedTestPage();
|
||||||
|
VehicleTestPage* vehicleTestPage = new VehicleTestPage();
|
||||||
|
|
||||||
|
// Misc items
|
||||||
|
#ifdef GTASA
|
||||||
|
CAERadioTrackManager* cAERadioTrackManager = new CAERadioTrackManager();
|
||||||
|
CAudioEngine* cAudioEngine = new CAudioEngine();
|
||||||
|
CAEVehicleAudioEntity* cAEVehicleAudioEntity = new CAEVehicleAudioEntity();
|
||||||
|
#endif // GTASA
|
||||||
|
#endif //_TEST
|
||||||
CPlayerPed* player = FindPlayerPed();
|
CPlayerPed* player = FindPlayerPed();
|
||||||
//ImGui::BeginChild("Test");
|
//ImGui::BeginChild("Test");
|
||||||
|
|
||||||
|
// Test
|
||||||
|
ImGui::Text("Hello from KCNet");
|
||||||
|
|
||||||
if (ImGui::BeginTabBar("Test", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
if (ImGui::BeginTabBar("Test", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
if (ImGui::BeginTabItem(TEXT("Test.TestVehicle")))
|
if (ImGui::BeginTabItem(TEXT("Test.TestVehicle")))
|
||||||
{
|
{
|
||||||
|
// This works for seperating out the menus!
|
||||||
|
// 6-15-2024 @ 2:05PM
|
||||||
|
//ImGui::Text("Hello from KCNet");
|
||||||
ImGui::Text("Vehicle Tab");
|
ImGui::Text("Vehicle Tab");
|
||||||
//static int selected = Locale::GetCurrentLocaleIndex();
|
vehicleTestPage->VehicleTestMenu();
|
||||||
//static std::vector<std::string>& vec = Locale::GetLocaleList();
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Text("Hello from KCNet");
|
// TEXT(Test.TestPlayerMenu) - Test Player Menu
|
||||||
if (ImGui::Button("Blow up Car"))
|
if (ImGui::BeginTabItem("Player"))
|
||||||
{
|
{
|
||||||
#ifdef GTASA
|
// Incomplete
|
||||||
//CPlayerPed* player = FindPlayerPed();
|
#ifdef _TEST
|
||||||
int hplayer = CPools::GetPedRef(player);
|
pedTestPage->PlayerTestMenu();
|
||||||
CVehicle* pVeh = nullptr;
|
#else
|
||||||
|
PedTestPage::PlayerTestMenu();
|
||||||
|
#endif //_TEST
|
||||||
|
|
||||||
|
|
||||||
// This actually does work.
|
// This is needed, I think it should fix a crash.
|
||||||
bool bInVehicle = Command<Commands::IS_CHAR_IN_ANY_CAR>(hplayer);
|
|
||||||
if (bInVehicle)
|
|
||||||
{
|
|
||||||
CVehicle* pVeh = player->m_pVehicle;
|
|
||||||
int hVeh = CPools::GetVehicleRef(pVeh);
|
|
||||||
Command<Commands::EXPLODE_CAR>(hVeh);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::Button("Close doors"))
|
|
||||||
{
|
|
||||||
#ifdef GTASA
|
|
||||||
|
|
||||||
int hplayer = CPools::GetPedRef(player);
|
|
||||||
CVehicle* pVeh = nullptr;
|
|
||||||
|
|
||||||
bool bInVehicle = Command<Commands::IS_CHAR_IN_ANY_CAR>(hplayer);
|
|
||||||
if (bInVehicle)
|
|
||||||
{
|
|
||||||
CVehicle* pVeh = player->m_pVehicle;
|
|
||||||
int hVeh = CPools::GetVehicleRef(pVeh);
|
|
||||||
Command<Commands::CLOSE_ALL_CAR_DOORS>(hVeh);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// This works for locking the car doors.
|
|
||||||
if (ImGui::Button("Lock doors"))
|
|
||||||
{
|
|
||||||
#ifdef GTASA
|
|
||||||
|
|
||||||
int hplayer = CPools::GetPedRef(player);
|
|
||||||
CVehicle* pVeh = nullptr;
|
|
||||||
|
|
||||||
bool bInVehicle = Command<Commands::IS_CHAR_IN_ANY_CAR>(hplayer);
|
|
||||||
if (bInVehicle)
|
|
||||||
{
|
|
||||||
CVehicle* pVeh = player->m_pVehicle;
|
|
||||||
int hVeh = CPools::GetVehicleRef(pVeh);
|
|
||||||
bool isCarLocked = Command<Commands::GET_CAR_DOOR_LOCK_STATUS>(hVeh);
|
|
||||||
//bool isCarLocked = player->m_pVehicle->m_eDoorLock;
|
|
||||||
|
|
||||||
// https://library.sannybuilder.com/#/sa/default/020A
|
|
||||||
// https://library.sannybuilder.com/#/sa/enums/CarLock
|
|
||||||
if (!isCarLocked)
|
|
||||||
{
|
|
||||||
// 2 - Locked
|
|
||||||
Command<Commands::LOCK_CAR_DOORS>(hVeh, 2);
|
|
||||||
Util::SetMessage("Car has been locked!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 1 - Unlocked
|
|
||||||
Command<Commands::LOCK_CAR_DOORS>(hVeh, 1);
|
|
||||||
Util::SetMessage("Car has been unlocked!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// I wonder how to get the last vehicle the player was in to unlock it.
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
//}
|
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginTabItem(TEXT("Test.TestFeatures")))
|
if (ImGui::BeginTabItem(TEXT("Test.TestFeatures")))
|
||||||
{
|
{
|
||||||
if (ImGui::Button("Suicide"))
|
// Incomplete
|
||||||
{
|
/*PedTestPage::PlayerTestMenu();*/
|
||||||
//CPlayerPed* player = FindPlayerPed();
|
|
||||||
int hplayer = CPools::GetPedRef(player);
|
|
||||||
Command<Commands::EXPLODE_CHAR_HEAD>(hplayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::Button("Bomb")) {
|
|
||||||
CPlayerPed* player = FindPlayerPed();
|
|
||||||
int hplayer = CPools::GetPedRef(player);
|
|
||||||
|
|
||||||
CVector playerPos = player->GetPosition();
|
|
||||||
|
|
||||||
// https://library.sannybuilder.com/#/sa/default/020C
|
|
||||||
// x, y, z, EXPLOSION_CAR
|
|
||||||
Command<Commands::ADD_EXPLOSION>(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::Button("Show coords"))
|
|
||||||
{
|
|
||||||
CVector playerCoords = player->GetPosition();
|
|
||||||
//std::string text = std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " + std::to_string(pos.z);
|
|
||||||
//int playerX = playerCoords.x;
|
|
||||||
//int playerY = playerCoords.y;
|
|
||||||
//int playerZ = playerCoords.z;
|
|
||||||
|
|
||||||
std::string playerX = std::to_string(playerCoords.x);
|
|
||||||
std::string playerY = std::to_string(playerCoords.y);
|
|
||||||
std::string playerZ = std::to_string(playerCoords.z);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// This works for showing just the X coord, I cannot concatenate these values though
|
|
||||||
//Util::SetMessage(playerXChar);
|
|
||||||
// Taken idea from freecam_sa.cpp on line 156
|
|
||||||
// This works!!
|
|
||||||
// 6-14-2024 @ 2:34PM
|
|
||||||
Util::SetMessage(std::format("X: {} Y: {} Z: {}", playerX, playerY, playerZ).c_str());
|
|
||||||
//Util::SetMessage("X: " + playerXChar + " Y: " + playerYChar + " Z: " + playerZChar);
|
|
||||||
}
|
|
||||||
|
|
||||||
//if (ImGui::Button("Show Marker Coords"))
|
//if (ImGui::Button("Show Marker Coords"))
|
||||||
//{
|
//{
|
||||||
@ -253,195 +246,157 @@ void TestPage::Draw()
|
|||||||
// //Command<Commands::BLIP>(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR);
|
// //Command<Commands::BLIP>(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR);
|
||||||
|
|
||||||
//}
|
//}
|
||||||
|
//ImGui::Columns(2, NULL, false);
|
||||||
|
|
||||||
if (ImGui::Button("Blow up all cars")) {
|
|
||||||
#ifdef GTASA
|
#ifdef GTASA
|
||||||
CCheat::BlowUpCarsCheat();
|
//ImGui::NextColumn();
|
||||||
Util::SetMessage("All cars have been exterminated!");
|
// https://github.com/JuniorDjjr/CLEOPlus/blob/main/CLEOPlus/Misc.cpp#L261-L266
|
||||||
#else
|
// reinterpret_cast<CRunningScript*>(thread)->UpdateCompareFlag(CCheat::m_aCheatsActive[i]);
|
||||||
Util::SetMessage("Only works for SA!");
|
|
||||||
#endif
|
|
||||||
|
// I wonder how to spawn a different pickup
|
||||||
|
if (ImGui::Button("Health pickup"))
|
||||||
|
{
|
||||||
|
CVector playerPos = player->GetPosition();
|
||||||
|
int playerX = playerPos.x;
|
||||||
|
int playerY = playerPos.y;
|
||||||
|
int playerZ = playerPos.z;
|
||||||
|
|
||||||
|
// Needs some more arguments.
|
||||||
|
//CPickup::GiveUsAPickUpObject(CObject::, -1);
|
||||||
|
//CPickups::CreatePickupCoorsCloseToCoors(playerPos.x, playerPos.y, playerPos.z);
|
||||||
|
}
|
||||||
|
//ImGui::SameLine();
|
||||||
|
|
||||||
|
ImGui::Text("Spawn 50k near your position");
|
||||||
|
if (ImGui::Button("Money pickup"))
|
||||||
|
{
|
||||||
|
CVector playerPos = player->GetPosition();
|
||||||
|
CVector newPos = CVector(playerPos.x + 3, playerPos.y + 3, playerPos.z);
|
||||||
|
|
||||||
|
CPickups::CreateSomeMoney(newPos, 50000);
|
||||||
|
Util::SetMessage("You have spawned 50k near you!");
|
||||||
|
}
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
// Not sure how these work.
|
||||||
|
// https://library.sannybuilder.com/#/sa/classes/Crane
|
||||||
|
if (ImGui::Checkbox("Enter Crane", &enterCrane))
|
||||||
|
{
|
||||||
|
if (enterCrane)
|
||||||
|
{
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/079D
|
||||||
|
Command<Commands::PLAYER_ENTERED_DOCK_CRANE>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/079F
|
||||||
|
Command<Commands::PLAYER_LEFT_CRANE>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (ImGui::Button("Spawn ped to attack vehicle"))
|
// This works
|
||||||
|
if (ImGui::Button("Play Mission Passed"))
|
||||||
|
{
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/0394
|
||||||
|
|
||||||
|
Command<Commands::PLAY_MISSION_PASSED_TUNE>(1);
|
||||||
|
//bool isFlyingActive = CCheat::m_aCheatsActive);
|
||||||
|
//Util::SetMessage(std::format("Is Flying Active: {}", isFlyingActive).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move into vehicle functions.
|
||||||
|
if (ImGui::Button("Current Radio Station"))
|
||||||
|
{
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
bool bInVehicle = Command<Commands::IS_CHAR_IN_ANY_CAR>(hplayer);
|
||||||
|
|
||||||
|
if (bInVehicle) {
|
||||||
|
CVehicle* pVeh = player->m_pVehicle;
|
||||||
|
if (cAERadioTrackManager->IsVehicleRadioActive())
|
||||||
|
{
|
||||||
|
// How would I set this to get the current radio station?
|
||||||
|
// I'll just use the command version of it for now instead of the cAERadioTrackManager
|
||||||
|
|
||||||
|
|
||||||
|
// Wow this works fine, I noticed the method was using char* so I decided to put it into it's own field.
|
||||||
|
const char* currentRadioStationName = cAERadioTrackManager->GetRadioStationName(cAudioEngine->GetCurrentRadioStationID());
|
||||||
|
//int radioChannel = 0;
|
||||||
|
//Command<Commands::GET_RADIO_CHANNEL>();
|
||||||
|
|
||||||
|
//Util::SetMessage(cAERadioTrackManager->GetRadioStationName(Command<Commands::GET_RADIO_CHANNEL>()));
|
||||||
|
// This works!! I figured it out
|
||||||
|
// 6-17-2024 @ 12:27AM
|
||||||
|
//Util::SetMessage(cAERadioTrackManager->GetRadioStationName(cAudioEngine->GetCurrentRadioStationID()));
|
||||||
|
Util::SetMessage(currentRadioStationName);
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//////
|
||||||
|
// New
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
ImGui::Text("In game clock");
|
||||||
|
|
||||||
|
|
||||||
|
//if (ImGui::Button("Show mili Seconds?"))
|
||||||
//{
|
//{
|
||||||
// Util::SetMessage("Not setup!");
|
// short currentGameSeconds = CClock::ms_nGameClockSeconds;
|
||||||
|
// Util::SetMessage(std::format("ms {}", currentGameSeconds).c_str());
|
||||||
//}
|
//}
|
||||||
|
|
||||||
/*
|
if (ImGui::Button("Show hours"))
|
||||||
if (ImGui::CollapsingHeader("Spawner"))
|
|
||||||
{
|
{
|
||||||
// PedPage::AddNewPed
|
short currentGameHours = CClock::ms_nGameClockHours;
|
||||||
// This doesn't work yet.
|
Util::SetMessage(std::format("Hour: {}", currentGameHours).c_str());
|
||||||
//#define _DISABLED_CODE
|
|
||||||
#ifdef _DISABLED_CODE
|
|
||||||
static char name[8];
|
|
||||||
static int model = 0;
|
|
||||||
ImGui::InputTextWithHint(TEXT("Menu.Name"), "PEDNAME", name, 7);
|
|
||||||
Widget::InputInt(TEXT("Ped.Model"), &model, 0, 999999);
|
|
||||||
ImGui::Spacing();
|
|
||||||
ImVec2 sz = Widget::CalcSize(2);
|
|
||||||
if (ImGui::Button(TEXT("Ped.AddPed"), sz))
|
|
||||||
{
|
|
||||||
Command<Commands::REQUEST_MODEL>(model);
|
|
||||||
Command<Commands::LOAD_ALL_MODELS_NOW>();
|
|
||||||
if (Command<Commands::IS_MODEL_AVAILABLE>(model))
|
|
||||||
{
|
|
||||||
std::string key = std::format("Custom.{} (Added)", name);
|
|
||||||
// This part doesn't want to work.
|
|
||||||
//m_PedData.m_pData->Set(key.c_str(), std::to_string(model));
|
|
||||||
pedPage.m_PedData.m_pData->Set(key.c_str(), std::to_string(model));
|
|
||||||
pedPage.m_PedData.m_pData->Save();
|
|
||||||
//
|
|
||||||
Util::SetMessage(TEXT("Ped.AddPedMSG"));
|
|
||||||
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(model);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Util::SetMessage(TEXT("Vehicle.InvalidID"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
if (ImGui::Button(TEXT("Ped.GetPlayerModel"), sz))
|
|
||||||
{
|
|
||||||
model = FindPlayerPed()->m_nModelIndex;
|
|
||||||
}
|
|
||||||
#endif //_DISABLED_CODE
|
|
||||||
//
|
|
||||||
|
|
||||||
// https://library.sannybuilder.com/#/sa/default/0672
|
|
||||||
//Command<Commands::TASK_DESTROY_CAR>(pPed);
|
|
||||||
|
|
||||||
} //End
|
|
||||||
//ImGui::EndChild();
|
|
||||||
|
|
||||||
*
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button("Show Minutes"))
|
||||||
// This seems to work for printing text, idea came from imgui_demo.cpp line 5819
|
|
||||||
static char text[64] = "text";
|
|
||||||
static int bufTest[2];
|
|
||||||
|
|
||||||
if(ImGui::InputText("Test", text, IM_ARRAYSIZE(text)))
|
|
||||||
|
|
||||||
// Not sure how to get this to work
|
|
||||||
//if (ImGui::InputInt("Clock", bufTest, IM_ARRAYSIZE(bufTest)))
|
|
||||||
{
|
{
|
||||||
//CClock::ms_nGameClockHours = hours;
|
short currentGameMinutes = CClock::ms_nGameClockMinutes;
|
||||||
//CClock::SetGameClock(hours)
|
Util::SetMessage(std::format("Minute: {}", currentGameMinutes).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Button("Print Text"))
|
// Train Menu
|
||||||
{
|
TrainTestMenu();
|
||||||
Util::SetMessage(text);
|
//////
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Text("Test Items");
|
// Clothes
|
||||||
//CWorld::
|
|
||||||
|
#endif
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
ImGui::EndTabItem();
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//ImGui::EndChild();
|
|
||||||
|
|
||||||
ImGui::EndTabBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Hud menu and Hud functions.
|
||||||
|
// Comment out this define if this crashes.
|
||||||
// This doesn't do anything yet, I would like to add a custom tab to the Cheat menu
|
#ifdef _TEST
|
||||||
|
if (ImGui::BeginTabItem("Hud")) {
|
||||||
|
hudTestPage->HudTestMenu();
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
HudTestPage::HudTestMenu();
|
||||||
#endif //_TEST
|
#endif //_TEST
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DISABLED_CODE
|
// World Menu & World Functions
|
||||||
// These weren't needed, leaving here for future reference.
|
#ifdef _TEST
|
||||||
// //////////////
|
|
||||||
// https://www.geeksforgeeks.org/convert-string-char-array-cpp/
|
if (ImGui::BeginTabItem("World")) {
|
||||||
//const char* playerXChar = playerX.c_str();
|
worldTestPage->WorldTestMenu();
|
||||||
//const char* playerYChar = playerY.c_str();
|
ImGui::EndTabItem();
|
||||||
//const char* playerZChar = playerZ.c_str();
|
// Use original code.
|
||||||
//const char* playerXTest = static_cast<char>(char_array);
|
#else
|
||||||
|
WorldTestPage::WorldTestMenu();
|
||||||
//https://www.tutorialspoint.com/How-to-convert-an-std-string-to-const-char-or-char-in-Cplusplus
|
#endif //TEST
|
||||||
//const char* test = new char[playerCoords.x];
|
|
||||||
//
|
|
||||||
|
|
||||||
//https://cplusplus.com/forum/general/268793/
|
|
||||||
//const char* s = new[std::strlen(playerXChar) + std::strlen(playerYChar) + 1];
|
|
||||||
|
|
||||||
//https://stackoverflow.com/questions/347949/how-to-convert-a-stdstring-to-const-char-or-char
|
|
||||||
//
|
|
||||||
//const char* playerMessage = std::to_string(playerCoords.x) + ", " + std::to_string(playerCoords.y) + ", " + std::to_string(playerCoords.z);
|
|
||||||
//const char* playerMessage = std::to_string(playerXChar) + ", " + std::to_string(playerCoords.y) + ", " + std::to_string(playerCoords.z);
|
|
||||||
//const char* playerMessage(test);
|
|
||||||
|
|
||||||
|
|
||||||
//Util::SetMessage("X: " + *playerXChar);
|
|
||||||
//Util::SetMessage(std::to_string(playerCoords.x));
|
|
||||||
//Util::SetMessage(playerMessage);
|
|
||||||
//////////////////
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Old
|
|
||||||
/*
|
|
||||||
if (ImGui::BeginTabBar("Test", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
|
||||||
{
|
|
||||||
if (ImGui::BeginTabItem(TEXT("Test.TestVehicle")))
|
|
||||||
{
|
|
||||||
ImGui::Text("Vehicle Tab");
|
|
||||||
//static int selected = Locale::GetCurrentLocaleIndex();
|
|
||||||
//static std::vector<std::string>& vec = Locale::GetLocaleList();
|
|
||||||
|
|
||||||
ImGui::Text("Hello from KCNet");
|
|
||||||
//}
|
|
||||||
ImGui::EndTabItem();
|
|
||||||
}
|
}
|
||||||
|
ImGui::EndTabBar();
|
||||||
if (ImGui::BeginTabItem(TEXT("Test.TestFeatures")))
|
}
|
||||||
{
|
|
||||||
ImGui::Text("Test Features");
|
}
|
||||||
// ImGui::Text("Test Features");
|
#endif //_TEST
|
||||||
// //if (ImGui::BeginChild("CommandsChild"))
|
|
||||||
// //{
|
|
||||||
// // ImGui::Text("Hello from KCNet");
|
|
||||||
// // //
|
|
||||||
// // //if (ImGui::CollapsingHeader(TEXT("Menu.QuickVehSpawnerCMD")))
|
|
||||||
// // //{
|
|
||||||
// // // ImGui::Spacing();
|
|
||||||
// // // ImGui::TextWrapped(TEXT("Menu.QuickVehSpawnerCMDText"));
|
|
||||||
// // // ImGui::Spacing();
|
|
||||||
// // // ImGui::Separator();
|
|
||||||
// // //}
|
|
||||||
// // //if (ImGui::CollapsingHeader(TEXT("Menu.QuickWepSpawnerCMD")))
|
|
||||||
// // //{
|
|
||||||
// // // ImGui::Spacing();
|
|
||||||
// // // ImGui::TextWrapped(TEXT("Menu.QuickWepSpawnerCMDText"));
|
|
||||||
// // // ImGui::Spacing();
|
|
||||||
// // // ImGui::Separator();
|
|
||||||
//}
|
|
||||||
// // //
|
|
||||||
|
|
||||||
|
|
||||||
ImGui::EndChild();
|
|
||||||
ImGui::EndTabItem();
|
|
||||||
ImGui::EndTabBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
// Get config data
|
|
||||||
/*
|
|
||||||
Events::initGameEvent += [this]()
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif //_DISABLED_CODE
|
|
||||||
|
@ -21,5 +21,3 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern TestPage& testPage;
|
extern TestPage& testPage;
|
||||||
|
|
||||||
// This doesn't do anything yet, I would like to add a custom tab to the Cheat menu
|
|
145
src/test/test_garage.cpp
Normal file
145
src/test/test_garage.cpp
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "test_garage.h"
|
||||||
|
#include "functions/misc_functions.h"
|
||||||
|
|
||||||
|
#ifdef GTASA
|
||||||
|
#endif //GTASA
|
||||||
|
|
||||||
|
/*
|
||||||
|
File created by kelson8
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These values came from below:
|
||||||
|
* https://wiki.multitheftauto.com/wiki/Garage
|
||||||
|
*
|
||||||
|
"Life's a Beach" Mission Garage (Commerce) 1643.43, -1520.3, 14.3438
|
||||||
|
1 LSPD Police Impound Garage (not working) -
|
||||||
|
2 "Los Desperados" Mission Garage (El Corona) 1877.41, -2096.51, 14.0391
|
||||||
|
3 Eight Ball Autos (El Corona) 1843.37, -1856.32, 13.875
|
||||||
|
4 "Cesar Vialpando" Mission Garage (El Corona) 1798.69, -2146.73, 14
|
||||||
|
5 Player Garage (El Corona) 1698.91, -2088.74, 14.1406
|
||||||
|
6 LS Burglary Garage (Playe del Seville) 2741.07, -2004.78, 14.875
|
||||||
|
7 LowRider Tuning Garage (Willowfield) 2644.86, -2039.23, 14.0391
|
||||||
|
8 Pay 'n' Spray (Idlewood) 2071.48, -1831.42, 14.5625
|
||||||
|
9 Player Garage (Ganton) 2505.52, -1690.99, 14.3281
|
||||||
|
10 Transfender (Temple) 1041.35, -1025.93, 32.6719
|
||||||
|
11 Pay 'n' Spray (Temple) 1024.98, -1029.35, 33.1953
|
||||||
|
12 Pay 'n' Spray (Santa Maria Beach) 488.28, -1734.7, 12.3906
|
||||||
|
13 Player Garage (Santa Maria Beach) 322.4141, -1769.0312, 5.25
|
||||||
|
14 Player Garage (Mulholland)* 1353.48, -626.63, 109.82
|
||||||
|
15 Wheel Archangels (Ocean Flats) -2716.35, 217.48, 5.3828
|
||||||
|
16 "T-Bone Mendez" Mission Garage (Ocean Flats) -2730.47, 72.32, 5.3516
|
||||||
|
17 Player Garage (Hashbury) -2454.12, -123.06, 26.9844
|
||||||
|
18 Transfender (Doherty) -1935.86, 239.53, 35.3516
|
||||||
|
19 Pay 'n' Spray (Downtown) -1904.53, 277.9, 42.9531
|
||||||
|
20 SF Burglary Garage (Doherty) -2102.93, -16.05, 36.4844
|
||||||
|
21 Player Garage (Doherty) -2026.91, 129.41, 30.4531
|
||||||
|
22 Mission Garage (Doherty) -2038.93, 178.81, 29.9375
|
||||||
|
23 "Ran Fa Li" Mission Garage (Chinatown) -2162.03, 654.66, 53.375
|
||||||
|
24 Michelle's Pay 'n' Spray (Downtown) -1786.81, 1209.42, 25.8359
|
||||||
|
25 Player Garage (Calton Heights) -2105.2, 896.93, 77.4453
|
||||||
|
26 SFPD Police Impound Garage (not working) -
|
||||||
|
27 Pay 'n' Spray (Juniper Hollow) -2425.73, 1027.99, 52.2812
|
||||||
|
28 Player Garage (Paradiso) -2696.01, 821.45, 50.8516
|
||||||
|
29 LVPD Police Impound Garage (not working) -
|
||||||
|
30 Airport Hangar (Las Venturas Airport) 1586.26, 1222.7, 19.75
|
||||||
|
31 LV Burglary Garage (Pilgrim) 2609.52, 1438.37, 11.5938
|
||||||
|
32 Pay 'n' Spray (Royal Casino) (not working) -
|
||||||
|
33 Transfender (Come-A-Lot) 2386.66, 1043.6, 11.5938
|
||||||
|
34 Player Garage (Rockshore West) 2449.55, 698.08, 11.6797
|
||||||
|
35 Welding Wedding Bomb-workshop [front] (Redsands East) 2006, 2303.73, 11.3125
|
||||||
|
Welding Wedding Bomb-workshop [back] (Redsands East) 2006, 2317.6, 11.3125
|
||||||
|
|
||||||
|
36 Pay 'n' Spray (Redsands East) 1968.74, 2162.49, 12.0938
|
||||||
|
37 Player Garage (Redsands West) 1408.64, 1902.69, 11.6797
|
||||||
|
38 Player Garage (Prickle Pine) 1278.7, 2529.81, 11.3203
|
||||||
|
39 Player Garage (Whitewood Estates) 929.55, 2012.06, 11.6797
|
||||||
|
40 Pay 'n' Spray (El Quebrados) -1420.55, 2591.16, 57.7422
|
||||||
|
41 Pay 'n' Spray (Fort Carson) -100, 1111.41, 21.6406
|
||||||
|
42 Player Garage (Fort Carson) -360.77, 1194.26, 20.5938
|
||||||
|
43 Player Garage (Verdant Meadows) 429.98, 2546.52, 17.3516
|
||||||
|
44 "Interdiction" Mission Garage (El Castillo del Diablo)* -389.59, 2227.91, 42.9219
|
||||||
|
45 Airport Hangar [right] (Verdant Meadows)
|
||||||
|
Airport Hangar [left] (Verdant Meadows)
|
||||||
|
397.48, 2476.63, 19.5156
|
||||||
|
412.12, 2476.63, 19.5156
|
||||||
|
46 "Puncture Wounds" Mission Garage (Angel Pine)* -2113.04, -2460.62, 30.9141
|
||||||
|
47 Pay 'n' Spray (Dillimore) 720.02, -462.52, 16.8594
|
||||||
|
48 Player Garage (Palomino Creek) 2231.24, 168.73, 27.7734
|
||||||
|
49 Player Garage (Dillimore)
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum GarageList
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GarageTestPage::GarageTestPage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef GTASA
|
||||||
|
void GarageTestPage::GarageMenu()
|
||||||
|
{
|
||||||
|
|
||||||
|
// This didn't seem to work.
|
||||||
|
ImGui::Text("Ganton Garage");
|
||||||
|
if (ImGui::Button("Open"))
|
||||||
|
{
|
||||||
|
//if(MiscFunctions::IsGarageClosed(9))
|
||||||
|
//{
|
||||||
|
MiscFunctions::OpenGarage(9);
|
||||||
|
Util::SetMessage("Garage opened");
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Close"))
|
||||||
|
{
|
||||||
|
//if (MiscFunctions::IsGarageOpen(9)) {
|
||||||
|
MiscFunctions::CloseGarage(9);
|
||||||
|
Util::SetMessage("Garage closed");
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Activate"))
|
||||||
|
{
|
||||||
|
MiscFunctions::ActivateGarage(9);
|
||||||
|
Util::SetMessage("You have activated the garage");
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Deactivate"))
|
||||||
|
{
|
||||||
|
MiscFunctions::DeactivateGarage(9);
|
||||||
|
Util::SetMessage("You have deactivated the garage");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Seemed to not open the menu with these here
|
||||||
|
if (ImGui::Button("Is Closed?"))
|
||||||
|
{
|
||||||
|
if (MiscFunctions::IsGarageClosed(9)) {
|
||||||
|
Util::SetMessage("The garage is closed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button("Is Open?"))
|
||||||
|
{
|
||||||
|
if (MiscFunctions::IsGarageOpen(9)) {
|
||||||
|
Util::SetMessage("The garage is open");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //GTASA
|
||||||
|
|
||||||
|
// Drawing the menu
|
||||||
|
void GarageTestPage::GarageTestMenu()
|
||||||
|
{
|
||||||
|
GarageMenu();
|
||||||
|
}
|
9
src/test/test_garage.h
Normal file
9
src/test/test_garage.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
class GarageTestPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GarageTestPage();
|
||||||
|
void GarageTestMenu();
|
||||||
|
static void GarageMenu();
|
||||||
|
};
|
||||||
|
|
68
src/test/test_hud.cpp
Normal file
68
src/test/test_hud.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "test_hud.h"
|
||||||
|
|
||||||
|
bool toggleHud = true;
|
||||||
|
bool toggleRadar = true;
|
||||||
|
|
||||||
|
HudTestPage::HudTestPage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// GTA SA Specific memory addresses, will most likely crash 3 and vc.
|
||||||
|
// What are these doing? From scene.cpp on lines 172-177.
|
||||||
|
// Is Nop setting the value to zero? I think that is what it's doing.
|
||||||
|
// patch::Set<DWORD>(0x609A4E, 0x4D48689);
|
||||||
|
// patch::Set<WORD>(0x609A52, 0);
|
||||||
|
// patch::Nop(0x609A4E, 6);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// patch::Set
|
||||||
|
// patch::Set(Address, value, true);
|
||||||
|
#ifdef GTASA
|
||||||
|
|
||||||
|
static void ToggleRadarMenu()
|
||||||
|
{
|
||||||
|
if (ImGui::Checkbox("Toggle Radar", &toggleRadar))
|
||||||
|
{
|
||||||
|
// radarModeAddress = 0xBA676C
|
||||||
|
if (!toggleRadar)
|
||||||
|
{
|
||||||
|
patch::Set(0xBA676C, 2, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
patch::Set(0xBA676C, 0, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ToggleHudMenu()
|
||||||
|
{
|
||||||
|
if (ImGui::Checkbox("Toggle hud", &toggleHud))
|
||||||
|
{
|
||||||
|
// hudModeAddress = 0xBA6769;
|
||||||
|
if (!toggleHud)
|
||||||
|
{
|
||||||
|
patch::Set(0xBA6769, 0, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
patch::Set(0xBA6769, 1, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //GTASA
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Main code for HudTestMenu
|
||||||
|
/// </summary>
|
||||||
|
void HudTestPage::HudTestMenu()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
ToggleHudMenu();
|
||||||
|
ToggleRadarMenu();
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
12
src/test/test_hud.h
Normal file
12
src/test/test_hud.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
//#include "pch.h"
|
||||||
|
|
||||||
|
class HudTestPage
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
void Draw();
|
||||||
|
public:
|
||||||
|
HudTestPage();
|
||||||
|
HudTestPage(const HudTestPage&);
|
||||||
|
void HudTestMenu();
|
||||||
|
};
|
24
src/test/test_markers.cpp
Normal file
24
src/test/test_markers.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "test_markers.h"
|
||||||
|
|
||||||
|
static void CoronasMenu()
|
||||||
|
{
|
||||||
|
// Doesn't work
|
||||||
|
// if (ImGui::Button("Show corona"))
|
||||||
|
// {
|
||||||
|
// I wonder How I would use this?
|
||||||
|
// I would need to define it somehow
|
||||||
|
//CCorona
|
||||||
|
//CCoronas::RegisterCorona();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Main code for MarkersTestMenu
|
||||||
|
/// </summary>
|
||||||
|
void MarkersTestPage::MarkersTestMenu()
|
||||||
|
{
|
||||||
|
#ifdef _TEST
|
||||||
|
CoronasMenu();
|
||||||
|
#endif //_TEST
|
||||||
|
}
|
12
src/test/test_markers.h
Normal file
12
src/test/test_markers.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
//#include "pch.h"
|
||||||
|
|
||||||
|
class MarkersTestPage
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
MarkersTestPage();
|
||||||
|
MarkersTestPage(const MarkersTestPage&);
|
||||||
|
void Draw();
|
||||||
|
public:
|
||||||
|
static void MarkersTestMenu();
|
||||||
|
};
|
714
src/test/test_ped.cpp
Normal file
714
src/test/test_ped.cpp
Normal file
@ -0,0 +1,714 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "test_ped.h"
|
||||||
|
#include "utils/widget.h"
|
||||||
|
|
||||||
|
#ifdef GTASA
|
||||||
|
#include "CExplosion.h"
|
||||||
|
#include "CPopulation.h"
|
||||||
|
#include "CTaskComplexWanderStandard.h"
|
||||||
|
#include "CSprite.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// My code
|
||||||
|
#include "functions/player_functions.h"
|
||||||
|
#include "../enums/audio_ids.h"
|
||||||
|
#include "functions/vehicle_functions.h"
|
||||||
|
#include "functions/ped_functions.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Incomplete.
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/0672
|
||||||
|
//Command<Commands::TASK_DESTROY_CAR>(pPed);
|
||||||
|
|
||||||
|
// This might be fun to mess with if I can figure out how to use the stats
|
||||||
|
//player->m_pStats;
|
||||||
|
|
||||||
|
// Try to mess with the values in this enum and play sounds: eAudioEvents
|
||||||
|
|
||||||
|
|
||||||
|
PedTestPage::PedTestPage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool playerCanDrown = true;
|
||||||
|
|
||||||
|
//static std::vector<int> soundIds = {
|
||||||
|
AudioIds* audioIds = new AudioIds();
|
||||||
|
|
||||||
|
static std::vector<std::string> soundIds = {
|
||||||
|
std::to_string(AudioIds::BLANK_SOUND), std::to_string(AudioIds::CRASH_SOUND), std::to_string(AudioIds::GARAGE_DOOR_OPENING),
|
||||||
|
std::to_string(AudioIds::SELECTION_SOUND), std::to_string(AudioIds::METALLIC_FENCE_RATTLE1),
|
||||||
|
std::to_string(AudioIds::METALLIC_FENCE_RATTLE2), std::to_string(AudioIds::SPRAY_CAN),
|
||||||
|
std::to_string(AudioIds::CRASH1_SOUND), std::to_string(AudioIds::CRASH2_SOUND), std::to_string(AudioIds::THROW_SATCHEL_SOUND), std::to_string(AudioIds::CAR_HORN),
|
||||||
|
std::to_string(AudioIds::BLIP_SOUND), std::to_string(AudioIds::EXPLOSION_SOUND),
|
||||||
|
std::to_string(AudioIds::HANGER_DOORS), std::to_string(AudioIds::DRIVING_SCHOOL_RESULTS_MUSIC),
|
||||||
|
std::to_string(AudioIds::BIKE_BOAT_SCHOOL_RESULTS_MUSIC), std::to_string(AudioIds::FLIGHT_SCHOOL_RESULTS_MUSIC)
|
||||||
|
};
|
||||||
|
|
||||||
|
//static std::vector<int> soundIds = {
|
||||||
|
// BLANK_SOUND, CRASH_SOUND, GARAGE_DOOR_OPENING, SELECTION_SOUND,
|
||||||
|
// METALLIC_FENCE_RATTLE1, METALLIC_FENCE_RATTLE2, SPRAY_CAN,
|
||||||
|
// CRASH1_SOUND, CRASH2_SOUND, THROW_SATCHEL_SOUND, CAR_HORN,
|
||||||
|
// BLIP_SOUND, EXPLOSION_SOUND, HANGER_DOORS, DRIVING_SCHOOL_RESULTS_MUSIC,
|
||||||
|
// BIKE_BOAT_SCHOOL_RESULTS_MUSIC, FLIGHT_SCHOOL_RESULTS_MUSIC
|
||||||
|
//};
|
||||||
|
|
||||||
|
static void SuicideMenu()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
if (ImGui::Button("Suicide"))
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
Command<Commands::EXPLODE_CHAR_HEAD>(hplayer);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
// Why does this not have sound? I'm not using ADD_EXPLOSION_NO_SOUND
|
||||||
|
// I manually added an explosion using ADD_ONE_OFF_SOUND
|
||||||
|
static void BombMenu()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
//TODO Test these in the other games, 3 and vc later!
|
||||||
|
if (ImGui::Button("Bomb")) {
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
|
||||||
|
CVector playerPos = player->GetPosition();
|
||||||
|
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/020C
|
||||||
|
// x, y, z, EXPLOSION_CAR
|
||||||
|
Command<Commands::ADD_EXPLOSION>(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR);
|
||||||
|
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/018C
|
||||||
|
// These might work: https://sampwiki.blast.hk/wiki/SoundID
|
||||||
|
//
|
||||||
|
// Working
|
||||||
|
//Command<Commands::ADD_ONE_OFF_SOUND>(playerPos.x, playerPos.y, playerPos.z, AudioIds::EXPLOSION_SOUND);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
// This works like this.
|
||||||
|
PlayerFunctions::AddSoundOnPlayer(AudioIds::EXPLOSION_SOUND);
|
||||||
|
|
||||||
|
// This does about the same as above with a bit more code.
|
||||||
|
//CExplosion::AddExplosion(FindPlayerPed(), FindPlayerPed(), EXPLOSION_CAR, playerPos, 1000, 1, 1.0f, true);
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
static void TestSoundMenu()
|
||||||
|
{
|
||||||
|
// GTA SA specific sounds.
|
||||||
|
#ifdef GTASA
|
||||||
|
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
// New
|
||||||
|
|
||||||
|
#define _TEST
|
||||||
|
// Sound testing, incomplete.
|
||||||
|
#ifdef _TEST
|
||||||
|
// Set this to nothing
|
||||||
|
int defaultSoundType = 0;
|
||||||
|
static void SoundMenu()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
CVector playerPos = player->GetPosition();
|
||||||
|
ImGui::Text("Sound");
|
||||||
|
// Not sure how to get a list box to play each sound with a button under.
|
||||||
|
// This is complaining, I guess because I gave it an int instead of string.
|
||||||
|
|
||||||
|
// This doesn't seem to work
|
||||||
|
if (Widget::ListBox("Sounds", soundIds, defaultSoundType))
|
||||||
|
defaultSoundType = defaultSoundType;
|
||||||
|
//if (ImGui::ListBox("Sounds", soundIds, defaultSoundType))
|
||||||
|
{
|
||||||
|
if (ImGui::Button("Play sound")) {
|
||||||
|
Command<Commands::ADD_ONE_OFF_SOUND>(playerPos.x, playerPos.y, playerPos.z, defaultSoundType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This might work:
|
||||||
|
// https://stackoverflow.com/questions/10847237/how-to-convert-from-int-to-char
|
||||||
|
//const char* soundIdsChar = char(soundIds);
|
||||||
|
|
||||||
|
// Will these work? I think this is converting the int to a char.
|
||||||
|
// https://stackoverflow.com/questions/4254615/how-to-cast-vectorunsigned-char-to-char
|
||||||
|
//reinterpret_cast<char*> (soundIds[0]);
|
||||||
|
|
||||||
|
// Now to create a for loop
|
||||||
|
// Will this work for the int?
|
||||||
|
//for (int i = 0; i < soundIds.size(); i++)
|
||||||
|
//{
|
||||||
|
// const char* soundIdsChars = reinterpret_cast<char*> (soundIds[i]);
|
||||||
|
//
|
||||||
|
// if (Widget::ListBox("Sounds", soundIds, defaultSoundType))
|
||||||
|
// //if (ImGui::ListBox("Sounds", soundIds, defaultSoundType))
|
||||||
|
// {
|
||||||
|
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //_TEST
|
||||||
|
|
||||||
|
static void ShowCoordsMenu()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
if (ImGui::Button("Show coords"))
|
||||||
|
{
|
||||||
|
CVector playerCoords = player->GetPosition();
|
||||||
|
//std::string text = std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " + std::to_string(pos.z);
|
||||||
|
//int playerX = playerCoords.x;
|
||||||
|
//int playerY = playerCoords.y;
|
||||||
|
//int playerZ = playerCoords.z;
|
||||||
|
|
||||||
|
std::string playerX = std::to_string(playerCoords.x);
|
||||||
|
std::string playerY = std::to_string(playerCoords.y);
|
||||||
|
std::string playerZ = std::to_string(playerCoords.z);
|
||||||
|
|
||||||
|
// This works for showing just the X coord, I cannot concatenate these values though
|
||||||
|
//Util::SetMessage(playerXChar);
|
||||||
|
// Taken idea from freecam_sa.cpp on line 156
|
||||||
|
// This works!!
|
||||||
|
// 6-14-2024 @ 2:34PM
|
||||||
|
Util::SetMessage(std::format("X: {} Y: {} Z: {}", playerX, playerY, playerZ).c_str());
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ShowMarkerCoordsMenu()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
|
||||||
|
if (ImGui::Button("Show Marker Coords"))
|
||||||
|
{
|
||||||
|
Util::SetMessage("Not implemented yet!");
|
||||||
|
|
||||||
|
// if (Command<Commands::DOES_BLIP_EXIST>())
|
||||||
|
// {
|
||||||
|
// // Check if the target marker blip exists and print the coords if so, looks like this function is only available in cleo.
|
||||||
|
// // GET_TARGET_BLIP_COORDS
|
||||||
|
// //if()
|
||||||
|
// }
|
||||||
|
// //Command<Commands::BLIP>(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR);
|
||||||
|
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
Util::SetMessage("No markers in VC or 3!");
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
static void TogglePlayerDrownMenu()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
// This seems to work fine.
|
||||||
|
if (ImGui::Checkbox("Player drowns", &playerCanDrown))
|
||||||
|
{
|
||||||
|
int hPlayer = CPools::GetPedRef(player);
|
||||||
|
if (!playerCanDrown) {
|
||||||
|
Command<Commands::SET_CHAR_DROWNS_IN_WATER>(hPlayer, false);
|
||||||
|
Util::SetMessage("You can no longer drown!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Command<Commands::SET_CHAR_DROWNS_IN_WATER>(hPlayer, true);
|
||||||
|
Util::SetMessage("You can now drown again!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GravityValuesMenu()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
ImGui::Separator();
|
||||||
|
ImGui::Text("Gravity Values");
|
||||||
|
//ImGui::Columns(4);
|
||||||
|
|
||||||
|
if (ImGui::Button("Space Gravity")) {
|
||||||
|
GAME_GRAVITY = 0.0;
|
||||||
|
Util::SetMessage("Gravity set to space.");
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Moon Gravity")) {
|
||||||
|
GAME_GRAVITY = 0.001;
|
||||||
|
Util::SetMessage("Gravity set to moon.");
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Normal Gravity")) {
|
||||||
|
GAME_GRAVITY = 0.008;
|
||||||
|
Util::SetMessage("Gravity set to normal.");
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
if (ImGui::Button("Strong Gravity")) {
|
||||||
|
GAME_GRAVITY = 0.015;
|
||||||
|
Util::SetMessage("Gravity set to strong.");
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Maniac Gravity")) {
|
||||||
|
GAME_GRAVITY = 0.9;
|
||||||
|
Util::SetMessage("Gravity set to maniac. Chaos will occur!");
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
void PedTestPage::InsaneGravity()
|
||||||
|
{
|
||||||
|
// Make game timer,
|
||||||
|
// Toggle gravity from Maniac to Normal
|
||||||
|
float maniacGravity = 0.9;
|
||||||
|
float normalGravity = 0.008;
|
||||||
|
|
||||||
|
size_t game_ms = CTimer::m_snTimeInMilliseconds;
|
||||||
|
static size_t interval = 0;
|
||||||
|
if (game_ms - interval > 10000) {
|
||||||
|
//
|
||||||
|
if (GAME_GRAVITY = normalGravity)
|
||||||
|
{
|
||||||
|
GAME_GRAVITY = maniacGravity;
|
||||||
|
interval = game_ms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PedTestPage::NormalGravity()
|
||||||
|
{
|
||||||
|
float maniacGravity = 0.9;
|
||||||
|
float normalGravity = 0.008;
|
||||||
|
|
||||||
|
size_t game_ms = CTimer::m_snTimeInMilliseconds;
|
||||||
|
static size_t interval = 0;
|
||||||
|
if (game_ms - interval > 5000) {
|
||||||
|
//
|
||||||
|
if (GAME_GRAVITY = maniacGravity)
|
||||||
|
{
|
||||||
|
GAME_GRAVITY = normalGravity;
|
||||||
|
interval = game_ms;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// I couldn't get this working.
|
||||||
|
#ifdef _TEST1
|
||||||
|
#ifdef GTASA
|
||||||
|
static void SpawnRandomCopPed()
|
||||||
|
{
|
||||||
|
//CVehicle* cVehicle = nullptr;
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
// Taken from plugin-sdk examples under PedSpawner in Main.cpp
|
||||||
|
// https://github.com/DK22Pac/plugin-sdk/blob/master/examples/PedSpawner/Main.cpp
|
||||||
|
// Cop Ped
|
||||||
|
int copRandModelID = copModelIds[rand() % 250]; // Random model id
|
||||||
|
CStreaming::RequestModel(copRandModelID, 0); // Request the model
|
||||||
|
CStreaming::LoadAllRequestedModels(false); // Whatever this does.
|
||||||
|
//CPed* ped = new CCivilianPed(CPopulation::IsFemale(modelID) ? PED_TYPE_CIVFEMALE : PED_TYPE_CIVMALE, modelID);
|
||||||
|
//CPed* ped = new CCivilianPed(CPopulation::IsFemale(modelID) ? PED_TYPE_CIVFEMALE : PED_TYPE_CIVMALE, modelID);
|
||||||
|
|
||||||
|
|
||||||
|
// Vehicle
|
||||||
|
//CVehicle *vehicle = new CVehicle();
|
||||||
|
CVehicle* SpawnVehicle(unsigned int modelIndex, CVector position)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// This might be fun, have the cop run over the player.
|
||||||
|
CCopPed* copPed = new CCopPed(copRandModelID);
|
||||||
|
|
||||||
|
//CVehicle* cVehicle = new CVehicle(MODEL_DODO);
|
||||||
|
|
||||||
|
copPed->KillPedWithCar();
|
||||||
|
CStreaming::SetModelIsDeletable(copRandModelID);
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
|
||||||
|
#endif //_TEST1
|
||||||
|
|
||||||
|
static void SpawnPedMenu()
|
||||||
|
{
|
||||||
|
if (ImGui::Button("Spawn Ped")) {
|
||||||
|
//SpawnRandomPed();
|
||||||
|
// Moved this into PedFunctions.
|
||||||
|
PedFunctions::SpawnRandomPed();
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _TEST1
|
||||||
|
if (ImGui::Button("Spawn Random Cop ped"))
|
||||||
|
{
|
||||||
|
SpawnRandomCopPed();
|
||||||
|
}
|
||||||
|
#endif //_TEST1
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//#endif //GTASA
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void AreaCheckTestMenu()
|
||||||
|
{
|
||||||
|
CVector testLocationArea1 = CVector(2, 2, 2);
|
||||||
|
CVector testLocationArea2 = CVector(20, 20, 20);
|
||||||
|
|
||||||
|
ImGui::Text("Area Check testing.");
|
||||||
|
if (ImGui::Button("Check Area #1")) {
|
||||||
|
bool isPlayerInArea = PlayerFunctions::IsPlayerInArea(testLocationArea1.x, testLocationArea1.y, testLocationArea1.z,
|
||||||
|
testLocationArea2.x, testLocationArea2.y, testLocationArea2.z);
|
||||||
|
|
||||||
|
if (isPlayerInArea)
|
||||||
|
{
|
||||||
|
Util::SetMessage("You are in the zone.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Util::SetMessage("You are not in the zone.");
|
||||||
|
}
|
||||||
|
//AreaCheckTest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////
|
||||||
|
|
||||||
|
|
||||||
|
bool playerSprint = true;
|
||||||
|
static void MiscTestMenu()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
// I'm not exactly sure what this is doing.
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/06AF
|
||||||
|
// This just crashes it.
|
||||||
|
//#define _TEST1
|
||||||
|
#ifdef _TEST1
|
||||||
|
|
||||||
|
if (ImGui::Checkbox("Toggle running", &playerSprint))
|
||||||
|
{
|
||||||
|
if(!playerSprint)
|
||||||
|
{
|
||||||
|
Command<Commands::DISABLE_PLAYER_SPRINT>(hplayer, false);
|
||||||
|
Util::SetMessage("You have disabled sprinting!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Command<Commands::DISABLE_PLAYER_SPRINT>(hplayer, true);
|
||||||
|
Util::SetMessage("You have enabled sprinting!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
|
||||||
|
if(ImGui::Button("Is player under car?"))
|
||||||
|
{
|
||||||
|
if (PlayerFunctions::IsPedStuckUnderCar()) {
|
||||||
|
Util::SetMessage("You are being crushed!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Util::SetMessage("You are not under a car.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button("Add blip for current pos"))
|
||||||
|
{
|
||||||
|
CVector playerPos = player->GetPosition();
|
||||||
|
|
||||||
|
// This works
|
||||||
|
//bool pos = Command<Commands::ADD_SPRITE_BLIP_FOR_COORD>(playerPos.x, playerPos.y, playerPos.z);
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/02A8
|
||||||
|
// https://gtamods.com/wiki/Blip
|
||||||
|
|
||||||
|
Command<Commands::ADD_SPRITE_BLIP_FOR_COORD>(playerPos.x, playerPos.y, playerPos.z, RADAR_SPRITE_AMMUGUN);
|
||||||
|
|
||||||
|
|
||||||
|
// Test, didn't work
|
||||||
|
//CSprite playerSprite = Command<Commands::ADD_SPRITE_BLIP_FOR_COORD>(playerPos.x, playerPos.y, playerPos.z, RADAR_SPRITE_AMMUGUN);
|
||||||
|
|
||||||
|
// This doesn't seem to store the value or remove the blip.
|
||||||
|
//bool blip = Command<Commands::ADD_SPRITE_BLIP_FOR_COORD>(playerPos.x, playerPos.y, playerPos.z, RADAR_SPRITE_AMMUGUN);
|
||||||
|
//bool doesBlipExist = Command<Commands::DOES_BLIP_EXIST>(blip);
|
||||||
|
////if (blipPos)
|
||||||
|
//if (doesBlipExist)
|
||||||
|
//{
|
||||||
|
// Command<Commands::REMOVE_BLIP>(blip);
|
||||||
|
// Util::SetMessage("Removed current blip.");
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button("Add blip for vehicle"))
|
||||||
|
{
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
|
||||||
|
|
||||||
|
if (PlayerFunctions::IsPlayerInVehicle()) {
|
||||||
|
pVeh = player->m_pVehicle;
|
||||||
|
Command<Commands::ADD_BLIP_FOR_CAR>(pVeh);
|
||||||
|
Util::SetMessage("You have added a blip for your vehicle.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// I'm not sure how to remove these yet.
|
||||||
|
if (ImGui::Button("Remove blip for vehicle"))
|
||||||
|
{
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
|
||||||
|
if (PlayerFunctions::IsPlayerInVehicle()) {
|
||||||
|
pVeh = player->m_pVehicle;
|
||||||
|
Command<Commands::REMOVE_BLIP>(pVeh);
|
||||||
|
Util::SetMessage("You have removed a blip for your vehicle.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //_TEST1
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void KillPlayer()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
player->m_fHealth = 0;
|
||||||
|
player->m_fArmour = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Change the respawn point, possibly use an event to do this.
|
||||||
|
/// </summary>
|
||||||
|
static void TestChangeRespawnMenu()
|
||||||
|
{
|
||||||
|
if (ImGui::Button("Set Respawn to 22,22,10"))
|
||||||
|
{
|
||||||
|
// Needs the decimals or it doesn't work right.
|
||||||
|
Command<Commands::OVERRIDE_NEXT_RESTART>(22.0, 22.0, 2.0, 20.0);
|
||||||
|
Util::SetMessage("Respawn point set to middle of map.");
|
||||||
|
}
|
||||||
|
if (ImGui::Button("Fix respawn back to normal"))
|
||||||
|
{
|
||||||
|
Command<Commands::CANCEL_OVERRIDE_RESTART>();
|
||||||
|
Util::SetMessage("Reset respawn points.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Will this work?
|
||||||
|
bool respawnMiddleOfMap;
|
||||||
|
static void SetRespawnMiddleOfMapMenu()
|
||||||
|
{
|
||||||
|
PlayerFunctions* playerFunctions = new PlayerFunctions();
|
||||||
|
//if (ImGui::Checkbox("Respawn middle of map", &playerFunctions->m_bRespawnMiddleOfMap))
|
||||||
|
if (ImGui::Checkbox("Respawn middle of map", &respawnMiddleOfMap))
|
||||||
|
{
|
||||||
|
//if (playerFunctions->m_bRespawnMiddleOfMap) {
|
||||||
|
if (respawnMiddleOfMap) {
|
||||||
|
playerFunctions->m_bRespawnMiddleOfMap = true;
|
||||||
|
Util::SetMessage("You have enabled respawn at the middle of the map!");
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
playerFunctions->m_bRespawnMiddleOfMap = false;
|
||||||
|
Util::SetMessage("Spawning reset to normal.");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//if (ImGui::Checkbox("Respawn middle of map", &PlayerFunctions::m_bRespawnMiddleOfMap))
|
||||||
|
//{
|
||||||
|
// if (PlayerFunctions::m_bRespawnMiddleOfMap) {
|
||||||
|
// PlayerFunctions::m_bRespawnMiddleOfMap = true;
|
||||||
|
// Util::SetMessage("You have enabled respawn at the middle of the map!");
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// PlayerFunctions::m_bRespawnMiddleOfMap = false;
|
||||||
|
// Util::SetMessage("Spawning reset to normal.");
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//if (ImGui::Button("Respawn middle of map"))
|
||||||
|
//{
|
||||||
|
// PlayerFunctions::m_bRespawnMiddleOfMap = true;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Use Swat rope test, this is in the reversed gta sa project, I wonder if I can use it in the plugin-sdk?
|
||||||
|
// I don't know if it'll work with the player.
|
||||||
|
static void CreateSwatRopeOnPed()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
|
||||||
|
CVector playerCoords = player->GetPosition();
|
||||||
|
|
||||||
|
//CVector testLocation = CVector(2, 2, 2);
|
||||||
|
// Will this work?
|
||||||
|
CVector testLocation = playerCoords;
|
||||||
|
|
||||||
|
// Add some distance to the x and y so they don't spawn right on the player.
|
||||||
|
// Z is the height, I'll leave it alone for now.
|
||||||
|
testLocation.x = testLocation.x + 2;
|
||||||
|
testLocation.y = testLocation.y + 2;
|
||||||
|
|
||||||
|
// pedType, modelId, x, y, z
|
||||||
|
// Ped male
|
||||||
|
// Sweet
|
||||||
|
Command<Commands::CREATE_SWAT_ROPE>(PED_TYPE_CIVMALE, 270, testLocation.x, testLocation.y, testLocation.z);
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
// Untested
|
||||||
|
/// <summary>
|
||||||
|
/// Teleport to marker test, this seems to work but doesn't put the player on the ground.
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
static void TeleportToMarkerTest()
|
||||||
|
{
|
||||||
|
// Idk what this below is doing but its defined in teleport.cpp.
|
||||||
|
tRadarTrace* ms_RadarTrace = reinterpret_cast<tRadarTrace*>(patch::GetPointer(0x5838B0 + 2));
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
CVector playerPos = player->GetPosition();
|
||||||
|
|
||||||
|
//Test
|
||||||
|
CEntity* pPlayerEntity = FindPlayerEntity(-1);
|
||||||
|
|
||||||
|
tRadarTrace targetBlip = ms_RadarTrace[LOWORD(FrontEndMenuManager.m_nTargetBlipIndex)];
|
||||||
|
if (targetBlip.m_nRadarSprite != RADAR_SPRITE_WAYPOINT)
|
||||||
|
{
|
||||||
|
Util::SetMessage(TEXT("Teleport.TargetBlipText"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// I don't know how to get the location of the current marker.
|
||||||
|
// This should place the player on the ground.
|
||||||
|
// This doesn't work.
|
||||||
|
#ifdef _TEST1
|
||||||
|
float ground, water;
|
||||||
|
CEntity* pPlayerEntity = FindPlayerEntity(-1);
|
||||||
|
ground = CWorld::FindGroundZFor3DCoord(playerPos.x, playerPos.y, 1000, nullptr, &pPlayerEntity) + 1.0f;
|
||||||
|
|
||||||
|
Command<Commands::GET_WATER_HEIGHT_AT_COORDS>(playerPos.x, playerPos.y, true, &water);
|
||||||
|
playerPos.z = ground > water ? ground : water;
|
||||||
|
|
||||||
|
#endif //_TEST1
|
||||||
|
player->SetPosn(targetBlip.m_vecPos);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void TeleportTestMenu()
|
||||||
|
{
|
||||||
|
if (ImGui::Button("Teleport to marker"))
|
||||||
|
{
|
||||||
|
// I don't think this'll work.
|
||||||
|
TeleportToMarkerTest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PedTest()
|
||||||
|
{
|
||||||
|
ImGui::Text("Find unsuspecting target ped");
|
||||||
|
if(ImGui::Button("Test #1"))
|
||||||
|
{
|
||||||
|
//CWorld::FindUnsuspectingTargetPed();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Text("Clear peds and everything in area");
|
||||||
|
if (ImGui::Button("Test #2"))
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
CWorld::ClearExcitingStuffFromArea(player->GetPosition(), 20, true);
|
||||||
|
Util::SetMessage("Killed everything in the area!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// This didn't seem to work
|
||||||
|
ImGui::Text("Start a fire in your area");
|
||||||
|
if (ImGui::Button("Test #3"))
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
CEntity* playerEntity = FindPlayerEntity(-1);
|
||||||
|
|
||||||
|
CVector playerPos = player->GetPosition();
|
||||||
|
CWorld::SetWorldOnFire(playerPos.x, playerPos.y, playerPos.z, 20, playerEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Main code for PlayerTestMenu
|
||||||
|
/// </summary>
|
||||||
|
void PedTestPage::PlayerTestMenu()
|
||||||
|
{
|
||||||
|
|
||||||
|
//Events::initGameEvent += [this]()
|
||||||
|
// {
|
||||||
|
|
||||||
|
// };
|
||||||
|
|
||||||
|
Events::processScriptsEvent += [this]()
|
||||||
|
//Events::gameProcessEvent += [this]()
|
||||||
|
{
|
||||||
|
// Well this just spams the text and doesn't stop the noises when in the area.
|
||||||
|
// Moved KillPlayer and other chaos mode functions into player_functions.cpp.
|
||||||
|
// Moved the event into cheatmenu.cpp.
|
||||||
|
};
|
||||||
|
|
||||||
|
SuicideMenu();
|
||||||
|
BombMenu();
|
||||||
|
ShowCoordsMenu();
|
||||||
|
ShowMarkerCoordsMenu();
|
||||||
|
TogglePlayerDrownMenu();
|
||||||
|
GravityValuesMenu();
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
// Test features
|
||||||
|
#ifdef _TEST
|
||||||
|
SoundMenu();
|
||||||
|
ImGui::Separator();
|
||||||
|
#ifdef GTASA
|
||||||
|
SpawnPedMenu();
|
||||||
|
|
||||||
|
// New
|
||||||
|
// Respawn stuff
|
||||||
|
TestChangeRespawnMenu();
|
||||||
|
SetRespawnMiddleOfMapMenu();
|
||||||
|
|
||||||
|
TeleportTestMenu();
|
||||||
|
|
||||||
|
#endif //GTASA
|
||||||
|
// I could probably set this to activate when the player goes into it and send a message saying you are in the zone.
|
||||||
|
AreaCheckTestMenu();
|
||||||
|
|
||||||
|
MiscTestMenu();
|
||||||
|
|
||||||
|
PedTest();
|
||||||
|
#endif //TEST
|
||||||
|
|
||||||
|
}
|
15
src/test/test_ped.h
Normal file
15
src/test/test_ped.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
//#include "pch.h"
|
||||||
|
|
||||||
|
class PedTestPage
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
void Draw();
|
||||||
|
public:
|
||||||
|
PedTestPage();
|
||||||
|
PedTestPage(const PedTestPage&);
|
||||||
|
//static void PedTestMenu();
|
||||||
|
void PlayerTestMenu();
|
||||||
|
static void InsaneGravity();
|
||||||
|
static void NormalGravity();
|
||||||
|
};
|
12
src/test/test_teleport.cpp
Normal file
12
src/test/test_teleport.cpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "test_teleport.h"
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Main code for TestTeleportMenu
|
||||||
|
/// </summary>
|
||||||
|
/// Incomplete
|
||||||
|
void TeleportTestPage::TestTeleportMenu()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
12
src/test/test_teleport.h
Normal file
12
src/test/test_teleport.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
//#include "pch.h"
|
||||||
|
|
||||||
|
class TeleportTestPage
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
TeleportTestPage();
|
||||||
|
TeleportTestPage(const TeleportTestPage&);
|
||||||
|
void Draw();
|
||||||
|
public:
|
||||||
|
static void TestTeleportMenu();
|
||||||
|
};
|
545
src/test/test_vehicle.cpp
Normal file
545
src/test/test_vehicle.cpp
Normal file
@ -0,0 +1,545 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
// My code
|
||||||
|
#include "test_vehicle.h"
|
||||||
|
#include "functions/vehicle_functions.h"
|
||||||
|
#include "functions/player_functions.h"
|
||||||
|
|
||||||
|
#ifdef GTASA
|
||||||
|
// Radio Test
|
||||||
|
#include "CAERadioTrackManager.h"
|
||||||
|
#include "CAudioEngine.h"
|
||||||
|
// I can disable the radio and change its type using this
|
||||||
|
#include "CAEVehicleAudioEntity.h"
|
||||||
|
|
||||||
|
#include "CBmx.h"
|
||||||
|
|
||||||
|
|
||||||
|
#endif //GTASA
|
||||||
|
|
||||||
|
//void TestPage::VehicleTest() {
|
||||||
|
// // These are neat, the BY_GAME defines seem to have everything in this order: SA, VC, 3.
|
||||||
|
// // This is under defines.h
|
||||||
|
// CVehicle* pVeh = BY_GAME(FindPlayerVehicle(-1, false), FindPlayerVehicle(), FindPlayerVehicle());
|
||||||
|
// int hVeh = CPools::GetVehicleRef(pVeh);
|
||||||
|
//
|
||||||
|
// // If the player is in a vehicle.
|
||||||
|
// if (pVeh)
|
||||||
|
// {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // There is a lot of these on the sanny builder website.
|
||||||
|
// //
|
||||||
|
// // Car, TireId (int)
|
||||||
|
// // https://library.sannybuilder.com/#/sa/default/04FE
|
||||||
|
// //Command<Commands::BURST_CAR_TYRE>(hVeh, 1);
|
||||||
|
//
|
||||||
|
// // Get car speed
|
||||||
|
// // https://library.sannybuilder.com/#/sa/default/02E3
|
||||||
|
// //
|
||||||
|
// // Car
|
||||||
|
// //Command<Commands::GET_CAR_SPEED>(hVeh);
|
||||||
|
//
|
||||||
|
// // Lock car doors
|
||||||
|
// // https://library.sannybuilder.com/#/sa/default/020A
|
||||||
|
// // Will this work?
|
||||||
|
// //Command<Commands::LOCK_CAR_DOORS>(hVeh);
|
||||||
|
//
|
||||||
|
// // Explode
|
||||||
|
// // https://library.sannybuilder.com/#/sa/default/020B
|
||||||
|
// //
|
||||||
|
// //Command<Commands::EXPLODE_CAR>(hVeh);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
|
||||||
|
// This is mostly specific to GTA SA and has been disabled for 3 and vc, I cannot get this to work on VC anyways.
|
||||||
|
|
||||||
|
bool bFlyingCars = false;
|
||||||
|
bool bSearchLight = false;
|
||||||
|
bool bVehGodMode = false;
|
||||||
|
|
||||||
|
VehicleTestPage::VehicleTestPage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void BlowUpAllCarsMenu()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
CVector pos = player->GetPosition();
|
||||||
|
|
||||||
|
if (ImGui::Button("Blow up all cars")) {
|
||||||
|
|
||||||
|
CCheat::BlowUpCarsCheat();
|
||||||
|
Util::SetMessage("All cars have been exterminated!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
Util::SetMessage("Only works for SA!");
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void SearchLightMenu()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
// Try to toggle the search lights in police helicopters, is it toggleable in SA? I think I did it in FiveM.
|
||||||
|
if (ImGui::Checkbox("Search Light", &bSearchLight))
|
||||||
|
{
|
||||||
|
int hPlayer = CPools::GetPedRef(player);
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
|
||||||
|
bool bInVehicle = Command<Commands::IS_CHAR_IN_ANY_CAR>(hPlayer);
|
||||||
|
bool bInHeli = Command<Commands::IS_CHAR_IN_ANY_HELI>(hPlayer);
|
||||||
|
|
||||||
|
//bool vehicleSearchLight = Command<Commands::SearchLight>
|
||||||
|
if (bInHeli)
|
||||||
|
{
|
||||||
|
//CHeli::AddHeliSearchLight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Text("Doesn't work!");
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
static void BlowUpVehicleMenu()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
if (ImGui::Button("Blow up Current Car"))
|
||||||
|
{
|
||||||
|
|
||||||
|
//CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
|
||||||
|
// This actually does work.
|
||||||
|
bool bInVehicle = Command<Commands::IS_CHAR_IN_ANY_CAR>(hplayer);
|
||||||
|
if (bInVehicle)
|
||||||
|
{
|
||||||
|
CVehicle* pVeh = player->m_pVehicle;
|
||||||
|
int hVeh = CPools::GetVehicleRef(pVeh);
|
||||||
|
Command<Commands::EXPLODE_CAR>(hVeh);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CloseDoorsMenu()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
// Works for closing the doors, not the trunk or hood though.
|
||||||
|
if (ImGui::Button("Close doors"))
|
||||||
|
{
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
|
||||||
|
bool bInVehicle = Command<Commands::IS_CHAR_IN_ANY_CAR>(hplayer);
|
||||||
|
if (bInVehicle)
|
||||||
|
{
|
||||||
|
CVehicle* pVeh = player->m_pVehicle;
|
||||||
|
int hVeh = CPools::GetVehicleRef(pVeh);
|
||||||
|
Command<Commands::CLOSE_ALL_CAR_DOORS>(hVeh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void LockDoorsMenu()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
// This works for locking the car doors.
|
||||||
|
if (ImGui::Button("Lock doors"))
|
||||||
|
{
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
|
||||||
|
bool bInVehicle = Command<Commands::IS_CHAR_IN_ANY_CAR>(hplayer);
|
||||||
|
if (bInVehicle)
|
||||||
|
{
|
||||||
|
CVehicle* pVeh = player->m_pVehicle;
|
||||||
|
int hVeh = CPools::GetVehicleRef(pVeh);
|
||||||
|
bool isCarLocked = Command<Commands::GET_CAR_DOOR_LOCK_STATUS>(hVeh);
|
||||||
|
//bool isCarLocked = player->m_pVehicle->m_eDoorLock;
|
||||||
|
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/020A
|
||||||
|
// https://library.sannybuilder.com/#/sa/enums/CarLock
|
||||||
|
if (!isCarLocked)
|
||||||
|
{
|
||||||
|
// 2 - Locked
|
||||||
|
Command<Commands::LOCK_CAR_DOORS>(hVeh, 2);
|
||||||
|
Util::SetMessage("Car has been locked!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 1 - Unlocked
|
||||||
|
Command<Commands::LOCK_CAR_DOORS>(hVeh, 1);
|
||||||
|
Util::SetMessage("Car has been unlocked!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// I wonder how to get the last vehicle the player was in to unlock it.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void FlyingCarsMenu()
|
||||||
|
{
|
||||||
|
// This works
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
if (ImGui::Checkbox("Flying cars", &bFlyingCars))
|
||||||
|
{
|
||||||
|
// In cleo redux I can read and write to memory addresses, not sure how on here.
|
||||||
|
// I figured it out in the below code using a function in this menu.
|
||||||
|
// Example:
|
||||||
|
/*
|
||||||
|
* (Written in JavaScript)
|
||||||
|
player.clearWantedLevel();
|
||||||
|
Memory.Write(0x969171, 1, 1, false);
|
||||||
|
|
||||||
|
// Flying cars cheat.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Idea for this game from game.cpp on line 359
|
||||||
|
if (bFlyingCars)
|
||||||
|
{
|
||||||
|
patch::Set<byte>(0x969160, 1, true);
|
||||||
|
Util::SetMessage("Cars can now fly!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
patch::Set<byte>(0x969160, 0, true);
|
||||||
|
Util::SetMessage("Cars can no longer fly!");
|
||||||
|
}
|
||||||
|
// CallDynGlobal seems to be what they are using for cheats in the plugin-sdk
|
||||||
|
//CallDynGlobal<0x969160>;
|
||||||
|
// Gives an error though
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
static void InvincibleCarsMenu()
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
// This works, this was a quick test I came up with.
|
||||||
|
if (ImGui::Checkbox("Invincible car", &bVehGodMode))
|
||||||
|
{
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
|
||||||
|
bool bInVehicle = Command<Commands::IS_CHAR_IN_ANY_CAR>(hplayer);
|
||||||
|
if (bInVehicle)
|
||||||
|
{
|
||||||
|
CVehicle* pVeh = player->m_pVehicle;
|
||||||
|
int hVeh = CPools::GetVehicleRef(pVeh);
|
||||||
|
#ifdef GTASA
|
||||||
|
bool isCarLocked = Command<Commands::GET_CAR_DOOR_LOCK_STATUS>(hVeh);
|
||||||
|
#endif //GTASA
|
||||||
|
//bool isCarLocked = player->m_pVehicle->m_eDoorLock;
|
||||||
|
|
||||||
|
if (bVehGodMode)
|
||||||
|
{
|
||||||
|
// Car, bulletProof, fireProof, explosionProof, meleeProof
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/02AC
|
||||||
|
Command<Commands::SET_CAR_PROOFS>(hVeh, true, true, true, true, true);
|
||||||
|
Util::SetMessage("Your car now has god mode!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Command<Commands::SET_CAR_PROOFS>(hVeh, false, false, false, false, false);
|
||||||
|
Util::SetMessage("Your car no longer has god mode!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
static void IsCarInWaterMenu()
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
// Working
|
||||||
|
if (ImGui::Button("Is car in water"))
|
||||||
|
{
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
bool bInVehicle = Command<Commands::IS_CHAR_IN_ANY_CAR>(hplayer);
|
||||||
|
|
||||||
|
// TODO Possibly Move this into a vehicle_functions file.
|
||||||
|
// First we check if the player is in a vehicle
|
||||||
|
if (bInVehicle) {
|
||||||
|
CVehicle* pVeh = player->m_pVehicle;
|
||||||
|
int hVeh = CPools::GetVehicleRef(pVeh);
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/04D8
|
||||||
|
bool isCarInWater = Command<Commands::IS_CAR_IN_WATER>(hVeh);
|
||||||
|
|
||||||
|
// If the car is not in water
|
||||||
|
if (!isCarInWater)
|
||||||
|
{
|
||||||
|
Util::SetMessage("Your car is dry.");
|
||||||
|
}
|
||||||
|
// If the car is in water
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Util::SetMessage("Your car is in the water.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Util::SetMessage("You are not in a car!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Incomplete.
|
||||||
|
static void RadioTest() {
|
||||||
|
#ifdef GTASA
|
||||||
|
CAEVehicleAudioEntity* cAEVehicleAudioEntity = new CAEVehicleAudioEntity();
|
||||||
|
CAudioEngine* cAudioEngine = new CAudioEngine();
|
||||||
|
#endif //GTASA
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
ImGui::Text("Radio Test");
|
||||||
|
bool toggleRadio = true;
|
||||||
|
|
||||||
|
if (ImGui::Checkbox("Toggle Radio", &toggleRadio)) {
|
||||||
|
if (!toggleRadio) {
|
||||||
|
// Idk how I would set these values
|
||||||
|
//eRadioType(RADIO_DISABLED);
|
||||||
|
//eRadioType == RADIO_DISABLED;
|
||||||
|
//cAudioEngine->;
|
||||||
|
|
||||||
|
//cAEVehicleAudioEntity.
|
||||||
|
// Disable the radio
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Enable the radio
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define _TEST
|
||||||
|
void BurstAllTiresMenu()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
|
||||||
|
if (ImGui::Button("Pop car tires")) {
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
bool bInVehicle = Command<Commands::IS_CHAR_IN_ANY_CAR>(hplayer);
|
||||||
|
|
||||||
|
//// First we check if the player is in a vehicle
|
||||||
|
if(bInVehicle)
|
||||||
|
{
|
||||||
|
//CVehicle* pVeh = player->m_pVehicle;
|
||||||
|
// I've never used this before
|
||||||
|
// https://github.com/DK22Pac/plugin-sdk/blob/master/examples/OpenDoorExample/Main.cpp#L69
|
||||||
|
CVehicle* pVehTest = FindPlayerVehicle(0, false);
|
||||||
|
|
||||||
|
//int hVeh = CPools::GetVehicleRef(pVeh);
|
||||||
|
|
||||||
|
#define _SWITCH_TEST
|
||||||
|
|
||||||
|
#ifdef _SWITCH_TEST
|
||||||
|
|
||||||
|
eVehicleType vehicleType;
|
||||||
|
|
||||||
|
// Check if the player is in a vehicle.
|
||||||
|
if (pVehTest) {
|
||||||
|
int hVehTest = CPools::GetVehicleRef(pVehTest);
|
||||||
|
// I didn't know it was possible to use switch on an enum, this can be useful to cut down on a lot of duplicate code.
|
||||||
|
// Well this doesn't seem to work right, it always prints "Your car no longer has tires.
|
||||||
|
// https://stackoverflow.com/questions/3019153/how-do-i-use-an-enum-value-in-a-switch-statement-in-c
|
||||||
|
|
||||||
|
// I'm not doing this right, it only ever says "Your car no longer has tires" even in a bike or boat.
|
||||||
|
// Also says the same for other vehicles too.
|
||||||
|
// https://github.com/DK22Pac/plugin-sdk/blob/master/examples/CreateCar/Main.cpp#L41
|
||||||
|
//switch (reinterpret_cast<CVehicleModelInfo*>(CModelInfo::ms_modelInfoPtrs[hVehTest])->m_nVehicleType) {
|
||||||
|
// This seems to crash it.
|
||||||
|
switch (pVeh->m_nVehicleClass) {
|
||||||
|
|
||||||
|
case VEHICLE_AUTOMOBILE:
|
||||||
|
Command<Commands::BURST_CAR_TYRE>(hVehTest, 0);
|
||||||
|
Command<Commands::BURST_CAR_TYRE>(hVehTest, 1);
|
||||||
|
Command<Commands::BURST_CAR_TYRE>(hVehTest, 2);
|
||||||
|
Command<Commands::BURST_CAR_TYRE>(hVehTest, 3);
|
||||||
|
Util::SetMessage("Your car no longer has tires!");
|
||||||
|
break;
|
||||||
|
case VEHICLE_BIKE:
|
||||||
|
Command<Commands::BURST_CAR_TYRE>(hVehTest, 1);
|
||||||
|
Command<Commands::BURST_CAR_TYRE>(hVehTest, 2);
|
||||||
|
Util::SetMessage("Your bike no longer has tires!");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case VEHICLE_BMX:
|
||||||
|
Command<Commands::BURST_CAR_TYRE>(hVehTest, 1);
|
||||||
|
Command<Commands::BURST_CAR_TYRE>(hVehTest, 2);
|
||||||
|
Util::SetMessage("Your bike no longer has tires!");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Util::SetMessage("Only works for cars and bikes!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//switch (vehicleType) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// This works
|
||||||
|
// TODO Setup for loop for this and check if the car is a motorcycle
|
||||||
|
if (pVehTest && pVehTest->m_nVehicleClass == VEHICLE_AUTOMOBILE)
|
||||||
|
{
|
||||||
|
int hVehTest = CPools::GetVehicleRef(pVehTest);
|
||||||
|
// https://github.com/DK22Pac/plugin-sdk/blob/master/examples/OpenDoorExample/Main.cpp#L71
|
||||||
|
CAutomobile* autoMobile = reinterpret_cast<CAutomobile*>(pVehTest);
|
||||||
|
|
||||||
|
// TODO Set this to where it detects if the vehicle has 4 tires or not.
|
||||||
|
Command<Commands::BURST_CAR_TYRE>(hVehTest, 1);
|
||||||
|
Command<Commands::BURST_CAR_TYRE>(hVehTest, 2);
|
||||||
|
Command<Commands::BURST_CAR_TYRE>(hVehTest, 3);
|
||||||
|
Command<Commands::BURST_CAR_TYRE>(hVehTest, 4);
|
||||||
|
}
|
||||||
|
#endif //_SWITCH_TEST
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Quick test for checking if the VehicleFunctions class is working properly, it seems to be working fine.
|
||||||
|
/// </summary>
|
||||||
|
void CarCheckTestMenu()
|
||||||
|
{
|
||||||
|
VehicleFunctions* vehicleFunctions = new VehicleFunctions();
|
||||||
|
|
||||||
|
// Table test
|
||||||
|
// This adds a border for it. ImGuiTableFlags_Borders
|
||||||
|
|
||||||
|
// The flag I have set below removes the borders for the tables.
|
||||||
|
if(ImGui::BeginTable("VehicleTable", 4, ImGuiTableFlags_NoBordersInBody))
|
||||||
|
{
|
||||||
|
// 1
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
if (ImGui::Button("In vehicle?"))
|
||||||
|
{
|
||||||
|
// Only shows the "In a car" message if the player is in a vehicle
|
||||||
|
VehicleFunctions::PlayerInCarMsg();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
if (ImGui::Button("Car in water?"))
|
||||||
|
{
|
||||||
|
if (PlayerFunctions::IsPlayerInVehicle())
|
||||||
|
{
|
||||||
|
if (VehicleFunctions::IsCarInWater())
|
||||||
|
{
|
||||||
|
Util::SetMessage("Your car is in the water.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Util::SetMessage("Your car is dry");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Util::SetMessage("You are not in a car!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
if (ImGui::Button("Test1"))
|
||||||
|
{
|
||||||
|
Util::SetMessage("Not implemented!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
if (ImGui::Button("Test2"))
|
||||||
|
{
|
||||||
|
Util::SetMessage("Not implemented!");
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndTable();
|
||||||
|
|
||||||
|
// Fix columns being broken
|
||||||
|
ImGui::Columns(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Main code for VehicleTestMenu
|
||||||
|
/// </summary>
|
||||||
|
void VehicleTestPage::VehicleTestMenu() {
|
||||||
|
//#ifdef GTASA
|
||||||
|
// CPlayerPed* player = FindPlayerPed();
|
||||||
|
// int hplayer = CPools::GetPedRef(player);
|
||||||
|
// CVehicle* pVeh = nullptr;
|
||||||
|
// CVector pos = player->GetPosition();
|
||||||
|
//
|
||||||
|
// if (ImGui::Button("Blow up all cars")) {
|
||||||
|
//
|
||||||
|
// CCheat::BlowUpCarsCheat();
|
||||||
|
// Util::SetMessage("All cars have been exterminated!");
|
||||||
|
//#else
|
||||||
|
// Util::SetMessage("Only works for SA!");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//#endif //GTASA
|
||||||
|
|
||||||
|
// These should be ordered in whatever order they are specified here.
|
||||||
|
// Most of these are private to this file, they can be put into the header file to be made public if needed for other classes.
|
||||||
|
BlowUpAllCarsMenu();
|
||||||
|
SearchLightMenu();
|
||||||
|
BlowUpVehicleMenu();
|
||||||
|
CloseDoorsMenu();
|
||||||
|
LockDoorsMenu();
|
||||||
|
FlyingCarsMenu();
|
||||||
|
InvincibleCarsMenu();
|
||||||
|
IsCarInWaterMenu();
|
||||||
|
|
||||||
|
// New
|
||||||
|
#ifdef _TEST
|
||||||
|
BurstAllTiresMenu();
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
CarCheckTestMenu();
|
||||||
|
#endif //_TEST
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// void VehiclePage::Draw()
|
||||||
|
//void VehicleTestPage::Draw()
|
||||||
|
//{
|
||||||
|
// // Draw the test menu with a couple of cheats.
|
||||||
|
// VehicleTestMenu();
|
||||||
|
//}
|
12
src/test/test_vehicle.h
Normal file
12
src/test/test_vehicle.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
//#include "pch.h"
|
||||||
|
|
||||||
|
class VehicleTestPage
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
void Draw();
|
||||||
|
public:
|
||||||
|
VehicleTestPage();
|
||||||
|
VehicleTestPage(const VehicleTestPage&);
|
||||||
|
static void VehicleTestMenu();
|
||||||
|
};
|
236
src/test/test_world.cpp
Normal file
236
src/test/test_world.cpp
Normal file
@ -0,0 +1,236 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "test_world.h"
|
||||||
|
#include "utils/widget.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef GTASA
|
||||||
|
#include "CCoronas.h"
|
||||||
|
#include "CGeneral.h"
|
||||||
|
#endif //GTASA
|
||||||
|
|
||||||
|
// This is needed so it doesn't get unresvoled external symbol errors without using static.
|
||||||
|
WorldTestPage::WorldTestPage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void WeatherMenu()
|
||||||
|
{
|
||||||
|
// Weather
|
||||||
|
// Will these work?
|
||||||
|
#ifdef GTASA
|
||||||
|
// Will giving this a default value fix the crashing? I think the weather is crashing it.
|
||||||
|
int defaultWeatherType = 0;
|
||||||
|
//eWeatherType defaultWeatherType = WEATHER_CLOUDY_COUNTRYSIDE;
|
||||||
|
//std::string defaultWeatherType = "WEATHER_CLOUDY_COUNTRYSIDE";
|
||||||
|
|
||||||
|
//static std::vector<eWeatherType> cloudyWeatherTypes = {
|
||||||
|
// WEATHER_CLOUDY_COUNTRYSIDE, WEATHER_CLOUDY_LA, WEATHER_CLOUDY_SF,
|
||||||
|
// WEATHER_CLOUDY_VEGAS
|
||||||
|
//};
|
||||||
|
|
||||||
|
|
||||||
|
static std::vector<std::string> allWeatherTypes = {
|
||||||
|
"Extra Sunny LA", "Sunny LA", "Smog LA", "Sunny Smog LA",
|
||||||
|
"Cloudy LA", "Sunny SF", "Extra Sunny SF", "Cloudy SF", "Rainy SF",
|
||||||
|
"Foggy SF", "Sunny LV", "Cloudy LV", "Extra Sunny Countryside", "Cloudy Countryside",
|
||||||
|
"Rainy Countryside", "Extra Sunny Desert", "Sunny Desert", "Sandstorm Desert",
|
||||||
|
"Underwater", "Extra Colors 1", "Extra Colors 2"
|
||||||
|
|
||||||
|
//"WEATHER_EXTRASUNNY_COUNTRYSIDE", "WEATHER_EXTRASUNNY_SMOG_LA", "WEATHER_EXTRASUNNY_SMOG_LA",
|
||||||
|
//"WEATHER_EXTRASUNNY_VEGAS", "WEATHER_EXTRACOLOURS_1", "WEATHER_EXTRACOLOURS_2",
|
||||||
|
//"WEATHER_RAINY_COUNTRYSIDE", "WEATHER_RAINY_SF", "WEATHER_FOGGY_SF",
|
||||||
|
//"WEATHER_REGION_DEFAULT", "WEATHER_REGION_DESERT",
|
||||||
|
//"WEATHER_REGION_LA", "WEATHER_REGION_LV", "WEATHER_REGION_SF",
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::vector<std::string> cloudyWeatherTypes = {
|
||||||
|
"WEATHER_CLOUDY_COUNTRYSIDE", "WEATHER_CLOUDY_LA", "WEATHER_CLOUDY_SF",
|
||||||
|
"WEATHER_CLOUDY_VEGAS", "WEATHER_EXTRASUNNY_LA", "WEATHER_EXTRASUNNY_DESERT", "WEATHER_EXTRASUNNY_LA",
|
||||||
|
"WEATHER_EXTRASUNNY_COUNTRYSIDE", "WEATHER_EXTRASUNNY_SMOG_LA", "WEATHER_EXTRASUNNY_SMOG_LA",
|
||||||
|
"WEATHER_EXTRASUNNY_VEGAS", "WEATHER_EXTRACOLOURS_1", "WEATHER_EXTRACOLOURS_2"
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::vector<eWeatherType> sunnyWeatherTypes = {
|
||||||
|
WEATHER_EXTRASUNNY_LA, WEATHER_EXTRASUNNY_DESERT, WEATHER_EXTRASUNNY_LA,
|
||||||
|
WEATHER_EXTRASUNNY_COUNTRYSIDE, WEATHER_EXTRASUNNY_SMOG_LA, WEATHER_EXTRASUNNY_SMOG_LA,
|
||||||
|
WEATHER_EXTRASUNNY_VEGAS, WEATHER_EXTRACOLOURS_1, WEATHER_EXTRACOLOURS_2
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::vector<eWeatherType> rainyWeatherTypes = {
|
||||||
|
WEATHER_RAINY_COUNTRYSIDE, WEATHER_RAINY_SF,
|
||||||
|
};
|
||||||
|
|
||||||
|
//static std::vector<eWeatherType> otherWeatherTypes = {
|
||||||
|
// WEATHER_FOGGY_SF, WEATHER_REGION_DEFAULT, WEATHER_REGION_DESERT,
|
||||||
|
// WEATHER_REGION_LA, WEATHER_REGION_LV, WEATHER_REGION_SF,
|
||||||
|
//};
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// TODO Setup to where this sets the Las Venturas weather instaed of the LA weather in the Los Venturas area.
|
||||||
|
// TODO Setup drop down menu for this.
|
||||||
|
// Get players current zone if possible, I know it's in the code somewhere.
|
||||||
|
ImGui::Separator();
|
||||||
|
ImGui::Text("Weather");
|
||||||
|
|
||||||
|
if (ImGui::Button("Rain")) {
|
||||||
|
// Will this work?
|
||||||
|
CWeather::ForceWeatherNow(WEATHER_RAINY_COUNTRYSIDE);
|
||||||
|
Util::SetMessage("Weather set to rain.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button("Clear")) {
|
||||||
|
// Will this work?
|
||||||
|
CWeather::ForceWeatherNow(WEATHER_EXTRASUNNY_LA);
|
||||||
|
Util::SetMessage("Weather set to rain.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// This seems to work but the weather types aren't the right ones that I have listed.
|
||||||
|
// They are out of order.
|
||||||
|
//if (ImGui::Combo("Cloudy Weather", &defaultWeatherType, cloudyWeatherTypes))
|
||||||
|
if (Widget::ListBox("Cloudy Weather", allWeatherTypes, defaultWeatherType))
|
||||||
|
{
|
||||||
|
defaultWeatherType = defaultWeatherType;
|
||||||
|
CWeather::ForceWeatherNow(defaultWeatherType);
|
||||||
|
}
|
||||||
|
|
||||||
|
//if (ImGui::Combo("Cloudy Weather", &defaultWeatherType, cloudyWeatherTypes))
|
||||||
|
{
|
||||||
|
// How would I store the value for this?
|
||||||
|
//CWeather::ForceWeatherNow();
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CreateCheckpointMenu()
|
||||||
|
{
|
||||||
|
// Not sure how this one works
|
||||||
|
//CCheckpoints::PlaceMarker();
|
||||||
|
if (ImGui::Button("Create Checkpoint"))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Text("Doesn't work!");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void RemoveCheckpointMenu()
|
||||||
|
{
|
||||||
|
if (ImGui::Button("Remove checkpoint"))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Text("Doesn't work!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create corona menu (Creates a corona at the specified coords)
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
void CreateCoronaTestMenu()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
CVector playerCoords = player->GetPosition();
|
||||||
|
|
||||||
|
// Obtained from Entity.cpp on lines 580-602 in the Reversed gta sa project.
|
||||||
|
// This doesn't work at all.
|
||||||
|
#ifdef _TEST
|
||||||
|
//auto fRand = static_cast<float>(CGeneral::GetRandomNumberInRange() % 16) / 16.0F;
|
||||||
|
// CVector vecPos = CPlaceable::GetPosition();
|
||||||
|
//fRand = std::max(fRand, 0.5F);
|
||||||
|
int fRand = rand();
|
||||||
|
CCoronas::RegisterCorona(
|
||||||
|
// Idk how to use this.
|
||||||
|
reinterpret_cast<uint32_t>(this),
|
||||||
|
nullptr,
|
||||||
|
static_cast<uint8_t>(fRand * 255.0F),
|
||||||
|
static_cast<uint8_t>(fRand * 220.0F),
|
||||||
|
static_cast<uint8_t>(fRand * 190.0F),
|
||||||
|
255,
|
||||||
|
playerCoords,
|
||||||
|
fRand * 6.0F,
|
||||||
|
300.0F,
|
||||||
|
gpCoronaTexture[0],
|
||||||
|
eCoronaFlareType::FLARETYPE_NONE,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
0.0F,
|
||||||
|
false,
|
||||||
|
1.5F,
|
||||||
|
0,
|
||||||
|
15.0F,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
#endif //_TEST
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove corona menu
|
||||||
|
/// </summary>
|
||||||
|
static void RemoveCoronaTestMenu()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Main code for WorldTestMenu
|
||||||
|
/// </summary>
|
||||||
|
void WorldTestPage::WorldTestMenu()
|
||||||
|
{
|
||||||
|
// This doesn't seem to crash it being empty in here.
|
||||||
|
Events::initScriptsEvent += [this]()
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Events::processScriptsEvent += [this]()
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
Refactor these to have the tabs in each file instead of in the test.cpp file
|
||||||
|
// TEXT(Test.TestWorldMenu) - Test World Menu
|
||||||
|
if (ImGui::BeginTabItem("World"))
|
||||||
|
{
|
||||||
|
WeatherMenu();
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Not sure how this one works
|
||||||
|
//CCheckpoints::PlaceMarker();
|
||||||
|
//if (ImGui::Button("Create Checkpoint"))
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
//ImGui::SameLine();
|
||||||
|
//ImGui::Text("Doesn't work!");
|
||||||
|
|
||||||
|
//if (ImGui::Button("Remove checkpoint"))
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
//ImGui::SameLine();
|
||||||
|
//ImGui::Text("Doesn't work!");
|
||||||
|
|
||||||
|
#ifdef GTASA
|
||||||
|
CreateCheckpointMenu();
|
||||||
|
RemoveCheckpointMenu();
|
||||||
|
// Weather
|
||||||
|
WeatherMenu();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Not implemented yet!
|
||||||
|
|
||||||
|
}
|
15
src/test/test_world.h
Normal file
15
src/test/test_world.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
//#include "pch.h"
|
||||||
|
|
||||||
|
class WorldTestPage
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
void Draw();
|
||||||
|
public:
|
||||||
|
// I had to change these two values to public for this to work, even though they arent in use.
|
||||||
|
WorldTestPage();
|
||||||
|
WorldTestPage(const WorldTestPage&);
|
||||||
|
//
|
||||||
|
//static void WorldTestMenu();
|
||||||
|
void WorldTestMenu();
|
||||||
|
};
|
37
src/test/weather_test.cpp
Normal file
37
src/test/weather_test.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "weather_test.h"
|
||||||
|
#ifdef GTASA
|
||||||
|
#include "CWeather.h"
|
||||||
|
#endif //GTASA
|
||||||
|
|
||||||
|
//What will this do?
|
||||||
|
void EarthQuakeTest()
|
||||||
|
{
|
||||||
|
float earthQuakeTest = 1.0f;
|
||||||
|
if (CWeather::Earthquake = earthQuakeTest)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the weather, I think this is delayed.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="weatherType">The weather type to be set</param>
|
||||||
|
void UpdateWeather(eWeatherType weatherType)
|
||||||
|
{
|
||||||
|
CWeather::ForcedWeatherType = weatherType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the weather now.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="weatherType">The weather type to be set</param>
|
||||||
|
void UpdateWeatherNow(eWeatherType weatherType)
|
||||||
|
{
|
||||||
|
CWeather::ForcedWeatherType = weatherType;
|
||||||
|
CWeather::OldWeatherType = weatherType;
|
||||||
|
CWeather::NewWeatherType = weatherType;
|
||||||
|
}
|
||||||
|
|
5
src/test/weather_test.h
Normal file
5
src/test/weather_test.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
class WeatherTest
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user