2021-05-26 13:33:26 +02:00
|
|
|
#include "backend/looped/looped.hpp"
|
|
|
|
#include "pointers.hpp"
|
|
|
|
#include "natives.hpp"
|
2022-01-31 18:27:35 +01:00
|
|
|
#include "services/player_service.hpp"
|
2021-05-26 13:33:26 +02:00
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
2021-07-23 23:02:26 +02:00
|
|
|
static bool bReset = true;
|
2021-05-26 13:33:26 +02:00
|
|
|
|
|
|
|
void looped::player_specate()
|
|
|
|
{
|
2022-01-31 18:36:00 +01:00
|
|
|
if (g_player_service->m_selected_player == nullptr || !g_player_service->m_selected_player->is_valid() || !g.player.spectating)
|
2021-07-23 23:02:26 +02:00
|
|
|
{
|
|
|
|
if (g.player.spectating) g.player.spectating = false;
|
2021-05-26 13:33:26 +02:00
|
|
|
|
2021-07-23 23:02:26 +02:00
|
|
|
if (!bReset)
|
|
|
|
{
|
|
|
|
bReset = true;
|
2021-05-26 13:33:26 +02:00
|
|
|
|
2021-07-23 23:02:26 +02:00
|
|
|
g_pointers->m_spectate_player(false, -1);
|
2021-09-19 12:31:15 +02:00
|
|
|
HUD::SET_MINIMAP_IN_SPECTATOR_MODE(false, -1);
|
2021-07-23 23:02:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-01-31 18:27:35 +01:00
|
|
|
Ped target = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->m_selected_player->id());
|
2021-09-19 12:31:15 +02:00
|
|
|
|
|
|
|
g_pointers->m_spectate_player(true, target);
|
|
|
|
HUD::SET_MINIMAP_IN_SPECTATOR_MODE(true, target);
|
2021-07-23 23:02:26 +02:00
|
|
|
|
|
|
|
bReset = false;
|
2021-05-26 13:33:26 +02:00
|
|
|
}
|
|
|
|
}
|