Improve protections again and player database (#606)

This commit is contained in:
maybegreat48
2022-11-19 01:49:36 +00:00
committed by GitHub
parent ba3ab119d5
commit d9d53c8e42
48 changed files with 1129 additions and 803 deletions

View File

@ -1,6 +1,7 @@
#include "gta_util.hpp"
#include "services/pickups/pickup_service.hpp"
#include "services/players/player_service.hpp"
#include "services/player_database/player_database_service.hpp"
#include "util/globals.hpp"
#include "util/misc.hpp"
#include "util/ped.hpp"
@ -18,53 +19,6 @@ namespace big
if (g_player_service->get_selected()->is_valid())
{
if (ImGui::TreeNode("Misc"))
{
components::button("Steal Outfit", [] {
ped::steal_outfit(
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id())
);
});
ImGui::SameLine();
components::button("Steal Identity", [] {
ped::steal_identity(
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id())
);
});
components::button("Clear Wanted Level", [] {
globals::clear_wanted_player(g_player_service->get_selected()->id());
});
ImGui::SameLine();
ImGui::Checkbox("Never Wanted", &g_player_service->get_selected()->never_wanted);
components::button("Give Health", [] {
g_pickup_service->give_player_health(g_player_service->get_selected()->id());
});
ImGui::SameLine();
components::button("Give Armour", [] {
g_pickup_service->give_player_armour(g_player_service->get_selected()->id());
});
components::button("Give Ammo", [] {
g_pickup_service->give_player_ammo(g_player_service->get_selected()->id());
});
ImGui::SameLine();
components::button("Give Weapons", [] {
g_pickup_service->give_player_weapons(g_player_service->get_selected()->id());
});
ImGui::TreePop();
}
if (ImGui::TreeNode("Info")) {
ImGui::Text("Player ID: %d", g_player_service->get_selected()->id());
@ -164,6 +118,11 @@ namespace big
);
}
if (ImGui::Button("Add To Database"))
{
g_player_database_service->get_or_create_player(g_player_service->get_selected());
}
ImGui::TreePop();
}
@ -187,6 +146,60 @@ namespace big
ImGui::TreePop();
}
if (ImGui::TreeNode("Misc"))
{
components::button("Steal Outfit", []
{
ped::steal_outfit(
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id())
);
});
ImGui::SameLine();
components::button("Steal Identity", []
{
ped::steal_identity(
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id())
);
});
components::button("Clear Wanted Level", []
{
globals::clear_wanted_player(g_player_service->get_selected()->id());
});
ImGui::SameLine();
ImGui::Checkbox("Never Wanted", &g_player_service->get_selected()->never_wanted);
components::button("Give Health", []
{
g_pickup_service->give_player_health(g_player_service->get_selected()->id());
});
ImGui::SameLine();
components::button("Give Armour", []
{
g_pickup_service->give_player_armour(g_player_service->get_selected()->id());
});
components::button("Give Ammo", []
{
g_pickup_service->give_player_ammo(g_player_service->get_selected()->id());
});
ImGui::SameLine();
components::button("Give Weapons", []
{
g_pickup_service->give_player_weapons(g_player_service->get_selected()->id());
});
ImGui::TreePop();
}
}
}
}

View File

@ -36,6 +36,9 @@ namespace big
const ImRect icons_box(icons_pos, icons_pos + icons_size);
ImGui::PopFont();
if (plyr->is_modder)
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.f, 0.1f, 0.1f, 1.f));
if (selected_player)
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.29f, 0.45f, 0.69f, 1.f));
@ -53,6 +56,9 @@ namespace big
if (selected_player)
ImGui::PopStyleColor();
if (plyr->is_modder)
ImGui::PopStyleColor();
// render icons on top of the player button
ImGui::PushFont(g->window.font_icon);
ImGui::RenderTextWrapped(icons_box.Min, player_iconsc, player_icons_end, icons_size.x);