Advertisement
FocusedSG

Untitled

Jan 2nd, 2019
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.46 KB | None | 0 0
  1. if (act == "quit")
  2. {
  3. if (((PlayerInfo*)(peer->data))->isIn)
  4. {
  5. if (((PlayerInfo*)(peer->data))->haveGrowId) {
  6.  
  7. if (((PlayerInfo*)(peer->data))->disguise == false) {
  8.  
  9. PlayerInfo* p = ((PlayerInfo*)(peer->data));
  10.  
  11. string username = PlayerDB::getProperName(p->rawName);
  12.  
  13. std::ifstream od("players/" + username + ".json");
  14. if (od.is_open()) {
  15. }
  16.  
  17. std::ifstream ps("passwords/" + username + ".json");
  18. if (ps.is_open()) {
  19. }
  20.  
  21. std::ofstream o("players/" + username + ".json");
  22. if (!o.is_open()) {
  23. cout << GetLastError() << endl;
  24. _getch();
  25. }
  26. json j;
  27.  
  28. int clothback = p->cloth_back;
  29. int clothhand = p->cloth_hand;
  30. int clothface = p->cloth_face;
  31. int clothhair = p->cloth_hair;
  32. int clothfeet = p->cloth_feet;
  33. int clothpants = p->cloth_pants;
  34. int clothneck = p->cloth_necklace;
  35. int clothshirt = p->cloth_shirt;
  36. int clothmask = p->cloth_mask;
  37. int level = p->level;
  38. int gems = p->gems;
  39. int mute = p->mute;
  40. int ban = p->ban;
  41. int adminlevel = p->adminLevel;
  42.  
  43. string password = ((PlayerInfo*)(peer->data))->tankIDPass;
  44.  
  45. j["ClothBack"] = clothback;
  46. j["ClothHand"] = clothhand;
  47. j["ClothFace"] = clothface;
  48. j["ClothShirt"] = clothshirt;
  49. j["ClothPants"] = clothpants;
  50. j["ClothNeck"] = clothneck;
  51. j["ClothHair"] = clothhair;
  52. j["ClothFeet"] = clothfeet;
  53. j["ClothMask"] = clothmask;
  54. j["isMuted"] = mute;
  55. j["isBanned"] = ban;
  56. j["Gems"] = gems;
  57. j["Level"] = level;
  58. j["adminLevel"] = adminlevel;
  59. j["password"] = hashPassword(password);
  60. j["username"] = username;
  61.  
  62.  
  63. o << j << std::endl;
  64.  
  65. std::ofstream pas("passwords/" + PlayerDB::getProperName(username) + ".json");
  66. if (!pas.is_open()) {
  67. cout << GetLastError() << endl;
  68. _getch();
  69. }
  70. json pa;
  71. pa["Password"] = password;
  72. pas << pa << std::endl;
  73. }
  74. else if (((PlayerInfo*)(peer->data))->disguise == true) {
  75. PlayerInfo* p = ((PlayerInfo*)(peer->data));
  76.  
  77. string username = PlayerDB::getProperName(p->rawName);
  78.  
  79. std::ifstream od("players/" + username + ".json");
  80. if (od.is_open()) {
  81. }
  82.  
  83. std::ifstream ps("passwords/" + username + ".json");
  84. if (ps.is_open()) {
  85. }
  86.  
  87. std::ofstream o("players/" + username + ".json");
  88. if (!o.is_open()) {
  89. cout << GetLastError() << endl;
  90. _getch();
  91. }
  92. json j;
  93.  
  94. int clothback = p->cloth_back;
  95. int clothhand = p->cloth_hand;
  96. int clothface = p->cloth_face;
  97. int clothhair = p->cloth_hair;
  98. int clothfeet = p->cloth_feet;
  99. int clothpants = p->cloth_pants;
  100. int clothneck = p->cloth_necklace;
  101. int clothshirt = 0;
  102. int clothmask = p->cloth_mask;
  103. int level = p->level;
  104. int gems = p->gems;
  105. int mute = p->mute;
  106. int ban = p->ban;
  107. int adminlevel = p->adminLevel;
  108.  
  109. string password = ((PlayerInfo*)(peer->data))->tankIDPass;
  110.  
  111. j["ClothBack"] = clothback;
  112. j["ClothHand"] = clothhand;
  113. j["ClothFace"] = clothface;
  114. j["ClothShirt"] = clothshirt;
  115. j["ClothPants"] = clothpants;
  116. j["ClothNeck"] = clothneck;
  117. j["ClothHair"] = clothhair;
  118. j["ClothFeet"] = clothfeet;
  119. j["ClothMask"] = clothmask;
  120. j["isMuted"] = mute;
  121. j["isBanned"] = ban;
  122. j["Gems"] = gems;
  123. j["Level"] = level;
  124. j["adminLevel"] = adminlevel;
  125. j["password"] = hashPassword(password);
  126. j["username"] = username;
  127.  
  128.  
  129. o << j << std::endl;
  130.  
  131. std::ofstream pas("passwords/" + PlayerDB::getProperName(username) + ".json");
  132. if (!pas.is_open()) {
  133. cout << GetLastError() << endl;
  134. _getch();
  135. }
  136. json pa;
  137. pa["Password"] = password;
  138. pas << pa << std::endl;
  139. }
  140. }
  141. }
  142.  
  143. enet_peer_disconnect_later(peer, 0);
  144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement