This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
YimMenu/src/gta/script_handler.cpp

28 lines
691 B
C++
Raw Normal View History

2022-12-06 16:12:02 +00:00
#include "script_handler.hpp"
2022-12-06 16:12:02 +00:00
#include "pointers.hpp"
2022-12-06 16:12:02 +00:00
#include <network/CNetworkPlayerMgr.hpp>
int CGameScriptHandlerNetComponent::get_participant_index(CNetGamePlayer* player)
{
2023-04-14 18:54:07 +02:00
if (player == (*big::g_pointers->m_gta.m_network_player_mgr)->m_local_net_player)
2022-12-06 16:12:02 +00:00
return m_local_participant_index;
if (m_num_participants <= 1)
return -1;
for (int i = 0; i < m_num_participants - 1; i++)
{
if (m_participants[i] && m_participants[i]->m_net_game_player == player)
return m_participants[i]->m_participant_index;
}
return -1;
}
bool CGameScriptHandlerNetComponent::is_player_a_participant(CNetGamePlayer* player)
{
return m_participant_bitset & (1 << player->m_player_id);
}