Move player functions into functions folder, add vehicle functions.
Add game clock test, add events to their own file.
This commit is contained in:
parent
1f1137856a
commit
5539829046
@ -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())
|
||||||
|
171
src/test/events/test_events.cpp
Normal file
171
src/test/events/test_events.cpp
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
#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"
|
||||||
|
|
||||||
|
#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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
// Add test timer for this, this works!
|
||||||
|
if (game_ms - interval > 1000) {
|
||||||
|
//
|
||||||
|
KillPlayerInVehicle();
|
||||||
|
interval = game_ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
KillPlayerInMiddleOfMap();
|
||||||
|
|
||||||
|
#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();
|
||||||
|
};
|
180
src/test/functions/player_functions.cpp
Normal file
180
src/test/functions/player_functions.cpp
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
#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)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerFunctions::KillPlayer()
|
||||||
|
{
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
player->m_fHealth = 0;
|
||||||
|
player->m_fArmour = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the never wanted value, incomplete
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="toggle">If never wanted is on</param>
|
||||||
|
static void SetNeverWanted(bool toggle)
|
||||||
|
{
|
||||||
|
if(toggle)
|
||||||
|
{
|
||||||
|
// Enable never wanted
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Disable never wanted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the player as invincible, incomplete
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="toggle">If the player is invincible.</param>
|
||||||
|
static void SetInvincible(bool toggle)
|
||||||
|
{
|
||||||
|
if (toggle)
|
||||||
|
{
|
||||||
|
// Enable invincibility
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Disable invincibility
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the infinte ammo cheat, incomplete.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="toggle">If infinite ammo is active.</param>
|
||||||
|
static void SetInfiniteAmmo(bool toggle)
|
||||||
|
{
|
||||||
|
if (toggle)
|
||||||
|
{
|
||||||
|
// Enable infinite ammo
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Disable infinite ammo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This should work in here, untested
|
||||||
|
|
||||||
|
/// <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);
|
||||||
|
|
||||||
|
// https://library.sannybuilder.com/#/sa/default/018C
|
||||||
|
// These might work: https://sampwiki.blast.hk/wiki/SoundID
|
||||||
|
Command<Commands::ADD_ONE_OFF_SOUND>(playerPos.x, playerPos.y, playerPos.z, AudioIds::EXPLOSION_SOUND);
|
||||||
|
|
||||||
|
// This does about the same as above with a bit more code.
|
||||||
|
|
||||||
|
|
||||||
|
// Will this work?
|
||||||
|
//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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,6 +8,8 @@ public:
|
|||||||
PlayerFunctions();
|
PlayerFunctions();
|
||||||
PlayerFunctions(const PlayerFunctions&);
|
PlayerFunctions(const PlayerFunctions&);
|
||||||
static void KillPlayer();
|
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 IsPlayerInArea(float x1, float y1, float z1, float x2, float y2, float z2);
|
||||||
static bool IsPlayerInTrain();
|
static bool IsPlayerInTrain();
|
||||||
};
|
};
|
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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the players current vehicle is in the water
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>If the current vehicle is in water.</returns>
|
||||||
|
bool VehicleFunctions::IsCarInWater()
|
||||||
|
{
|
||||||
|
#ifdef GTASA
|
||||||
|
CPlayerPed* player = FindPlayerPed();
|
||||||
|
int hplayer = CPools::GetPedRef(player);
|
||||||
|
CVehicle* pVeh = nullptr;
|
||||||
|
|
||||||
|
// TODO Possibly Move this into a vehicle_functions file.
|
||||||
|
// First we check if the player is in a vehicle
|
||||||
|
if (PlayerFunctions::IsPlayerInVehicle()) {
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// If the car is in water
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif //GTASA
|
||||||
|
}
|
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();
|
||||||
|
};
|
@ -1,106 +0,0 @@
|
|||||||
#include "pch.h"
|
|
||||||
#include "player_functions.h"
|
|
||||||
|
|
||||||
PlayerFunctions::PlayerFunctions()
|
|
||||||
{
|
|
||||||
//if (m_bRespawnMiddleOfMap)
|
|
||||||
//{
|
|
||||||
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlayerFunctions::KillPlayer()
|
|
||||||
{
|
|
||||||
CPlayerPed* player = FindPlayerPed();
|
|
||||||
player->m_fHealth = 0;
|
|
||||||
player->m_fArmour = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SetNeverWanted(bool toggle)
|
|
||||||
{
|
|
||||||
if(toggle)
|
|
||||||
{
|
|
||||||
// Enable never wanted
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Disable never wanted
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SetInvincible(bool toggle)
|
|
||||||
{
|
|
||||||
if (toggle)
|
|
||||||
{
|
|
||||||
// Enable invincibility
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Disable invincibility
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SetInfiniteAmmo(bool toggle)
|
|
||||||
{
|
|
||||||
if (toggle)
|
|
||||||
{
|
|
||||||
// Enable infinite ammo
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Disable infinite ammo
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//static bool IsPlayerInCar()
|
|
||||||
//{
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// This is untested but it should work.
|
|
||||||
/// <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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -18,6 +18,9 @@
|
|||||||
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 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
|
// 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.
|
// memory addresses or anything in it.
|
||||||
@ -33,6 +36,9 @@
|
|||||||
// Set ped vehicle multipler: https://library.sannybuilder.com/#/sa/default/01EB
|
// 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"
|
||||||
@ -86,7 +92,8 @@
|
|||||||
#include "test_hud.h"
|
#include "test_hud.h"
|
||||||
#include "test_ped.h"
|
#include "test_ped.h"
|
||||||
#include "test_world.h"
|
#include "test_world.h"
|
||||||
#include "player_functions.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.
|
||||||
@ -292,6 +299,7 @@ void TestPage::Draw()
|
|||||||
if (ImGui::Button("Play Mission Passed"))
|
if (ImGui::Button("Play Mission Passed"))
|
||||||
{
|
{
|
||||||
// https://library.sannybuilder.com/#/sa/default/0394
|
// https://library.sannybuilder.com/#/sa/default/0394
|
||||||
|
|
||||||
Command<Commands::PLAY_MISSION_PASSED_TUNE>(1);
|
Command<Commands::PLAY_MISSION_PASSED_TUNE>(1);
|
||||||
//bool isFlyingActive = CCheat::m_aCheatsActive);
|
//bool isFlyingActive = CCheat::m_aCheatsActive);
|
||||||
//Util::SetMessage(std::format("Is Flying Active: {}", isFlyingActive).c_str());
|
//Util::SetMessage(std::format("Is Flying Active: {}", isFlyingActive).c_str());
|
||||||
@ -331,6 +339,29 @@ void TestPage::Draw()
|
|||||||
//////
|
//////
|
||||||
// New
|
// New
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
ImGui::Text("In game clock");
|
||||||
|
|
||||||
|
|
||||||
|
//if (ImGui::Button("Show mili Seconds?"))
|
||||||
|
//{
|
||||||
|
// short currentGameSeconds = CClock::ms_nGameClockSeconds;
|
||||||
|
// Util::SetMessage(std::format("ms {}", currentGameSeconds).c_str());
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (ImGui::Button("Show hours"))
|
||||||
|
{
|
||||||
|
short currentGameHours = CClock::ms_nGameClockHours;
|
||||||
|
Util::SetMessage(std::format("Hour: {}", currentGameHours).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button("Show Minutes"))
|
||||||
|
{
|
||||||
|
short currentGameMinutes = CClock::ms_nGameClockMinutes;
|
||||||
|
Util::SetMessage(std::format("Minute: {}", currentGameMinutes).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Train Menu
|
||||||
TrainTestMenu();
|
TrainTestMenu();
|
||||||
//////
|
//////
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user