Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trying to collect items #4

Open
opticbird opened this issue Sep 17, 2021 · 3 comments
Open

trying to collect items #4

opticbird opened this issue Sep 17, 2021 · 3 comments

Comments

@opticbird
Copy link

opticbird commented Sep 17, 2021

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
}

@GuckTubeYT
Copy link
Owner

Try use SendPacketRaw

@pokzy

This comment was marked as resolved.

@GuckTubeYT
Copy link
Owner

You must sendcollect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants