Advertisement
Thunder-Menu

Gta5 Change Ip

Dec 11th, 2022 (edited)
1,070
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.51 KB | Gaming | 0 0
  1. std::vector<std::string> split3(const std::string& s, char delimiter)
  2. {
  3.     std::vector<std::string> tokens;
  4.     std::string token;
  5.     std::istringstream tokenStream(s);
  6.     while (std::getline(tokenStream, token, delimiter))
  7.     {
  8.         tokens.push_back(token);
  9.     }
  10.     return tokens;
  11. }
  12.  
  13. if (Menu::Option("Change IP")) {
  14.                 std::string ts(CharKeyboard());
  15.                 if ((char*)ts.c_str() != "")
  16.                 {
  17.                     Hookings::IPSpoof = ts;
  18.                     std::string point = ".";
  19.                     std::string space = " ";
  20.                     size_t pos = Hookings::IPSpoof.find(point);
  21.                     while (pos != std::string::npos)
  22.                     {
  23.                         Hookings::IPSpoof.replace(pos, point.size(), space);
  24.                         pos = Hookings::IPSpoof.find(point, pos + space.size());
  25.                     }
  26.                     std::vector<std::string> words = split3(Hookings::IPSpoof, ' ');
  27.                     Menu_Settings2::ip_address[0] = atoi(words[0].c_str());
  28.                     Menu_Settings2::ip_address[1] = atoi(words[1].c_str());
  29.                     Menu_Settings2::ip_address[2] = atoi(words[2].c_str());
  30.                     Menu_Settings2::ip_address[3] = atoi(words[3].c_str());
  31.                     Log::Msg("IPSpoofarray");
  32.                     Log::Msg((char*)words[0].c_str());
  33.                     Log::Msg((char*)words[1].c_str());
  34.                     Log::Msg((char*)words[2].c_str());
  35.                     Log::Msg((char*)words[3].c_str());
  36.                     Log::Msg("IPSpoofarray");
  37.                 }
  38.                 else
  39.                 {
  40. //****************************************************************************************************
  41.     class persist_IPchanger
  42.     {
  43.     public:
  44.         static void do_presentation_layer4();
  45.     private:
  46.         static void savelocation4(std::string name1);
  47.         static void load_location4(std::string name1);
  48.         static void delete_location4(std::string name1);
  49.         static std::vector<std::string> list_locations4();
  50.         static void save4(attachment444::attachment attachment, std::string name);
  51.         static void save_json4(nlohmann::json json);
  52.         static nlohmann::json get_locations_json4();
  53.         static std::string get_locations_config4();
  54.         /*static std::filesystem::path get_locations_config();*/
  55.     };
  56. namespace attachment444
  57. {
  58.     struct attachment
  59.     {
  60.         std::string IP;
  61.     };
  62.  
  63.     void to_json(nlohmann::json& j, const attachment& attachment);
  64.     void from_json(const nlohmann::json& j, attachment& attachment);
  65. };
  66.  
  67. //****************************************************************************************************
  68.  
  69. namespace attachment444
  70. {
  71.     void to_json(nlohmann::json& j, const attachment444::attachment& attachment) {
  72.         j = nlohmann::json{ {"IP", attachment.IP} };
  73.     }
  74.  
  75.     void from_json(const nlohmann::json& j, attachment444::attachment& attachment) {
  76.         attachment.IP = j["IP"].get<std::string>();
  77.     }
  78. };
  79.  
  80. void persist_IPchanger::savelocation4(std::string name1)
  81. {
  82.     attachment444::attachment attachment;
  83.     attachment.IP = name1;
  84.     save4(attachment, name1);
  85. }
  86.  
  87. std::string name::names3 = "";
  88. std::vector<std::string> split4(const std::string& s, char delimiter)
  89. {
  90.     std::vector<std::string> tokens;
  91.     std::string token;
  92.     std::istringstream tokenStream(s);
  93.     while (std::getline(tokenStream, token, delimiter))
  94.     {
  95.         tokens.push_back(token);
  96.     }
  97.     return tokens;
  98. }
  99.  
  100. void persist_IPchanger::load_location4(std::string name1)
  101. {
  102.     auto locations = get_locations_json4();
  103.     if (locations[name1].is_null())
  104.         return;
  105.     auto model_attachment = locations[name1].get<attachment444::attachment>();
  106.     name::names3 = model_attachment.IP;
  107.     char* chr1 = const_cast<char*>(name::names3.c_str());
  108.     Hookings::IPSpoof = name::names3;
  109.     std::string point = ".";
  110.     std::string space = " ";
  111.     size_t pos = Hookings::IPSpoof.find(point);
  112.     while (pos != std::string::npos)
  113.     {
  114.         Hookings::IPSpoof.replace(pos, point.size(), space);
  115.         pos = Hookings::IPSpoof.find(point, pos + space.size());
  116.     }
  117.     std::vector<std::string> words = split4(Hookings::IPSpoof, ' ');
  118.     Menu_Settings2::ip_address[0] = atoi(words[0].c_str());
  119.     Menu_Settings2::ip_address[1] = atoi(words[1].c_str());
  120.     Menu_Settings2::ip_address[2] = atoi(words[2].c_str());
  121.     Menu_Settings2::ip_address[3] = atoi(words[3].c_str());
  122.     Log::Msg("IPSpoofarray");
  123.     Log::Msg((char*)words[0].c_str());
  124.     Log::Msg((char*)words[1].c_str());
  125.     Log::Msg((char*)words[2].c_str());
  126.     Log::Msg((char*)words[3].c_str());
  127.     Log::Msg("IPSpoofarray");
  128.     UI::_SET_NOTIFICATION_TEXT_ENTRY("STRING");
  129.     UI::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME("~w~Change Lobby after change id");
  130.     UI::_SET_NOTIFICATION_MESSAGE_CLAN_TAG_2("CHAR_STRIPPER_CHEETAH", "CHAR_STRIPPER_CHEETAH", 1, 8, "~w~IP Changer\r\n", chr1, 1, chr1, 9, 1);
  131.     CHooking::draw_notification(false, false);
  132. }
  133.  
  134. void persist_IPchanger::delete_location4(std::string name)
  135. {
  136.     auto locations = get_locations_json4();
  137.     if (locations[name].is_null())
  138.         return;
  139.     locations.erase(name);
  140.     save_json4(locations);
  141. }
  142.  
  143. std::vector<std::string> persist_IPchanger::list_locations4()
  144. {
  145.     std::vector<std::string> return_value;
  146.     auto json = get_locations_json4();
  147.     for (auto& item : json.items())
  148.         return_value.push_back(item.key());
  149.     return return_value;
  150. }
  151. int namesavedpos3 = 0;
  152. void persist_IPchanger::do_presentation_layer4()
  153. {
  154.     auto savednames = list_locations4();
  155.     static std::string selected_name;
  156.  
  157.     int xi = 0;
  158.     std::vector<char*> charVec4(savednames.size(), nullptr);
  159.     for (int i = 0; i < savednames.size(); i++) {
  160.         charVec4[i] = &savednames[i][0];
  161.         xi = i;
  162.     }
  163.     if (xi != 0)
  164.     {
  165.         if (Menu2::ListVector("List", charVec4, namesavedpos3)) {
  166.             char* result2 = charVec4[namesavedpos3];
  167.             selected_name = result2;
  168.         }
  169.     }
  170.     if (Menu::Option("Save"))
  171.     {
  172.         std::string str = "";
  173.         GAMEPLAY::DISPLAY_ONSCREEN_KEYBOARD(true, "Enter your ID", "", "", "", "", "", 32);
  174.         while (GAMEPLAY::UPDATE_ONSCREEN_KEYBOARD() == 0) WAIT(0);
  175.         if (!GAMEPLAY::GET_ONSCREEN_KEYBOARD_RESULT()) return;
  176.         {
  177.             str = GAMEPLAY::GET_ONSCREEN_KEYBOARD_RESULT();
  178.             int intstr = headers::StringToInteger2(str.c_str());
  179.             if (intstr == 0)
  180.             {
  181.  
  182.                 /*char* usersplayers = Hooking::get_player_name(Features::playerme);*/
  183.                 std::stringstream ss;
  184.                 ss << 0;
  185.                 ss >> str;
  186.             }
  187.         }
  188.         std::string str1 = str;
  189.         char* chr1 = const_cast<char*>(str1.c_str());
  190.         Hookings::IPSpoof = str1;
  191.         std::string doublequote = "\"";
  192.         name::names3 = Hookings::IPSpoof;
  193.         Log::Msg("IPSpoofarray1");
  194.         Log::Msg((char*)name::names3.c_str());
  195.         std::string point = ".";
  196.         std::string space = " ";
  197.         size_t pos = Hookings::IPSpoof.find(point);
  198.         while (pos != std::string::npos)
  199.         {
  200.             Hookings::IPSpoof.replace(pos, point.size(), space);
  201.             pos = Hookings::IPSpoof.find(point, pos + space.size());
  202.         }
  203.  
  204.         std::vector<std::string> words = split4(Hookings::IPSpoof, ' ');
  205.         Menu_Settings2::ip_address[0] = atoi(words[0].c_str());
  206.         Menu_Settings2::ip_address[1] = atoi(words[1].c_str());
  207.         Menu_Settings2::ip_address[2] = atoi(words[2].c_str());
  208.         Menu_Settings2::ip_address[3] = atoi(words[3].c_str());
  209.         Log::Msg("IPSpoofarray");
  210.         Log::Msg((char*)words[0].c_str());
  211.         Log::Msg((char*)words[1].c_str());
  212.         Log::Msg((char*)words[2].c_str());
  213.         Log::Msg((char*)words[3].c_str());
  214.         Log::Msg("IPSpoofarray");
  215.         UI::_SET_NOTIFICATION_TEXT_ENTRY("STRING");
  216.         UI::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME("~w~Change Lobby after change ID \r\n and wait 10 seconde before change ID again");
  217.         UI::_SET_NOTIFICATION_MESSAGE_CLAN_TAG_2("CHAR_STRIPPER_CHEETAH", "CHAR_STRIPPER_CHEETAH", 1, 8, "~w~ID Changer\r\n", chr1, 1, chr1, 9, 1);
  218.         CHooking::draw_notification(false, false);
  219.         savelocation4(name::names3);
  220.         std::this_thread::sleep_for(std::chrono::milliseconds(1));
  221.     }
  222.     if (xi != 0)
  223.     {
  224.         if (Menu::Option("Load"))
  225.         {
  226.             if (!selected_name.empty())
  227.             {
  228.                 load_location4(selected_name);
  229.                 selected_name.clear();
  230.             }
  231.         }
  232.         if (Menu::Option("Delete"))
  233.         {
  234.             if (!selected_name.empty())
  235.             {
  236.                 delete_location4(selected_name);
  237.                 selected_name.clear();
  238.             }
  239.         }
  240.     }
  241. }
  242.  
  243. void persist_IPchanger::save4(attachment444::attachment attachment, std::string name)
  244. {
  245.     auto json = get_locations_json4();
  246.     json[name] = attachment;
  247.     save_json4(json);
  248. }
  249.  
  250. void persist_IPchanger::save_json4(nlohmann::json json)
  251. {
  252.     auto file_path = get_locations_config4();
  253.     std::ofstream file(file_path, std::ios::out | std::ios::trunc);
  254.     file << json.dump(4);
  255.     file.close();
  256. }
  257.  
  258. nlohmann::json persist_IPchanger::get_locations_json4()
  259. {
  260.     auto file_path = get_locations_config4();
  261.     nlohmann::json locations;
  262.     std::ifstream file(file_path);
  263.  
  264.     if (!file.fail())
  265.         file >> locations;
  266.  
  267.     return locations;
  268. }
  269.  
  270. std::string persist_IPchanger::get_locations_config4()
  271. {
  272.     OverSeeing::Overseefolder();
  273.     auto file_path = Directory::get_current_dir();
  274.     file_path += "\\ThunderMenu\\Oversee\\";
  275.     file_path += "IPSaved.json";
  276.     return file_path;
  277. }
  278.  
  279. bool Features::SnowLocal = 0;
  280.  
  281. int Features::snowonoff()
  282. {
  283.     Features::SnowLocal = !Features::SnowLocal;
  284.     return 0;
  285. }
  286.  
  287. void Features::LocalSnow()
  288. {
  289.     Features::snowonoff();
  290.     globalHandle(262145 + 4751).As<bool>() = Features::SnowLocal;
  291. }
  292.  
  293. std::string on_off1 = "";
  294. int check_On_Off1()
  295. {
  296.     if (Features::SnowLocal)
  297.     {
  298.         on_off1 = "SnowLocal on";
  299.     }
  300.     if (!Features::SnowLocal)
  301.     {
  302.         on_off1 = "SnowLocal off";
  303.     }
  304.     return 0;
  305. }
  306.  
  307.                 check_On_Off1();
  308.                 if (Menu::Option((char*)on_off1.c_str())) {
  309.                     Features::LocalSnow();
  310.                 }
  311.  
  312.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement