mirror of
https://github.com/YimMenu/YimMenuV2.git
synced 2026-10-11 09:48:08 +08:00
feat(network): join by username
This commit is contained in:
1 parent
1e14449720
commit
5cd7d1c8f0
11 files changed
+209
-7
No files matched your search
@@ -1,5 +1,6 @@
|
||||
#include "Network.hpp"
|
||||
#include "core/backend/FiberPool.hpp"
|
||||
#include "core/frontend/Notifications.hpp"
|
||||
#include "game/frontend/items/Items.hpp"
|
||||
#include "game/frontend/submenus/Network/SavedPlayers.hpp"
|
||||
#include "game/gta/Network.hpp"
|
||||
@@ -25,6 +26,24 @@ namespace YimMenu::Submenus
|
||||
joinGroup->AddItem(joinSession);
|
||||
joinGroup->AddItem(std::make_shared<ImGuiItem>([] {
|
||||
static std::uint64_t rockstar_id{};
|
||||
static char name_buf[24]{};
|
||||
|
||||
ImGui::SetNextItemWidth(180.0f);
|
||||
ImGui::InputText("Username", name_buf, sizeof(name_buf));
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Join##username"))
|
||||
FiberPool::Push([] {
|
||||
auto rid = YimMenu::Network::ResolveRockstarId(name_buf);
|
||||
if (rid)
|
||||
{
|
||||
YimMenu::Network::JoinRockstarId(*rid);
|
||||
}
|
||||
else
|
||||
{
|
||||
Notifications::Show("Joiner", "Failed to get RID from username", NotificationType::Error);
|
||||
}
|
||||
});
|
||||
|
||||
ImGui::SetNextItemWidth(150.0f);
|
||||
ImGui::InputScalar("Rockstar Id", ImGuiDataType_U64, &rockstar_id);
|
||||
ImGui::SameLine();
|
||||
|
||||
Reference in new issue
Block a user