A small problem in my trainer
Hello, I do not understand C ++ very well, but I'm creating a simple trainer. But Im having a little problem.
The problem is as follows:
Code:
If I click to ESP works perfectly, but if I get out of the '' Misc '' tab, the option automatically stops working
That is: While I am in the sub menu option works, if I exit the sub menu are stopping working
And if I go back to the sub menu again, it works again.
Can someone help me? thank you !
The problem is as follows:
Code:
void Main() // MAIN MENU OF MY TRAINER
{
addTitle("MPGH");
addSubmenuOption("Self Options", 1);
addSubmenuOption("Players List", 2);
addSubmenuOption("Vehicle Spawner", 3);
addSubmenuOption("Teleport Options", 4);
addSubmenuOption("Weapon Options", 5);
addSubmenuOption("Weather Options", 6);
addSubmenuOption("Miscellaneous", 7); // SUB MENU MISC
void MiscOptions() // MENU MISC OPTIONS
{
addTitle("Misc");
addBoolOption("ESP TAG", nametagesp);
Code:
bool nametagesp = false;
void NameTagESP()
{
Player playerPed = PLAYER::PLAYER_PED_ID();
for (int i = 0; i < 32; i++)
{
Player playerHandle = PLAYER::GET_PLAYER_PED(i);
Vector3 handleCoords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerHandle, 0, 0, 0);
Vector3 playerCoords = ENTITY::GET_ENTITY_COORDS(playerPed, 0);
char* Name = PLAYER::GET_PLAYER_NAME(PLAYER::INT_TO_PLAYERINDEX(i));
if (ENTITY::DOES_ENTITY_EXIST(playerHandle))
{
float x1;
float y1;
BOOL screenCoords = GRAPHICS::_WORLD3D_TO_SCREEN2D(handleCoords.x, handleCoords.y, handleCoords.z, &x1, &y1);
std::string playerName = PLAYER::GET_PLAYER_NAME(PLAYER::INT_TO_PLAYERINDEX(i));
std::string nameSetupRed = "~HUD_COLOUR_RED~" + playerName;
std::string nameSetupGreen = "~HUD_COLOUR_GREEN~" + playerName;
char* playerInfoRed = new char[nameSetupRed.length() + 1];
char* playerInfoGreen = new char[nameSetupGreen.length() + 1];
std::strcpy(playerInfoRed, nameSetupRed.c_str());
std::strcpy(playerInfoGreen, nameSetupGreen.c_str());
UI::SET_TEXT_FONT(7);
UI::SET_TEXT_SCALE(0.0, 0.40);
UI::SET_TEXT_COLOUR(0, 255, 0, 255);
UI::SET_TEXT_CENTRE(0);
UI::SET_TEXT_DROPSHADOW(0, 0, 0, 0, 0);
UI::SET_TEXT_EDGE(0, 0, 0, 0, 0);
UI::_SET_TEXT_ENTRY("STRING");
if (ENTITY::HAS_ENTITY_CLEAR_LOS_TO_ENTITY(playerPed, playerHandle, 17))
{
UI::_ADD_TEXT_COMPONENT_STRING(playerInfoGreen);
}
else
{
UI::_ADD_TEXT_COMPONENT_STRING(playerInfoRed);
}
UI::_DRAW_TEXT(x1, y1);
UI::SET_TEXT_OUTLINE();
UI::SET_TEXT_DROPSHADOW(5, 0, 78, 255, 255);
}
}
}
Code:
if (getOption() == 1)
{
nametagesp = !nametagesp;
if (nametagesp == true)
{
drawNotification("Name Tag ESP: ~b~Enabled");
}
else if (nametagesp == false)
{
drawNotification("Name Tag ESP: ~r~Disabled");
}
That is: While I am in the sub menu option works, if I exit the sub menu are stopping working
And if I go back to the sub menu again, it works again.
Can someone help me? thank you !