TmpMenu/src/packet.cpp
maybegreat48 a97af16888 Rewrite AC bypass (#2430)
* fix(anticheat): rewrite AC bypass again (the old one isn't detected but this is cleaner)
* fix(chat): some chat tweaks
* fix(anticheat): fix memory leak
* feat(lua): add is_player_friend
* fix(protections): fix possible false positives with the vehicle task mismatch protection
* feat(protections): add debug logs to trace false positive
* fix(spam): add some more stuff
2023-11-19 23:20:15 +01:00

34 lines
957 B
C++

#include "packet.hpp"
#include "common.hpp"
#include "gta_util.hpp"
#include "services/players/player_service.hpp"
#include <network/Network.hpp>
#include <network/netConnection.hpp>
namespace big
{
packet::packet() :
m_buffer(m_data, sizeof(m_data))
{
}
void packet::send(uint32_t msg_id)
{
g_pointers->m_gta
.m_queue_packet(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, msg_id, m_data, (m_buffer.m_curBit + 7) >> 3, 1, nullptr);
}
void packet::send(player_ptr player, int connection_id)
{
send(player->get_session_player()->m_player_data.m_peer_id_2, connection_id);
}
void packet::send(int peer_id, int connection_id)
{
auto mgr = gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr;
auto peer = g_pointers->m_gta.m_get_connection_peer(mgr, peer_id);
g_pointers->m_gta.m_send_packet(mgr, &peer->m_peer_address, connection_id, m_data, (m_buffer.m_curBit + 7) >> 3, 0x1000000);
}
}