feat(self): add superman mode (#924)
This commit is contained in:
parent
335e9325b0
commit
94b1917796
41
src/backend/looped/self/superman.cpp
Normal file
41
src/backend/looped/self/superman.cpp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#include "natives.hpp"
|
||||||
|
#include "backend/looped_command.hpp"
|
||||||
|
#include "gta/enums.hpp"
|
||||||
|
namespace big
|
||||||
|
{
|
||||||
|
class superman : looped_command
|
||||||
|
{
|
||||||
|
using looped_command::looped_command;
|
||||||
|
|
||||||
|
void apply_force(float x, float y, float z)
|
||||||
|
{
|
||||||
|
ENTITY::APPLY_FORCE_TO_ENTITY(self::ped, 1, x, y, z, 0, 0, 0, 0, true, true, true, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void on_tick() override
|
||||||
|
{
|
||||||
|
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_JUMP))
|
||||||
|
apply_force(0, 0, 10);
|
||||||
|
|
||||||
|
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, rage::joaat("GADGET_PARACHUTE"), 1, 1);
|
||||||
|
if (!ENTITY::IS_ENTITY_IN_AIR(self::ped) || PED::IS_PED_RAGDOLL(self::ped))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_UP_ONLY))
|
||||||
|
apply_force(3, 0, 0);
|
||||||
|
|
||||||
|
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_MOVE_DOWN_ONLY))
|
||||||
|
apply_force(3, 6, 0);
|
||||||
|
|
||||||
|
if (PAD::IS_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
|
||||||
|
apply_force(6, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void on_enable() override
|
||||||
|
{
|
||||||
|
g_notification_service->push("Superman Controls", "Use the following keys to control the Superman mode:\n'W' / 'S' / 'SPACE' / 'SHIFT'.");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
superman g_superman("superman", "Superman", "Fly like a superman..", g.self.superman);
|
||||||
|
}
|
@ -4,6 +4,7 @@
|
|||||||
#include "natives.hpp"
|
#include "natives.hpp"
|
||||||
#include "script.hpp"
|
#include "script.hpp"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
#include "util/is_key_pressed.hpp"
|
||||||
|
|
||||||
struct key_state
|
struct key_state
|
||||||
{
|
{
|
||||||
@ -25,14 +26,9 @@ inline key_state right_signal_key{ 'L' };
|
|||||||
inline key_state left_signal_key{ 'J' };
|
inline key_state left_signal_key{ 'J' };
|
||||||
inline key_state hazzards_key{ 'K' };
|
inline key_state hazzards_key{ 'K' };
|
||||||
|
|
||||||
bool is_key_pressed(int const v_key)
|
|
||||||
{
|
|
||||||
return GetAsyncKeyState(v_key) & 0x8000;
|
|
||||||
}
|
|
||||||
|
|
||||||
void update_key_state(key_state& key_last_tick)
|
void update_key_state(key_state& key_last_tick)
|
||||||
{
|
{
|
||||||
if (is_key_pressed(key_last_tick.v_key))
|
if (big::is_key_pressed(key_last_tick.v_key))
|
||||||
{
|
{
|
||||||
switch (key_last_tick.state)
|
switch (key_last_tick.state)
|
||||||
{
|
{
|
||||||
|
@ -286,6 +286,7 @@ namespace big
|
|||||||
bool auto_tp = false;
|
bool auto_tp = false;
|
||||||
bool super_jump = false;
|
bool super_jump = false;
|
||||||
bool beast_jump = false;
|
bool beast_jump = false;
|
||||||
|
bool superman = false;
|
||||||
|
|
||||||
// do not save below entries
|
// do not save below entries
|
||||||
bool dance_mode = false;
|
bool dance_mode = false;
|
||||||
@ -295,7 +296,7 @@ namespace big
|
|||||||
noclip, off_radar, super_run, no_collision, unlimited_oxygen, no_water_collision, wanted_level, god_mode, part_water,
|
noclip, off_radar, super_run, no_collision, unlimited_oxygen, no_water_collision, wanted_level, god_mode, part_water,
|
||||||
proof_bullet, proof_fire, proof_collision, proof_melee, proof_explosion, proof_steam, proof_drown, proof_water,
|
proof_bullet, proof_fire, proof_collision, proof_melee, proof_explosion, proof_steam, proof_drown, proof_water,
|
||||||
proof_mask, hide_radar, hide_ammo, selected_hud_component, hud_components_states, force_show_hud_element,
|
proof_mask, hide_radar, hide_ammo, selected_hud_component, hud_components_states, force_show_hud_element,
|
||||||
force_show_hud, mobile_radio, fast_respawn, auto_tp, super_jump, beast_jump)
|
force_show_hud, mobile_radio, fast_respawn, auto_tp, super_jump, beast_jump, superman)
|
||||||
} self{};
|
} self{};
|
||||||
|
|
||||||
struct session
|
struct session
|
||||||
|
17
src/util/is_key_pressed.hpp
Normal file
17
src/util/is_key_pressed.hpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "../pointers.hpp"
|
||||||
|
|
||||||
|
namespace big
|
||||||
|
{
|
||||||
|
inline bool is_key_pressed(std::uint16_t key)
|
||||||
|
{
|
||||||
|
if (GetForegroundWindow() == g_pointers->m_hwnd)
|
||||||
|
{
|
||||||
|
if (GetAsyncKeyState(key) & 0x8000)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -56,6 +56,7 @@ namespace big
|
|||||||
components::command_checkbox<"cleanloop">();
|
components::command_checkbox<"cleanloop">();
|
||||||
components::command_checkbox<"nocollision">();
|
components::command_checkbox<"nocollision">();
|
||||||
components::command_checkbox<"mobileradio">();
|
components::command_checkbox<"mobileradio">();
|
||||||
|
components::command_checkbox<"superman">();
|
||||||
|
|
||||||
// TODO: fix this, causes a crash
|
// TODO: fix this, causes a crash
|
||||||
// ImGui::Checkbox("DANCE_MODE"_T.data(), &g.self.dance_mode);
|
// ImGui::Checkbox("DANCE_MODE"_T.data(), &g.self.dance_mode);
|
||||||
|
Reference in New Issue
Block a user