Add player functions class, update test hud class.
Add sound testing, spawn random ped, change respawn point to somewhere and reset it, mess around with events.
This commit is contained in:
parent
c3f56a3c25
commit
2362fd41d7
106
src/test/player_functions.cpp
Normal file
106
src/test/player_functions.cpp
Normal file
@ -0,0 +1,106 @@
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
13
src/test/player_functions.h
Normal file
13
src/test/player_functions.h
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
//#include "pch.h"
|
||||
|
||||
class PlayerFunctions
|
||||
{
|
||||
public:
|
||||
bool m_bRespawnMiddleOfMap;
|
||||
PlayerFunctions();
|
||||
PlayerFunctions(const PlayerFunctions&);
|
||||
static void KillPlayer();
|
||||
static bool IsPlayerInArea(float x1, float y1, float z1, float x2, float y2, float z2);
|
||||
static bool IsPlayerInTrain();
|
||||
};
|
@ -4,6 +4,23 @@
|
||||
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()
|
||||
{
|
||||
@ -37,21 +54,13 @@ static void ToggleHudMenu()
|
||||
}
|
||||
}
|
||||
|
||||
#endif //GTASA
|
||||
|
||||
/// <summary>
|
||||
/// Main code for HudTestMenu
|
||||
/// </summary>
|
||||
void HudTestPage::HudTestMenu()
|
||||
{
|
||||
|
||||
// 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
|
||||
ToggleHudMenu();
|
||||
ToggleRadarMenu();
|
||||
|
@ -4,9 +4,9 @@
|
||||
class HudTestPage
|
||||
{
|
||||
private:
|
||||
HudTestPage();
|
||||
HudTestPage(const HudTestPage&);
|
||||
void Draw();
|
||||
public:
|
||||
static void HudTestMenu();
|
||||
HudTestPage();
|
||||
HudTestPage(const HudTestPage&);
|
||||
void HudTestMenu();
|
||||
};
|
||||
|
@ -1,16 +1,79 @@
|
||||
#include "pch.h"
|
||||
#include "test_ped.h"
|
||||
#include "utils/widget.h"
|
||||
|
||||
#ifdef GTASA
|
||||
#include "CExplosion.h"
|
||||
#include "CPopulation.h"
|
||||
#include "CTaskComplexWanderStandard.h"
|
||||
#endif
|
||||
|
||||
// My code
|
||||
#include "player_functions.h"
|
||||
|
||||
// Incomplete.
|
||||
// https://library.sannybuilder.com/#/sa/default/0672
|
||||
//Command<Commands::TASK_DESTROY_CAR>(pPed);
|
||||
|
||||
|
||||
PedTestPage::PedTestPage()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool playerCanDrown = true;
|
||||
|
||||
// https://sampwiki.blast.hk/wiki/SoundID
|
||||
enum soundIds {
|
||||
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,
|
||||
};
|
||||
|
||||
//static std::vector<int> soundIds = {
|
||||
static std::vector<std::string> soundIds = {
|
||||
std::to_string(BLANK_SOUND), std::to_string(CRASH_SOUND), std::to_string(GARAGE_DOOR_OPENING),
|
||||
std::to_string(SELECTION_SOUND), std::to_string(METALLIC_FENCE_RATTLE1),
|
||||
std::to_string(METALLIC_FENCE_RATTLE2), std::to_string(SPRAY_CAN),
|
||||
std::to_string(CRASH1_SOUND), std::to_string(CRASH2_SOUND), std::to_string(THROW_SATCHEL_SOUND), std::to_string(CAR_HORN),
|
||||
std::to_string(BLIP_SOUND), std::to_string(EXPLOSION_SOUND),
|
||||
std::to_string(HANGER_DOORS), std::to_string(DRIVING_SCHOOL_RESULTS_MUSIC),
|
||||
std::to_string(BIKE_BOAT_SCHOOL_RESULTS_MUSIC), std::to_string(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
|
||||
//};
|
||||
|
||||
// Taken from plugin-sdk examples under PedSpawner in Main.cpp
|
||||
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 };
|
||||
|
||||
static void SuicideMenu()
|
||||
{
|
||||
#ifdef GTASA
|
||||
@ -26,6 +89,8 @@ static void SuicideMenu()
|
||||
#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
|
||||
@ -40,10 +105,70 @@ static void BombMenu()
|
||||
// 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
|
||||
//Command<Commands::ADD_ONE_OFF_SOUND>(playerPos.x, playerPos.y, playerPos.z, 1159);
|
||||
Command<Commands::ADD_ONE_OFF_SOUND>(playerPos.x, playerPos.y, playerPos.z, 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
|
||||
}
|
||||
|
||||
// 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
|
||||
@ -77,8 +202,9 @@ static void ShowMarkerCoordsMenu()
|
||||
#ifdef GTASA
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
|
||||
//if (ImGui::Button("Show Marker Coords"))
|
||||
//{
|
||||
if (ImGui::Button("Show Marker Coords"))
|
||||
{
|
||||
Util::SetMessage("Not implemented yet!");
|
||||
|
||||
// if (Command<Commands::DOES_BLIP_EXIST>())
|
||||
// {
|
||||
@ -88,7 +214,9 @@ static void ShowMarkerCoordsMenu()
|
||||
// }
|
||||
// //Command<Commands::BLIP>(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR);
|
||||
|
||||
//}
|
||||
}
|
||||
#else
|
||||
Util::SetMessage("No markers in VC or 3!");
|
||||
#endif //GTASA
|
||||
}
|
||||
|
||||
@ -116,8 +244,8 @@ static void TogglePlayerDrownMenu()
|
||||
|
||||
static void GravityValuesMenu()
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
#ifdef GTASA
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Gravity Values");
|
||||
//ImGui::Columns(4);
|
||||
@ -153,98 +281,272 @@ static void GravityValuesMenu()
|
||||
#endif //GTASA
|
||||
}
|
||||
|
||||
|
||||
// Very WIP and incomplete.
|
||||
static void SpawnPedMenu()
|
||||
// This should spawn a random ped.
|
||||
#ifdef GTASA
|
||||
static void 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
|
||||
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);
|
||||
|
||||
/*
|
||||
* void PedPage::AddNewPed()
|
||||
Example for what i'm trying to do spawning in a ped.
|
||||
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);
|
||||
m_PedData.m_pData->Set(key.c_str(), std::to_string(model));
|
||||
m_PedData.m_pData->Save();
|
||||
Util::SetMessage(TEXT("Ped.AddPedMSG"));
|
||||
Command<Commands::MARK_MODEL_AS_NO_LONGER_NEEDED>(model);
|
||||
if (ped)
|
||||
{
|
||||
// Is this getting the offset for the coordinates?
|
||||
ped->SetPosn(FindPlayerPed()->TransformFromObjectSpace(CVector(0.0f, 5.0f, 3.0f)));
|
||||
ped->SetOrientation(0.0f, 0.0f, 0.0f);
|
||||
CWorld::Add(ped);
|
||||
ped->PositionAnyPedOutOfCollision();
|
||||
ped->m_pIntelligence->m_TaskMgr.SetTask(new CTaskComplexWanderStandard(4, rand() % 8, true), 4, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
static void SpawnPedMenu()
|
||||
{
|
||||
Util::SetMessage(TEXT("Vehicle.InvalidID"));
|
||||
if (ImGui::Button("Spawn Ped")) {
|
||||
SpawnRandomPed();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
// First request the model
|
||||
// Then load all models
|
||||
// Lastly check if the model is available.
|
||||
// If not say "Invalid model"
|
||||
#endif //GTASA
|
||||
|
||||
//
|
||||
//if (ImGui::Button("Spawn Ped"))
|
||||
//{
|
||||
// //CPed* pPed = new CPed::;
|
||||
// //CWaterLevel::
|
||||
// //CWorld::Add()
|
||||
//}
|
||||
// TODO Remove this later.
|
||||
/// <summary>
|
||||
/// Area check test.
|
||||
/// This seems to work.
|
||||
/// </summary>
|
||||
static void AreaCheckTest()
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(player);
|
||||
|
||||
//if (ImGui::Button("Spawn ped to attack vehicle"))
|
||||
//{
|
||||
// Util::SetMessage("Not setup!");
|
||||
//}
|
||||
CVector playerPos = player->GetPosition();
|
||||
// TODO Setup some random coords for this
|
||||
CVector testLocationArea1 = CVector(2, 2, 2);
|
||||
CVector testLocationArea2 = CVector(20, 20, 20);
|
||||
|
||||
/*
|
||||
if (ImGui::CollapsingHeader("Spawner"))
|
||||
{
|
||||
// PedPage::AddNewPed
|
||||
// This doesn't work yet.
|
||||
//#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);
|
||||
// https://library.sannybuilder.com/#/sa/default/00A4
|
||||
//Command<Commands::IS_CHAR_IN_AREA_3D>(hplayer,
|
||||
// testLocationArea1.x, testLocationArea1.y, testLocationArea1.z,
|
||||
// testLocationArea2.x, testLocationArea2.y, testLocationArea2.z, true);
|
||||
|
||||
// Will this work?
|
||||
if (Command<Commands::IS_CHAR_IN_AREA_3D>(hplayer,
|
||||
testLocationArea1.x, testLocationArea1.y, testLocationArea1.z,
|
||||
testLocationArea2.x, testLocationArea2.y, testLocationArea2.z, true)) {
|
||||
|
||||
Util::SetMessage("You are in the zone!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Util::SetMessage(TEXT("Vehicle.InvalidID"));
|
||||
Util::SetMessage("You are not in the zone!");
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Remove this later.
|
||||
/// <summary>
|
||||
/// Working on a new method for this.
|
||||
/// Kill the player when the enter this area, fires off with an event below.
|
||||
/// Returns true if the player is in the specified coords.
|
||||
/// </summary>
|
||||
static bool IsPlayerInArea()
|
||||
{
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
int hplayer = CPools::GetPedRef(player);
|
||||
|
||||
CVector playerPos = player->GetPosition();
|
||||
// TODO Setup some random coords for this
|
||||
CVector testLocationArea1 = CVector(2, 2, 2);
|
||||
CVector testLocationArea2 = CVector(20, 20, 20);
|
||||
|
||||
// https://library.sannybuilder.com/#/sa/default/00A4
|
||||
|
||||
// This seems to work fine.
|
||||
if (Command<Commands::IS_CHAR_IN_AREA_3D>(hplayer,
|
||||
testLocationArea1.x, testLocationArea1.y, testLocationArea1.z,
|
||||
testLocationArea2.x, testLocationArea2.y, testLocationArea2.z, false)) {
|
||||
|
||||
return true;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(TEXT("Ped.GetPlayerModel"), sz))
|
||||
else
|
||||
{
|
||||
model = FindPlayerPed()->m_nModelIndex;
|
||||
return false;
|
||||
}
|
||||
#endif //_DISABLED_CODE
|
||||
*/
|
||||
}
|
||||
|
||||
// TODO Make this use the function I have defined in the PlayerFunctions class.
|
||||
static void AreaCheckTestMenu()
|
||||
{
|
||||
ImGui::Text("Area Check testing.");
|
||||
if (ImGui::Button("Check Area #1")) {
|
||||
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
|
||||
#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;
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
/// <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.
|
||||
#ifdef _TEST
|
||||
// This seems to work for killing the player in the area.
|
||||
if (IsPlayerInArea()) {
|
||||
|
||||
//KillPlayer();
|
||||
//PlayerFunctions::KillPlayer();
|
||||
//Util::SetMessage("Welcome to the circle");
|
||||
//AreaCheckTest();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//Util::SetMessage("You will now die!");
|
||||
}
|
||||
|
||||
#endif //_TEST1
|
||||
};
|
||||
|
||||
SuicideMenu();
|
||||
BombMenu();
|
||||
ShowCoordsMenu();
|
||||
ShowMarkerCoordsMenu();
|
||||
TogglePlayerDrownMenu();
|
||||
GravityValuesMenu();
|
||||
ImGui::Separator();
|
||||
|
||||
// Test features
|
||||
#ifdef _TEST
|
||||
SoundMenu();
|
||||
ImGui::Separator();
|
||||
#ifdef GTASA
|
||||
SpawnPedMenu();
|
||||
|
||||
// New
|
||||
// Respawn stuff
|
||||
TestChangeRespawnMenu();
|
||||
SetRespawnMiddleOfMapMenu();
|
||||
|
||||
#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();
|
||||
#endif //TEST
|
||||
|
||||
}
|
@ -4,10 +4,10 @@
|
||||
class PedTestPage
|
||||
{
|
||||
private:
|
||||
PedTestPage();
|
||||
PedTestPage(const PedTestPage&);
|
||||
void Draw();
|
||||
public:
|
||||
PedTestPage();
|
||||
PedTestPage(const PedTestPage&);
|
||||
//static void PedTestMenu();
|
||||
static void PlayerTestMenu();
|
||||
void PlayerTestMenu();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user