Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void sendClothes(ENetPeer* peer)
- {
- ENetPeer * currentPeer;
- GamePacket p3 = packetEnd(appendFloat(appendIntx(appendFloat(appendFloat(appendFloat(appendString(createPacket(), "OnSetClothing"), ((PlayerInfo*)(peer->data))->cloth_hair, ((PlayerInfo*)(peer->data))->cloth_shirt, ((PlayerInfo*)(peer->data))->cloth_pants), ((PlayerInfo*)(peer->data))->cloth_feet, ((PlayerInfo*)(peer->data))->cloth_face, ((PlayerInfo*)(peer->data))->cloth_hand), ((PlayerInfo*)(peer->data))->cloth_back, ((PlayerInfo*)(peer->data))->cloth_mask, ((PlayerInfo*)(peer->data))->cloth_necklace), ((PlayerInfo*)(peer->data))->skinColor), 0.0f, 0.0f, 0.0f));
- for (currentPeer = server->peers;
- currentPeer < &server->peers[server->peerCount];
- ++currentPeer)
- {
- if (currentPeer->state != ENET_PEER_STATE_CONNECTED)
- continue;
- if (isHere(peer, currentPeer))
- {
- memcpy(p3.data + 8, &(((PlayerInfo*)(peer->data))->netID), 4); // ffloor
- ENetPacket * packet3 = enet_packet_create(p3.data,
- p3.len,
- ENET_PACKET_FLAG_RELIABLE);
- enet_peer_send(currentPeer, 0, packet3);
- }
- }
- if (((PlayerInfo*)(peer->data))->haveGrowId) {
- PlayerInfo* p = ((PlayerInfo*)(peer->data));
- string username = PlayerDB::getProperName(p->rawName);
- std::ifstream od("players/" + username + ".json");
- if (od.is_open()) {
- }
- std::ofstream o("players/" + username + ".json");
- if (!o.is_open()) {
- cout << GetLastError() << endl;
- _getch();
- }
- json j;
- int email = 0;
- int passwordverify = 0;
- int clothback = p->cloth_back;
- int clothhand = p->cloth_hand;
- int clothface = p->cloth_face;
- int clothhair = p->cloth_hair;
- int clothfeet = p->cloth_feet;
- int clothpants = p->cloth_pants;
- int clothneck = p->cloth_necklace;
- int clothshirt = p->cloth_shirt;
- int clothmask = p->cloth_mask;
- string password = ((PlayerInfo*)(peer->data))->tankIDPass;
- j["ClothBack"] = clothback;
- j["ClothHand"] = clothhand;
- j["ClothFace"] = clothface;
- j["ClothShirt"] = clothshirt;
- j["ClothPants"] = clothpants;
- j["ClothNeck"] = clothneck;
- j["ClothHair"] = clothhair;
- j["ClothFeet"] = clothfeet;
- j["ClothMask"] = clothmask;
- j["adminLevel"] = 0;
- j["email"] = email;
- j["passwordverify"] = passwordverify;
- j["password"] = hashPassword(password);
- j["username"] = username;
- o << j << std::endl;
- }
- //enet_host_flush(server);
- delete p3.data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement