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/packet.hpp
maybegreat48 5d538cf53c
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

53 lines
1022 B
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[0x400]{};
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(uint64_t peer_id)
{
char b[8];
rage::datBitBuffer buf(b, 8);
buf.WriteQWord(peer_id, 64);
m_buffer.WriteArray(b, 8 * buf.GetDataLength());
}
};
}