2022-03-02 08:48:53 -05:00
# include "backend/looped/looped.hpp"
2022-12-22 21:23:32 +00:00
# include "fiber_pool.hpp"
2022-03-02 08:48:53 -05:00
# include "natives.hpp"
2022-12-22 21:23:32 +00:00
# include "backend/looped_command.hpp"
2022-03-02 08:48:53 -05:00
2023-02-13 20:38:30 +00:00
# include "core/scr_globals.hpp"
# 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
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 ;
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-02-13 20:38:30 +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
}