2022-03-02 08:48:53 -05:00
|
|
|
#include "backend/looped/looped.hpp"
|
2023-03-01 21:27:15 +00:00
|
|
|
#include "backend/looped_command.hpp"
|
|
|
|
#include "core/scr_globals.hpp"
|
2022-12-22 21:23:32 +00:00
|
|
|
#include "fiber_pool.hpp"
|
2022-03-02 08:48:53 -05:00
|
|
|
#include "natives.hpp"
|
2023-03-01 21:27:15 +00:00
|
|
|
#include "services/script_patcher/script_patcher_service.hpp"
|
2022-03-02 08:48:53 -05:00
|
|
|
|
2023-02-13 20:38:30 +00:00
|
|
|
#include <script/globals/GlobalPlayerBD.hpp>
|
|
|
|
|
2022-03-02 08:48:53 -05:00
|
|
|
namespace big
|
|
|
|
{
|
2022-12-22 21:23:32 +00:00
|
|
|
class invisibility : looped_command
|
2022-03-02 08:48:53 -05:00
|
|
|
{
|
2022-12-22 21:23:32 +00:00
|
|
|
using looped_command::looped_command;
|
2022-03-02 08:48:53 -05:00
|
|
|
|
2023-03-01 21:27:15 +00:00
|
|
|
virtual void on_enable() override
|
|
|
|
{
|
|
|
|
g_script_patcher_service->update();
|
|
|
|
}
|
|
|
|
|
2022-12-22 21:23:32 +00:00
|
|
|
virtual void on_tick() override
|
2022-03-02 08:48:53 -05:00
|
|
|
{
|
2022-12-22 21:23:32 +00:00
|
|
|
ENTITY::SET_ENTITY_VISIBLE(self::ped, false, 0);
|
2023-02-13 20:38:30 +00:00
|
|
|
|
2022-12-22 21:23:32 +00:00
|
|
|
if (g.self.local_visibility)
|
|
|
|
NETWORK::SET_ENTITY_LOCALLY_VISIBLE(self::ped);
|
2023-02-13 20:38:30 +00:00
|
|
|
|
|
|
|
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].IsInvisible = true;
|
2022-03-02 08:48:53 -05:00
|
|
|
}
|
2022-05-02 15:15:49 -04:00
|
|
|
|
2022-12-22 21:23:32 +00:00
|
|
|
virtual void on_disable() override
|
2022-05-02 15:15:49 -04:00
|
|
|
{
|
2022-12-22 21:23:32 +00:00
|
|
|
ENTITY::SET_ENTITY_VISIBLE(self::ped, true, 0);
|
2023-02-13 20:38:30 +00:00
|
|
|
scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[self::id].IsInvisible = false;
|
2023-03-01 21:27:15 +00:00
|
|
|
g_script_patcher_service->update();
|
2022-05-02 15:15:49 -04:00
|
|
|
}
|
2022-12-22 21:23:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
invisibility g_invisibility("invis", "Invisiblity", "Makes you invisible", g.self.invisibility);
|
2023-03-01 21:27:15 +00:00
|
|
|
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);
|
2022-05-02 15:15:49 -04:00
|
|
|
}
|