Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.3 kB
14
Indexable
else if (actual_command == "/bune") {

PlayerMoving data_{};
data_.packetType = 27;
data_.characterState = 0x0;
data_.x = 0;
data_.y = 0;
data_.punchX = 2;
data_.punchY = 0;
data_.XSpeed = 0;
data_.YSpeed = 0;
data_.netID = pInfo(peer)->netID;
data_.plantingTree = 0;
BYTE* raw = packPlayerMoving(&data_);

PlayerMoving dats_{};
dats_.packetType = 28;
dats_.characterState = 0x0;
dats_.x = pInfo(peer)->x;
dats_.y = pInfo(peer)->y;
dats_.punchX = 0;
dats_.punchY = 0;
dats_.XSpeed = 0;
dats_.YSpeed = 0;
dats_.netID = pInfo(peer)->netID;
dats_.plantingTree = 0;

BYTE* raws = packPlayerMoving(&dats_);

uint8_t pData[22] = {0x0b,0x00,0x61,0x6d,0x65,0x74,0x73,0x61,0x20,0x74,0x65,0x71,0x74,0x3c,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00};
memcpy(raws + 56, &pData, sizeof(pData));

            for (ENetPeer* currentPeer = server->peers; currentPeer < &server->peers[server->peerCount]; ++currentPeer) {
                if (currentPeer->state != ENET_PEER_STATE_CONNECTED or currentPeer->data == NULL or pInfo(peer)->world != pInfo(currentPeer)->world) continue;
                send_raw(currentPeer, 4, raw, 56, ENET_PACKET_FLAG_RELIABLE);
send_raw(currentPeer, 4, raws, 56, ENET_PACKET_FLAG_RELIABLE);
            }
            delete[] raw;
            delete[] raws;
}