mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-01-07 09:53:50 +08:00
97a8c5d60b
* feat(Spoofing): add spoofing * feat(Spoofing): prepare code for player attach * remove(PlayerAttach): isn't going to work due to netsync architecture * fix(GUI): fix scaling * feat(Project): add clang-format file * feat(Classes): update classes * fix(BlackHole): remove unnecessary cleanup * fix(Formatting): fix formatting for initializer lists * feat(clang-format): Set tab width and 1 space before comment Co-authored-by: Yimura <24669514+Yimura@users.noreply.github.com>
53 lines
1.0 KiB
C++
53 lines
1.0 KiB
C++
#pragma once
|
|
#include "gta/net_game_event.hpp"
|
|
#include "network/CNetGamePlayer.hpp"
|
|
#include "services/players/player_service.hpp"
|
|
|
|
namespace big
|
|
{
|
|
class packet
|
|
{
|
|
public:
|
|
char m_data[0x4000]{};
|
|
rage::datBitBuffer m_buffer;
|
|
|
|
packet();
|
|
void send(uint32_t msg_id);
|
|
void send(player_ptr player, int connection_id);
|
|
void send(int peer_id, int connection_id);
|
|
|
|
inline operator rage::datBitBuffer&()
|
|
{
|
|
return m_buffer;
|
|
}
|
|
|
|
template<typename T>
|
|
inline void write(T data, int length)
|
|
{
|
|
m_buffer.Write<T>(data, length);
|
|
}
|
|
|
|
inline void write_message(rage::eNetMessage message)
|
|
{
|
|
write<int>(0x3246, 14);
|
|
if ((int)message > 0xFF)
|
|
{
|
|
write<bool>(true, 1);
|
|
write<rage::eNetMessage>(message, 16);
|
|
}
|
|
else
|
|
{
|
|
write<bool>(false, 1);
|
|
write<rage::eNetMessage>(message, 8);
|
|
}
|
|
}
|
|
|
|
inline void write_peer_id(std::uint64_t peer_id)
|
|
{
|
|
char b[8];
|
|
rage::datBitBuffer buf(b, 8);
|
|
buf.WriteQWord(peer_id, 64);
|
|
m_buffer.WriteArray(b, 8 * buf.GetDataLength());
|
|
}
|
|
};
|
|
} |