Added entity proofs (#304)

This commit is contained in:
aa15032261
2022-07-02 23:15:22 +08:00
committed by GitHub
parent 60911e657b
commit 51d03c8883
4 changed files with 332 additions and 220 deletions

View File

@ -7,35 +7,32 @@ namespace big
void view::self() {
components::button("Suicide", [] {
ENTITY::SET_ENTITY_HEALTH(self::ped, 0, 0);
});
});
ImGui::SameLine();
components::button("Heal", [] {
ENTITY::SET_ENTITY_HEALTH(self::ped, PED::GET_PED_MAX_HEALTH(self::ped), 0);
PED::SET_PED_ARMOUR(self::ped, PLAYER::GET_PLAYER_MAX_ARMOUR(self::id));
});
});
ImGui::SameLine();
components::button("Skip Cutscene", [] {
CUTSCENE::STOP_CUTSCENE_IMMEDIATELY();
});
});
static char model[32];
components::input_text_with_hint("Model Name###player_ped_model", "Player Model Name", model, sizeof(model), ImGuiInputTextFlags_EnterReturnsTrue, []
{
components::input_text_with_hint("Model Name###player_ped_model", "Player Model Name", model, sizeof(model), ImGuiInputTextFlags_EnterReturnsTrue, [] {
g_fiber_pool->queue_job([] {
const Hash hash = rage::joaat(model);
for (uint8_t i = 0; !STREAMING::HAS_MODEL_LOADED(hash) && i < 100; i++)
{
for (uint8_t i = 0; !STREAMING::HAS_MODEL_LOADED(hash) && i < 100; i++) {
STREAMING::REQUEST_MODEL(hash);
script::get_current()->yield();
}
if (!STREAMING::HAS_MODEL_LOADED(hash))
{
if (!STREAMING::HAS_MODEL_LOADED(hash)) {
g_notification_service->push_error("Self", "Failed to spawn model, did you give an incorrect model ? ");
return;
@ -45,8 +42,8 @@ namespace big
PED::SET_PED_DEFAULT_COMPONENT_VARIATION(self::ped);
script::get_current()->yield();
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
});
});
});
ImGui::Separator();
@ -73,8 +70,7 @@ namespace big
ImGui::BeginGroup();
ImGui::Checkbox("Invisibility", &g->self.invisibility);
if (g->self.invisibility)
{
if (g->self.invisibility) {
ImGui::Checkbox("Locally Visible", &g->self.local_visibility);
}
@ -82,7 +78,7 @@ namespace big
components::button("Clean Player", [] {
entity::clean_ped(self::ped);
});
});
ImGui::EndGroup();
@ -96,8 +92,99 @@ namespace big
{
ImGui::Checkbox("Force Wanted Level", &g->self.force_wanted_level);
ImGui::Text("Wanted Level");
if (ImGui::SliderInt("###wanted_level", &g->self.wanted_level, 0, 5) && !g->self.force_wanted_level)
if (
ImGui::SliderInt("###wanted_level", &g->self.wanted_level, 0, 5) &&
!g->self.force_wanted_level &&
g_local_player != nullptr
) {
g_local_player->m_player_info->m_wanted_level = g->self.wanted_level;
}
}
ImGui::Separator();
components::small_text("Proofs");
if (ImGui::Button("Check all")) {
g->self.proof_bullet = true;
g->self.proof_fire = true;
g->self.proof_collision = true;
g->self.proof_melee = true;
g->self.proof_explosion = true;
g->self.proof_steam = true;
g->self.proof_drown = true;
g->self.proof_water = true;
}
ImGui::SameLine();
if (ImGui::Button("Uncheck all")) {
g->self.proof_bullet = false;
g->self.proof_fire = false;
g->self.proof_collision = false;
g->self.proof_melee = false;
g->self.proof_explosion = false;
g->self.proof_steam = false;
g->self.proof_drown = false;
g->self.proof_water = false;
}
ImGui::BeginGroup();
ImGui::Checkbox("Bullet", &g->self.proof_bullet);
ImGui::Checkbox("Fire", &g->self.proof_fire);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Collision", &g->self.proof_collision);
ImGui::Checkbox("Melee", &g->self.proof_melee);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Explosion", &g->self.proof_explosion);
ImGui::Checkbox("Steam", &g->self.proof_steam);
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("Drown", &g->self.proof_drown);
ImGui::Checkbox("Water", &g->self.proof_water);
ImGui::EndGroup();
g->self.proof_mask = 0;
if (g->self.godmode) {
g->self.proof_mask |= static_cast<int>(eEntityProofs::GOD);
} else {
if (g->self.proof_bullet) {
g->self.proof_mask |= static_cast<int>(eEntityProofs::BULLET);
}
if (g->self.proof_fire) {
g->self.proof_mask |= static_cast<int>(eEntityProofs::FIRE);
}
if (g->self.proof_collision) {
g->self.proof_mask |= static_cast<int>(eEntityProofs::COLLISION);
}
if (g->self.proof_melee) {
g->self.proof_mask |= static_cast<int>(eEntityProofs::MELEE);
}
if (g->self.proof_explosion) {
g->self.proof_mask |= static_cast<int>(eEntityProofs::EXPLOSION);
}
if (g->self.proof_steam) {
g->self.proof_mask |= static_cast<int>(eEntityProofs::STEAM);
}
if (g->self.proof_drown) {
g->self.proof_mask |= static_cast<int>(eEntityProofs::DROWN);
}
if (g->self.proof_water) {
g->self.proof_mask |= static_cast<int>(eEntityProofs::WATER);
}
}
}
}