Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.2 kB
4
Indexable
Never
void move_(ENetPeer* peer, PlayerMoving* data) {
    pInfo(peer)->pet_x = (pInfo(peer)->state == 16 ? data->x -= 32 : data->x += 32);
    data->netID = pInfo(peer)->netID;
    BYTE* raw = packPlayerMoving(data);
    for (ENetPeer* currentPeer = server->peers; currentPeer < &server->peers[server->peerCount]; ++currentPeer) {
        if (currentPeer->state != ENET_PEER_STATE_CONNECTED or currentPeer->data == NULL || peer == currentPeer || pInfo(currentPeer)->world != pInfo(peer)->world) continue;
        send_raw(currentPeer, 4, raw, 56, ENET_PACKET_FLAG_RELIABLE);
    }
    delete[]raw;
}

void pet_move(ENetPeer* peer, PlayerMoving* data, int netid) {
    data->x = pInfo(peer)->pet_x;
    data->netID = netid;
    BYTE* raw = packPlayerMoving(data);
    PlayerMoving stat{ netid, 0, 0x14, 0, 0, 0, 0, 0, 0, 0 };
    BYTE* raw2 = packPlayerMoving(&stat);
    for (ENetPeer* currentPeer = server->peers; currentPeer < &server->peers[server->peerCount]; ++currentPeer) {
        if (currentPeer->state != ENET_PEER_STATE_CONNECTED or currentPeer->data == NULL) continue;
        send_raw(currentPeer, 4, raw, 56, ENET_PACKET_FLAG_RELIABLE);
        send_raw(currentPeer, 4, raw2, 56, ENET_PACKET_FLAG_RELIABLE);
    }
    delete[]raw;
}
Leave a Comment