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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 332 additions and 220 deletions

View File

@ -3,17 +3,19 @@
namespace big
{
static bool bLastGodMode = false;
static uint32_t lastProofBits = 0;
void looped::self_godmode()
{
bool bGodMode = g->self.godmode;
void looped::self_godmode() {
if (g_local_player != nullptr) {
uint32_t proofBits = g->self.proof_mask;
uint32_t changedProofBits = proofBits ^ lastProofBits;
uint32_t changedOrEnabledProofBits = proofBits | changedProofBits;
if (bGodMode || (!bGodMode && bGodMode != bLastGodMode))
{
ENTITY::SET_ENTITY_INVINCIBLE(self::ped, g->self.godmode);
bLastGodMode = g->self.godmode;
if (changedOrEnabledProofBits) {
uint32_t unchangedBits = g_local_player->m_damage_bits & ~changedOrEnabledProofBits;
g_local_player->m_damage_bits = unchangedBits | proofBits;
lastProofBits = proofBits;
}
}
}
}

View File

@ -193,4 +193,17 @@ namespace big
KMH,
MPH
};
enum class eEntityProofs : uint32_t
{
BULLET = 1 << 4,
FIRE = 1 << 5,
COLLISION = 1 << 6,
MELEE = 1 << 7,
GOD = 1 << 8,
EXPLOSION = 1 << 11,
STEAM = 1 << 15,
DROWN = 1 << 16,
WATER = 1 << 24,
};
}

View File

@ -142,6 +142,16 @@ namespace big
bool off_radar = false;
bool super_run = false;
int wanted_level = 0;
bool proof_bullet = false;
bool proof_fire = false;
bool proof_collision = false;
bool proof_melee = false;
bool proof_explosion = false;
bool proof_steam = false;
bool proof_drown = false;
bool proof_water = false;
uint32_t proof_mask = 0;
};
struct session

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);
}
}
}
}