From cefbf16488ab29d0b73d5a8dcd172105f321adf3 Mon Sep 17 00:00:00 2001 From: Yimura Date: Sat, 26 Dec 2020 18:13:47 +0100 Subject: [PATCH] feat(Features): Added god mode looped feature --- BigBaseV2/src/features.cpp | 1 + BigBaseV2/src/features.hpp | 2 ++ BigBaseV2/src/features/god_mode.cpp | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 BigBaseV2/src/features/god_mode.cpp diff --git a/BigBaseV2/src/features.cpp b/BigBaseV2/src/features.cpp index 978f3a65..b39df5f9 100644 --- a/BigBaseV2/src/features.cpp +++ b/BigBaseV2/src/features.cpp @@ -8,6 +8,7 @@ namespace big { void features::run_tick() { + god_mode(); } void features::script_func() diff --git a/BigBaseV2/src/features.hpp b/BigBaseV2/src/features.hpp index 59f479bf..e729b4c1 100644 --- a/BigBaseV2/src/features.hpp +++ b/BigBaseV2/src/features.hpp @@ -21,5 +21,7 @@ namespace big { void run_tick(); void script_func(); + + void god_mode(); } } diff --git a/BigBaseV2/src/features/god_mode.cpp b/BigBaseV2/src/features/god_mode.cpp new file mode 100644 index 00000000..2e303338 --- /dev/null +++ b/BigBaseV2/src/features/god_mode.cpp @@ -0,0 +1,22 @@ +#include "features.hpp" +#include "fiber_pool.hpp" + +namespace big +{ + static bool bLastGodMode = false; + + void features::god_mode() + { + bool bGodMode = g_settings.options["god_mode"].get(); + + if (bGodMode || (!bGodMode && bGodMode != bLastGodMode)) + { + QUEUE_JOB_BEGIN_CLAUSE(= ) + { + ENTITY::SET_ENTITY_INVINCIBLE(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(PLAYER::PLAYER_ID()), bGodMode); + }QUEUE_JOB_END_CLAUSE + + bLastGodMode = bGodMode; + } + } +} \ No newline at end of file