Bug fixed & tweaks

1. Added check for silentpatch
2. Trains can now be spawned on both tracks
3. Vehicles no longer get buried while teleporting
4. Added more vehicle flags
This commit is contained in:
Grinch_ 2020-12-25 01:31:26 +06:00
parent 47d1dab0c2
commit 4c61b5c7d6
8 changed files with 70 additions and 31 deletions

View File

@ -23,7 +23,7 @@ A portuguese translation of the menu is [here](https://github.com/Dowglass/Cheat
1. Install [DirectX9](https://www.microsoft.com/en-us/download/details.aspx?id=35) & [Visual C++ Redistributable 2015 x86](https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe) if not already installed.
2. If your game version isn't v1.0 then you'll need to [downgrade](https://gtaforums.com/topic/927016-san-andreas-downgrader/).
3. Install asi loader from [here](https://www.gtagarage.com/mods/show.php?id=21709)
3. Install [asi loader](https://www.gtagarage.com/mods/show.php?id=21709) & [silent patch](https://gtaforums.com/topic/669045-silentpatch/)
4. Download CheatMenu and extract everything in game directory (replace if necessary).
## Building

View File

@ -48,14 +48,11 @@ CheatMenu::CheatMenu()
Events::initRwEvent += []()
{
flog << "Log Started." << std::endl;
// Load menu settings
Globals::header_id = config.GetValueStr("window.id","");
Globals::menu_size.x = config.GetValue("window.sizeX", screen::GetScreenWidth() / 4.0f);
Globals::menu_size.y = config.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f);
srand(CTimer::m_snTimeInMilliseconds);
};
Events::processScriptsEvent += [this]
@ -74,13 +71,12 @@ CheatMenu::CheatMenu()
Globals::last_key_timer = CTimer::m_snTimeInMilliseconds;
}
bool windows_visible = Globals::show_menu || Menu::commands::show_menu;
if (Hook::show_mouse != windows_visible)
if (Hook::show_mouse != Globals::show_menu)
{
if (Hook::show_mouse) // Only write when the menu closes
config.WriteToDisk();
Hook::show_mouse = windows_visible;
Hook::show_mouse = Globals::show_menu;
}
}
};

View File

@ -49,6 +49,16 @@ public:
launch = false;
}
/*
WndProc is extremely buggy without SilentPatch
Should have a better fix for this but everyone should have
SilentPatch installed so mehh...
*/
if (!GetModuleHandleA("SilentPatchSA.asi")) {
MessageBox(HWND_DESKTOP, "SilentPatch isn't installed. Exiting CheatMenu.", "CheatMenu", MB_ICONERROR);
launch = false;
}
if (launch)
{
flog << "Loading CheatMenu" << std::endl;

View File

@ -15,6 +15,7 @@ std::function<void()> Hook::window_func = NULL;
LRESULT Hook::InputProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam);
if (ImGui::GetIO().WantTextInput)
@ -24,6 +25,7 @@ LRESULT Hook::InputProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
}
else
return CallWindowProc(oWndProc, hWnd, uMsg, wParam, lParam);
}
HRESULT Hook::ResetDx9(IDirect3DDevice9 * pDevice, D3DPRESENT_PARAMETERS * pPresentationParameters)

View File

@ -91,7 +91,8 @@ Teleport::Teleport()
void Teleport::TeleportPlayer(bool get_marker, CVector* pos, short interior_id)
{
CPlayerPed* player = FindPlayerPed();
CPlayerPed *player = FindPlayerPed();
CVehicle *pVeh = player->m_pVehicle;
if (get_marker)
{
@ -118,15 +119,19 @@ void Teleport::TeleportPlayer(bool get_marker, CVector* pos, short interior_id)
CStreaming::LoadSceneCollision(&Teleport::STeleport::pos);
CStreaming::LoadAllRequestedModels(false);
if (player->m_pVehicle)
if (pVeh)
{
player->m_pVehicle->Teleport(CVector(pos->x, pos->y, pos->z), false);
Command<Commands::SET_VEHICLE_AREA_VISIBLE>(CPools::GetVehicleRef(player->m_pVehicle), interior_id); // setvehicleinterior
pVeh->Teleport(CVector(pos->x, pos->y, pos->z), false);
if (pVeh->m_nVehicleClass == VEHICLE_BIKE)
reinterpret_cast<CBike*>(pVeh)->PlaceOnRoadProperly();
else if (pVeh->m_nVehicleClass != VEHICLE_BOAT)
reinterpret_cast<CAutomobile*>(pVeh)->PlaceOnRoadProperly();
pVeh->m_nAreaCode = interior_id;
}
else
player->Teleport(CVector(pos->x, pos->y, pos->z), false);
Command<Commands::SET_CHAR_AREA_VISIBLE>(CPools::GetPedRef(player), interior_id); // setcharinterior
Command<Commands::SET_AREA_VISIBLE>(interior_id);
}

View File

@ -117,7 +117,7 @@ void Ui::DrawHeaders(unsortedMap& data)
// Show Welcome page
ImGui::NewLine();
std::string title = "Welcome to " + Globals::menu_title + " (" + BUILD_NUMBER + ")";
std::string title = "Welcome to " + Globals::menu_title;
Ui::CenterdText(title.c_str());
Ui::CenterdText("Author: Grinch_");
@ -133,7 +133,7 @@ void Ui::DrawHeaders(unsortedMap& data)
ShellExecute(NULL, "open", GITHUB_LINK, NULL, NULL, SW_SHOWNORMAL);
ImGui::NewLine();
ImGui::TextWrapped("If you find bugs or have suggestions, you can let me know at discord :)");
ImGui::TextWrapped("If you find bugs or have suggestions, you can let me know on discord :)");
ImGui::NewLine();
Ui::CenterdText("Copyright GPLv3 2019-2021");
}

View File

@ -406,8 +406,7 @@ void Vehicle::SpawnVehicle(std::string &smodel)
int imodel = std::stoi(smodel);
CVehicle *veh = nullptr;
int interior = 0;
Command<Commands::GET_CHAR_AREA_VISIBLE>(hplayer, &interior);
int interior = player->m_nAreaCode;
if (Command<Commands::IS_MODEL_AVAILABLE>(imodel))
{
@ -456,9 +455,15 @@ void Vehicle::SpawnVehicle(std::string &smodel)
CStreaming::RequestModel(449, PRIORITY_REQUEST);
CStreaming::LoadAllRequestedModels(false);
Command<Commands::CREATE_MISSION_TRAIN>(train_id, pos.x, pos.y, pos.z, (CTimer::m_snTimeInMilliseconds % 2 == 0) ? true : false, &hveh);
veh = CPools::GetVehicle(hveh);
CTrain *train = nullptr;
CTrain *carraige = nullptr;
int track = rand() % 2;
int node = CTrain::FindClosestTrackNode(pos,&track);
CTrain::CreateMissionTrain(pos,(rand() % 2) == 1 ? true : false,train_id,&train,&carraige,node,track,false);
veh = (CVehicle*)train;
hveh = CPools::GetVehicleRef(veh);
if (veh->m_pDriver)
Command<Commands::DELETE_CHAR>(CPools::GetPedRef(veh->m_pDriver));
@ -468,7 +473,7 @@ void Vehicle::SpawnVehicle(std::string &smodel)
Command<Commands::SET_CAR_FORWARD_SPEED>(hveh, speed);
}
Command<Commands::MARK_MISSION_TRAIN_AS_NO_LONGER_NEEDED>(hveh);
Command<Commands::MARK_CAR_AS_NO_LONGER_NEEDED>(hveh);
CStreaming::SetModelIsDeletable(590);
CStreaming::SetModelIsDeletable(538);
CStreaming::SetModelIsDeletable(570);
@ -484,9 +489,9 @@ void Vehicle::SpawnVehicle(std::string &smodel)
if (spawner::license_text != "")
Command<Commands::CUSTOM_PLATE_FOR_NEXT_CAR>(imodel, spawner::license_text);
int hveh = 0;
if (spawner::spawn_inside)
{
int hveh = 0;
Command<Commands::CREATE_CAR>(imodel, pos.x, pos.y, pos.z + 4.0f, &hveh);
veh = CPools::GetVehicle(hveh);
veh->SetHeading(player->GetHeading());
@ -495,18 +500,17 @@ void Vehicle::SpawnVehicle(std::string &smodel)
}
else
{
int hveh = 0;
player->TransformFromObjectSpace(pos, CVector(0, 10, 0));
Command<Commands::CREATE_CAR>(imodel, pos.x, pos.y, pos.z + 4.0f, &hveh);
veh = CPools::GetVehicle(hveh);
veh->SetHeading(player->GetHeading()+55.0f);
}
veh->m_nAreaCode = interior;
Command<Commands::MARK_CAR_AS_NO_LONGER_NEEDED>(CPools::GetVehicleRef(veh));
CStreaming::SetModelIsDeletable(imodel);
}
if(veh)
Command<Commands::SET_VEHICLE_AREA_VISIBLE>(CPools::GetVehicleRef(veh), interior);
veh->m_nVehicleFlags.bHasBeenOwnedByPlayer = true;
}
}
@ -673,7 +677,11 @@ void Vehicle::Main()
ImGui::Columns(2, 0, false);
bool state = pVeh->m_nPhysicalFlags.bBulletProof;
bool state = pVeh->m_nVehicleFlags.bAlwaysSkidMarks;
if (Ui::CheckboxWithHint("Always skid marks", &state, nullptr))
pVeh->m_nVehicleFlags.bAlwaysSkidMarks = state;
state = pVeh->m_nPhysicalFlags.bBulletProof;
if (Ui::CheckboxWithHint("Bullet proof", &state, nullptr, veh_nodmg))
pVeh->m_nPhysicalFlags.bBulletProof = state;
@ -681,6 +689,14 @@ void Vehicle::Main()
if (Ui::CheckboxWithHint("Collision proof", &state, nullptr, veh_nodmg))
pVeh->m_nPhysicalFlags.bCollisionProof = state;
state = pVeh->m_nVehicleFlags.bDisableParticles;
if (Ui::CheckboxWithHint("Disable particles", &state, nullptr))
pVeh->m_nVehicleFlags.bDisableParticles = state;
state = pVeh->m_nVehicleFlags.bVehicleCanBeTargetted;
if (Ui::CheckboxWithHint("Driver targetable", &state, "Driver can be targeted"))
pVeh->m_nVehicleFlags.bVehicleCanBeTargetted = state;
state = !pVeh->m_nVehicleFlags.bEngineBroken || pVeh->m_nVehicleFlags.bEngineOn;
if (Ui::CheckboxWithHint("Engine on", &state, nullptr, !is_driver))
{
@ -691,11 +707,15 @@ void Vehicle::Main()
if (Ui::CheckboxWithHint("Explosion proof", &state, nullptr, veh_nodmg))
pVeh->m_nPhysicalFlags.bExplosionProof = state;
ImGui::NextColumn();
state = pVeh->m_nPhysicalFlags.bFireProof;
if (Ui::CheckboxWithHint("Fire proof", &state, nullptr, veh_nodmg))
pVeh->m_nPhysicalFlags.bFireProof = state;
ImGui::NextColumn();
state = pVeh->m_nVehicleFlags.bVehicleCanBeTargettedByHS;
if (Ui::CheckboxWithHint("HS targetable", &state, "Heat Seaker missile can target this"))
pVeh->m_nVehicleFlags.bVehicleCanBeTargettedByHS = state;
state = !pVeh->m_bIsVisible;
if (Ui::CheckboxWithHint("Invisible car", &state, nullptr, !is_driver))
@ -718,6 +738,10 @@ void Vehicle::Main()
if (Ui::CheckboxWithHint("Melee proof", &state, nullptr, veh_nodmg))
pVeh->m_nPhysicalFlags.bMeeleProof = state;
state = pVeh->m_nVehicleFlags.bTakeLessDamage;
if (Ui::CheckboxWithHint("Take less dmg", &state, nullptr))
pVeh->m_nVehicleFlags.bTakeLessDamage = state;
ImGui::Columns(1);
}

View File

@ -4,7 +4,7 @@
#define INPUT_BUFFER_SIZE 64
#define SPAWN_PED_LIMIT 20
#define MENU_VERSION "2.5-beta"
#define BUILD_NUMBER "20201220"
#define BUILD_NUMBER "20201225"
#define STB_IMAGE_IMPLEMENTATION
#define DISCORD_INVITE "https://discord.gg/ZzW7kmf"
#define GITHUB_LINK "https://github.com/user-grinch/Cheat-Menu"
@ -23,6 +23,7 @@
#include <windows.h>
#include "plugin.h"
#include "CBike.h"
#include "CCamera.h"
#include "CCheat.h"
#include "CClothes.h"
@ -43,6 +44,7 @@
#include "CTheZones.h"
#include "CTimer.h"
#include "CTimeCycle.h"
#include "CTrain.h"
#include "CWeather.h"
#include "CWorld.h"
#include "extensions/ScriptCommands.h"