2021-05-26 13:33:26 +02:00
|
|
|
#include "backend/looped/looped.hpp"
|
|
|
|
#include "natives.hpp"
|
2022-06-30 00:11:54 +02:00
|
|
|
#include "services/players/player_service.hpp"
|
2022-09-29 20:54:08 +01:00
|
|
|
#include "util/globals.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
|
|
|
|
2022-03-21 18:02:30 +01:00
|
|
|
void looped::player_spectate()
|
2021-05-26 13:33:26 +02:00
|
|
|
{
|
2022-06-24 19:48:03 +02:00
|
|
|
const auto vehicle = self::veh;
|
2023-03-01 21:27:15 +00:00
|
|
|
const auto ped = self::ped;
|
2022-05-23 06:38:45 +08:00
|
|
|
|
2022-12-18 23:15:52 +01:00
|
|
|
if (!g_player_service->get_selected()->is_valid() || !g.player.spectating)
|
2021-07-23 23:02:26 +02:00
|
|
|
{
|
2023-03-01 21:27:15 +00: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
|
|
|
|
2022-02-01 23:14:58 +01:00
|
|
|
NETWORK::NETWORK_SET_IN_SPECTATOR_MODE(false, -1);
|
2023-06-28 11:20:48 +02:00
|
|
|
NETWORK::NETWORK_OVERRIDE_RECEIVE_RESTRICTIONS_ALL(false);
|
2021-09-19 12:31:15 +02:00
|
|
|
HUD::SET_MINIMAP_IN_SPECTATOR_MODE(false, -1);
|
2023-06-28 11:20:48 +02:00
|
|
|
HUD::SET_BLIP_ALPHA(HUD::GET_MAIN_PLAYER_BLIP_ID(), 255);
|
2022-09-29 20:54:08 +01:00
|
|
|
|
|
|
|
STREAMING::SET_FOCUS_ENTITY(ped);
|
2021-07-23 23:02:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-09-29 20:54:08 +01:00
|
|
|
const auto target = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id());
|
|
|
|
|
2022-02-01 23:14:58 +01:00
|
|
|
NETWORK::NETWORK_SET_IN_SPECTATOR_MODE(true, target);
|
2023-06-28 11:20:48 +02:00
|
|
|
NETWORK::NETWORK_OVERRIDE_RECEIVE_RESTRICTIONS_ALL(false);
|
2021-09-19 12:31:15 +02:00
|
|
|
HUD::SET_MINIMAP_IN_SPECTATOR_MODE(true, target);
|
2023-06-28 11:20:48 +02:00
|
|
|
HUD::SET_BLIP_ALPHA(HUD::GET_MAIN_PLAYER_BLIP_ID(), 255);
|
2022-03-21 18:02:30 +01:00
|
|
|
|
2022-09-29 20:54:08 +01:00
|
|
|
STREAMING::SET_FOCUS_ENTITY(target);
|
|
|
|
|
2021-07-23 23:02:26 +02:00
|
|
|
bReset = false;
|
2021-05-26 13:33:26 +02:00
|
|
|
}
|
2022-05-08 00:13:53 +03:00
|
|
|
}
|