refactor(PlayerWindow): Restructured in tab bar

This commit is contained in:
Yimura 2021-01-16 13:52:29 +01:00
parent f737495ee5
commit bd4b49a138
6 changed files with 208 additions and 149 deletions

View File

@ -25,6 +25,9 @@ namespace big
static void render_settings();
static void player_info();
static void player_griefing();
static void player_teleport();
static void player_drop();
};
}

View File

@ -0,0 +1,22 @@
#include "gui/tab_bar.hpp"
namespace big
{
void tabbar::player_drop()
{
if (ImGui::BeginTabItem("Drop"))
{
if (ImGui::Button("Drop Money (!)"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
Vector3 coords = ENTITY::GET_ENTITY_COORDS(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), true);
features::functions::create_ambient_money(coords, rand() % 500 + 2000);
}QUEUE_JOB_END_CLAUSE
}
ImGui::EndTabItem();
}
}
}

View File

@ -0,0 +1,137 @@
#include "gui/tab_bar.hpp"
#include "pointers.hpp"
namespace big
{
void tabbar::player_griefing()
{
if (ImGui::BeginTabItem("Griefing"))
{
if (ImGui::Button("Cage"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
features::functions::cage_ped(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id));
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::TreeNode("Lester"))
{
if (ImGui::Button("Bounty 10k"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
features::functions::set_player_bounty(g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
ImGui::TreePop();
}
if (ImGui::TreeNode("Kick"))
{
if (ImGui::Button("Kick (Host) - Permanently Blacklisted"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
if (NETWORK::NETWORK_IS_HOST())
{
NETWORK::NETWORK_SESSION_KICK_PLAYER(g_selectedPlayer.id);
}
else
{
features::notify::above_map("You aren't the host");
}
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("Kick (Non-Host)"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
int64_t args[4] = { 0, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), 0, 0 };
for (int64_t kick_hash : kick_hashes)
{
args[0] = kick_hash;
g_pointers->m_trigger_script_event(true, args, 4, 1 << g_selectedPlayer.id);
}
}QUEUE_JOB_END_CLAUSE
}
ImGui::TreePop();
}
if (ImGui::TreeNode("Script Events"))
{
if (ImGui::Button("Kick from Vehicle"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
int64_t args[2] = { RemoteEvents::VehicleKick, g_selectedPlayer.id };
g_pointers->m_trigger_script_event(true, args, 2, 1 << g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("CEO Kick"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
int64_t ceokick[4] = { RemoteEvents::CeoKick, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), 0, 0 };
g_pointers->m_trigger_script_event(true, ceokick, 4, 1 << g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("CEO Ban"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
int64_t ceoban[4] = { RemoteEvents::CeoBan, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), 1, 5 };
g_pointers->m_trigger_script_event(true, ceoban, 4, 1 << g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("Send to Job"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
int64_t args[2] = { RemoteEvents::ForceMission, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id) };
g_pointers->m_trigger_script_event(true, args, 2, 1 << g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
ImGui::Text("Force TP Location:");
if (ImGui::BeginCombo("##teleport_location", locations[g_temp.teleport_location].name))
{
for (uint8_t i = 0; i < IM_ARRAYSIZE(locations); i++)
{
bool is_selected = (g_temp.teleport_location == i);
if (ImGui::Selectable(locations[i].name, is_selected))
g_temp.teleport_location = i;
if (is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
if (ImGui::Button("Teleport to selected location."))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
int64_t args[9] = { RemoteEvents::Teleport, g_selectedPlayer.id, 1, -1, 1, locations[g_temp.teleport_location].id, 0,0,0 }; // 1097312011
g_pointers->m_trigger_script_event(true, args, 9, 1 << g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
ImGui::TreePop();
}
ImGui::EndTabItem();
}
}
}

View File

@ -0,0 +1,14 @@
#include "gui/tab_bar.hpp"
namespace big
{
void tabbar::player_info()
{
if (ImGui::BeginTabItem("Info"))
{
ImGui::Checkbox("Spectate Player", &g_temp.spectate_player);
ImGui::EndTabItem();
}
}
}

View File

@ -0,0 +1,28 @@
#include "gui/tab_bar.hpp"
namespace big
{
void tabbar::player_teleport()
{
if (ImGui::BeginTabItem("Teleport"))
{
if (ImGui::Button("Teleport to Player"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
features::teleport::teleport_to_player(g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("Teleport into Vehicle"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
features::teleport::teleport_into_player_vehicle(g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
ImGui::EndTabItem();
}
}
}

View File

@ -1,7 +1,5 @@
#include "gui/window.hpp"
#include "gui/tab_bar.hpp"
#include "features.hpp"
#include "pointers.hpp"
namespace big
{
@ -20,155 +18,12 @@ namespace big
}
ImGui::BeginTabBar("tabbar_player");
tabbar::player_info();
tabbar::player_griefing();
tabbar::player_teleport();
tabbar::player_drop();
ImGui::EndTabBar();
ImGui::Separator();
ImGui::Separator();
if (ImGui::Button("Bounty 10k"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
features::functions::set_player_bounty(g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
ImGui::Separator();
if (ImGui::Button("Teleport to Player"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
features::teleport::teleport_to_player(g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("Teleport into Vehicle"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
features::teleport::teleport_into_player_vehicle(g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
ImGui::Separator();
if (ImGui::Button("Kick (Host) - Permanently Blacklisted"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
if (NETWORK::NETWORK_IS_HOST())
{
NETWORK::NETWORK_SESSION_KICK_PLAYER(g_selectedPlayer.id);
}
else
{
features::notify::above_map("You aren't the host");
}
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("Kick (Non-Host)"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
int64_t args[4] = { 0, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), 0, 0 };
for (int64_t kick_hash : kick_hashes)
{
args[0] = kick_hash;
g_pointers->m_trigger_script_event(true, args, 4, 1 << g_selectedPlayer.id);
}
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("Kick from Vehicle"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
int64_t args[2] = { RemoteEvents::VehicleKick, g_selectedPlayer.id };
g_pointers->m_trigger_script_event(true, args, 2, 1 << g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("CEO Kick"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
int64_t ceokick[4] = { RemoteEvents::CeoKick, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), 0, 0 };
g_pointers->m_trigger_script_event(true, ceokick, 4, 1 << g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("CEO Ban"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
int64_t ceoban[4] = { RemoteEvents::CeoBan, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), 1, 5 };
g_pointers->m_trigger_script_event(true, ceoban, 4, 1 << g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("Send to Job"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
int64_t args[2] = { RemoteEvents::ForceMission, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id) };
g_pointers->m_trigger_script_event(true, args, 2, 1 << g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
ImGui::Text("Force TP Location:");
if (ImGui::BeginCombo("##teleport_location", locations[g_temp.teleport_location].name))
{
for (uint8_t i = 0; i < IM_ARRAYSIZE(locations); i++)
{
bool is_selected = (g_temp.teleport_location == i);
if (ImGui::Selectable(locations[i].name, is_selected))
g_temp.teleport_location = i;
if (is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
if (ImGui::Button("Teleport to selected location."))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
int64_t args[9] = { RemoteEvents::Teleport, g_selectedPlayer.id, 1, -1, 1, locations[g_temp.teleport_location].id, 0,0,0 }; // 1097312011
g_pointers->m_trigger_script_event(true, args, 9, 1 << g_selectedPlayer.id);
}QUEUE_JOB_END_CLAUSE
}
ImGui::Separator();
if (ImGui::Button("Drop Money (!)"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
Vector3 coords = ENTITY::GET_ENTITY_COORDS(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), true);
features::functions::create_ambient_money(coords, rand() % 500 + 2000);
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("Cage"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
features::functions::cage_ped(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id));
}QUEUE_JOB_END_CLAUSE
}
ImGui::End();
}
}