Andreas Maerten 464f2f90dc Bug fix time (#1549)
* fix(PlayerTP): Get Current only works once
* chore(README): removed features from TOC
* fix(ViewNetwork): SCTV join translation
* refactor: Use tunable service for no idle kick
* fix(Spoofing): check for valid model before spoofing
* feat(Spectate): Remove freeze and hide player blip
* fix(Spectate): case of chat not being visible as spectator.
* feat(Matchmaking): safer max search limit for match searching
* fix(Player/Toxic): Wanted Level small text translation
2023-06-28 11:20:48 +02:00

47 lines
1.1 KiB
C++

#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "services/players/player_service.hpp"
#include "util/globals.hpp"
namespace big
{
static bool bReset = true;
void looped::player_spectate()
{
const auto vehicle = self::veh;
const auto ped = self::ped;
if (!g_player_service->get_selected()->is_valid() || !g.player.spectating)
{
if (g.player.spectating)
g.player.spectating = false;
if (!bReset)
{
bReset = true;
NETWORK::NETWORK_SET_IN_SPECTATOR_MODE(false, -1);
NETWORK::NETWORK_OVERRIDE_RECEIVE_RESTRICTIONS_ALL(false);
HUD::SET_MINIMAP_IN_SPECTATOR_MODE(false, -1);
HUD::SET_BLIP_ALPHA(HUD::GET_MAIN_PLAYER_BLIP_ID(), 255);
STREAMING::SET_FOCUS_ENTITY(ped);
}
return;
}
const auto target = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id());
NETWORK::NETWORK_SET_IN_SPECTATOR_MODE(true, target);
NETWORK::NETWORK_OVERRIDE_RECEIVE_RESTRICTIONS_ALL(false);
HUD::SET_MINIMAP_IN_SPECTATOR_MODE(true, target);
HUD::SET_BLIP_ALPHA(HUD::GET_MAIN_PLAYER_BLIP_ID(), 255);
STREAMING::SET_FOCUS_ENTITY(target);
bReset = false;
}
}