feat(Self): Added super run

This commit is contained in:
Yimura 2021-12-19 00:25:54 +01:00
parent 136cb01164
commit 28b1224898
5 changed files with 59 additions and 0 deletions

View File

@ -41,6 +41,7 @@ namespace big
looped::self_off_radar();
looped::self_police();
looped::self_no_ragdoll();
looped::self_super_run();
}QUEUE_JOB_END_CLAUSE
QUEUE_JOB_BEGIN_CLAUSE()

View File

@ -21,6 +21,7 @@ namespace big
static void self_police();
static void self_noclip();
static void self_no_ragdoll();
static void self_super_run();
static void system_update_players();
static void system_update_pointers();

View File

@ -0,0 +1,53 @@
#include "backend/looped/looped.hpp"
#include "gta/enums.hpp"
#include "natives.hpp"
#include "util/math.hpp"
namespace big
{
static float run_speed = 10.f;
static float run_cap = 100.f;
static bool super_run_state = false;
void looped::self_super_run()
{
if (g.self.super_run && PAD::IS_CONTROL_PRESSED(0, 21))
{
if (run_speed < run_cap) run_speed += .5f;
Ped player = PLAYER::PLAYER_PED_ID();
Vector3 pos = ENTITY::GET_ENTITY_COORDS(player, true);
Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(2);
float yaw = math::deg_to_rad(rot.z + 90);
Vector3 offset;
offset.x = pos.x + (run_speed * cos(yaw));
offset.y = pos.y + (run_speed * sin(yaw));
offset.z = pos.z + .2f;
float groundZ;
MISC::GET_GROUND_Z_FOR_3D_COORD(offset.x, offset.y, 1000.f, &groundZ, false, false);
if (groundZ < pos.z)
offset.z = groundZ;
Vector3 vel = offset - pos;
ENTITY::SET_ENTITY_VELOCITY(player, vel.x, vel.y, vel.z);
g_local_player->m_player_info->m_run_speed = .7f;
}
else if (!g.self.super_run && g.self.super_run != super_run_state)
{
g_local_player->m_player_info->m_run_speed = 1.f;
}
else if (PAD::IS_CONTROL_JUST_RELEASED(0, 21))
{
run_speed = 10.f;
g_local_player->m_player_info->m_run_speed = 1.f;
}
super_run_state = g.self.super_run;
}
}

View File

@ -65,6 +65,7 @@ struct globals {
bool never_wanted = false;
bool noclip = false;
bool no_ragdoll = false;
bool super_run = false;
int wanted_level = 0;
frame_flags frame_flags{};
@ -154,6 +155,7 @@ struct globals {
this->self.off_radar = j["self"]["off_radar"];
this->self.never_wanted = j["self"]["never_wanted"];
this->self.no_ragdoll = j["self"]["no_ragdoll"];
this->self.super_run = j["self"]["super_run"];
this->self.frame_flags.explosive_ammo = j["self"]["frame_flags"]["explosive_ammo"];
this->self.frame_flags.explosive_melee = j["self"]["frame_flags"]["explosive_melee"];
@ -232,6 +234,7 @@ struct globals {
{ "off_radar", this->self.off_radar },
{ "never_wanted", this->self.never_wanted },
{ "no_ragdoll", this->self.no_ragdoll },
{ "super_run", this->self.super_run },
{
"frame_flags", {

View File

@ -25,6 +25,7 @@ namespace big
ImGui::Checkbox("Free Cam", &g.self.free_cam);
ImGui::Checkbox("No Clip", &g.self.noclip);
ImGui::Checkbox("No Ragdoll", &g.self.no_ragdoll);
ImGui::Checkbox("Super Run", &g.self.super_run);
if (ImGui::TreeNode("Frame Flags"))
{