GTBotLinux
GTBotLinux copied to clipboard
trying to collect items
It doesn't work. Here's what I've tried
struct Rdata {
uint32_t packetType;
uint32_t netID;
uint32_t secondaryNetID;
uint32_t characterState;
uint32_t padding;
uint32_t Value;
float x, y;
float xSpeed, ySpeed;
uint32_t secondaryPadding;
uint32_t punchX, punchY;
uint32_t dataSize;
};
void SendRequest(int32_t type, uint8_t* data, int32_t len)
{
if (!peer)return;
auto packet = enet_packet_create(0, len + 5, ENET_PACKET_FLAG_RELIABLE);
memcpy(packet->data, &type, 4);
memcpy((char*)packet->data + 4, data, len);
memset(packet->data + len, 0, 1);
int code = enet_peer_send(peer, 0, packet);
}
my func()
{
Rdata data;
data.packetType = 11;
data.mainValue = 2; //itemID
data.netID = -1;
data.x = this->x;
data.y = this->y;
data.xSpeed = -1;
data.ySpeed = -1;
data.padding = 0;
data.punchX = -1;
data.punchY = -1;
data.characterState = 0;
data.secondaryPadding = 0;
SendRequest(4, (uint8_t*)&data, sizeof(Rdata)); //did collect once :0
}
Try use SendPacketRaw
It doesn't work. Here's what I've tried
struct Rdata { uint32_t packetType; uint32_t netID; uint32_t secondaryNetID; uint32_t characterState; uint32_t padding; uint32_t Value; float x, y; float xSpeed, ySpeed; uint32_t secondaryPadding; uint32_t punchX, punchY; uint32_t dataSize; }; void SendRequest(int32_t type, uint8_t* data, int32_t len) { if (!peer)return; auto packet = enet_packet_create(0, len + 5, ENET_PACKET_FLAG_RELIABLE); memcpy(packet->data, &type, 4); memcpy((char*)packet->data + 4, data, len); memset(packet->data + len, 0, 1); int code = enet_peer_send(peer, 0, packet); } my func() { Rdata data; data.packetType = 11; data.mainValue = 2; //itemID data.netID = -1; data.x = this->x; data.y = this->y; data.xSpeed = -1; data.ySpeed = -1; data.padding = 0; data.punchX = -1; data.punchY = -1; data.characterState = 0; data.secondaryPadding = 0; SendRequest(4, (uint8_t*)&data, sizeof(Rdata)); //did collect once :0 }
hi, did you fixed that? can you help me with collecting items, i can pay you
You must sendcollect