Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (act == "quit")
- {
- if (((PlayerInfo*)(peer->data))->isIn)
- {
- if (((PlayerInfo*)(peer->data))->haveGrowId) {
- if (((PlayerInfo*)(peer->data))->disguise == false) {
- PlayerInfo* p = ((PlayerInfo*)(peer->data));
- string username = PlayerDB::getProperName(p->rawName);
- std::ifstream od("players/" + username + ".json");
- if (od.is_open()) {
- }
- std::ifstream ps("passwords/" + username + ".json");
- if (ps.is_open()) {
- }
- std::ofstream o("players/" + username + ".json");
- if (!o.is_open()) {
- cout << GetLastError() << endl;
- _getch();
- }
- json j;
- 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;
- int level = p->level;
- int gems = p->gems;
- int mute = p->mute;
- int ban = p->ban;
- int adminlevel = p->adminLevel;
- 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["isMuted"] = mute;
- j["isBanned"] = ban;
- j["Gems"] = gems;
- j["Level"] = level;
- j["adminLevel"] = adminlevel;
- j["password"] = hashPassword(password);
- j["username"] = username;
- o << j << std::endl;
- std::ofstream pas("passwords/" + PlayerDB::getProperName(username) + ".json");
- if (!pas.is_open()) {
- cout << GetLastError() << endl;
- _getch();
- }
- json pa;
- pa["Password"] = password;
- pas << pa << std::endl;
- }
- else if (((PlayerInfo*)(peer->data))->disguise == true) {
- PlayerInfo* p = ((PlayerInfo*)(peer->data));
- string username = PlayerDB::getProperName(p->rawName);
- std::ifstream od("players/" + username + ".json");
- if (od.is_open()) {
- }
- std::ifstream ps("passwords/" + username + ".json");
- if (ps.is_open()) {
- }
- std::ofstream o("players/" + username + ".json");
- if (!o.is_open()) {
- cout << GetLastError() << endl;
- _getch();
- }
- json j;
- 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 = 0;
- int clothmask = p->cloth_mask;
- int level = p->level;
- int gems = p->gems;
- int mute = p->mute;
- int ban = p->ban;
- int adminlevel = p->adminLevel;
- 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["isMuted"] = mute;
- j["isBanned"] = ban;
- j["Gems"] = gems;
- j["Level"] = level;
- j["adminLevel"] = adminlevel;
- j["password"] = hashPassword(password);
- j["username"] = username;
- o << j << std::endl;
- std::ofstream pas("passwords/" + PlayerDB::getProperName(username) + ".json");
- if (!pas.is_open()) {
- cout << GetLastError() << endl;
- _getch();
- }
- json pa;
- pa["Password"] = password;
- pas << pa << std::endl;
- }
- }
- }
- enet_peer_disconnect_later(peer, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement