Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void updateSign(ENetPeer* peer, int foreground, int x, int y, string text, int background)
- {
- PlayerMoving sign;
- sign.packetType = 0x3;
- sign.characterState = 0x0;
- sign.x = x;
- sign.y = y;
- sign.punchX = x;
- sign.punchY = y;
- sign.XSpeed = 0;
- sign.YSpeed = 0;
- sign.netID = -1;
- sign.plantingTree = foreground;
- SendPacketRaw(4, packPlayerMoving(&sign), 56, 0, peer, ENET_PACKET_FLAG_RELIABLE);
- int hmm = 8, wot = text.length(), lol = 0, wut = 5;
- int yeh = hmm + 3 + 1, idk = 15 + wot, lmao = -1, yey = 2; //idk = text_len + 15, wut = type(?), wot = text_len, yey = len of text_len
- int ok = 52 + idk;
- int kek = ok + 4, yup = ok - 8 - idk;
- int thonk = 4, magic = 56, wew = ok + 5 + 4;
- int wow = magic + 4 + 5;
- BYTE* data = new BYTE[kek];
- ENetPacket* p = enet_packet_create(0, wew, ENET_PACKET_FLAG_RELIABLE);
- for (int i = 0; i < kek; i++) data[i] = 0;
- memcpy(data, &wut, thonk);
- memcpy(data + yeh, &hmm, thonk); //read discord
- memcpy(data + yup, &x, 4);
- memcpy(data + yup + 4, &y, 4);
- memcpy(data + 4 + yup + 4, &idk, thonk);
- memcpy(data + magic, &foreground, yey);
- memcpy(data + magic + 2, &background, yey); //p100 fix by the one and only lapada
- memcpy(data + thonk + magic, &lol, thonk);
- memcpy(data + magic + 4 + thonk, &yey, 1);
- memcpy(data + wow, &wot, yey); //data + wow = text_len
- memcpy(data + yey + wow, text.c_str(), wot); //data + text_len_len + text_len_offs = text
- memcpy(data + ok, &lmao, thonk); //end ?
- memcpy(p->data, &thonk, thonk);
- memcpy((char*)p->data + thonk, data, kek); //kek = data_len
- ENetPeer* currentPeer;
- for (currentPeer = server->peers;
- currentPeer < &server->peers[server->peerCount];
- ++currentPeer)
- {
- if (currentPeer->state != ENET_PEER_STATE_CONNECTED)
- continue;
- if (isHere(peer, currentPeer)) {
- enet_peer_send(currentPeer, 0, p);
- }
- }
- delete data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement