Skip to content

trying to collect items  #4

Description

@opticbird

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
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions