feat(Features): Added god mode looped feature

This commit is contained in:
Yimura 2020-12-26 18:13:47 +01:00
parent 0093aa4f19
commit 1f8b1f6c01
3 changed files with 25 additions and 0 deletions

View File

@ -8,6 +8,7 @@ namespace big
{
void features::run_tick()
{
god_mode();
}
void features::script_func()

View File

@ -21,5 +21,7 @@ namespace big
{
void run_tick();
void script_func();
void god_mode();
}
}

View File

@ -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<bool>();
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;
}
}
}