TmpMenu/src/backend/looped/self/invisibility.cpp
maybegreat48 97a8c5d60b Add more spoofing options and added clang-format (#1020)
* feat(Spoofing): add spoofing
* feat(Spoofing): prepare code for player attach
* remove(PlayerAttach): isn't going to work due to netsync architecture
* fix(GUI): fix scaling
* feat(Project): add clang-format file
* feat(Classes): update classes
* fix(BlackHole): remove unnecessary cleanup
* fix(Formatting): fix formatting for initializer lists
* feat(clang-format): Set tab width and 1 space before comment

Co-authored-by: Yimura <24669514+Yimura@users.noreply.github.com>
2023-03-01 21:27:15 +00:00

43 lines
1.2 KiB
C++

#include "backend/looped/looped.hpp"
#include "backend/looped_command.hpp"
#include "core/scr_globals.hpp"
#include "fiber_pool.hpp"
#include "natives.hpp"
#include "services/script_patcher/script_patcher_service.hpp"
#include <script/globals/GlobalPlayerBD.hpp>
namespace big
{
class invisibility : looped_command
{
using looped_command::looped_command;
virtual void on_enable() override
{
g_script_patcher_service->update();
}
virtual void on_tick() override
{
ENTITY::SET_ENTITY_VISIBLE(self::ped, false, 0);
if (g.self.local_visibility)
NETWORK::SET_ENTITY_LOCALLY_VISIBLE(self::ped);
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].IsInvisible = true;
}
virtual void on_disable() override
{
ENTITY::SET_ENTITY_VISIBLE(self::ped, true, 0);
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].IsInvisible = false;
g_script_patcher_service->update();
}
};
invisibility g_invisibility("invis", "Invisiblity", "Makes you invisible", g.self.invisibility);
bool_command g_local_visibility("localvis", "Visible Locally", "Makes you visible to yourself, but other players would still not be able to see you",
g.self.local_visibility);
}