Advertisement
Juantlo

Untitled

Oct 25th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. int PlayerDB::playerRegister(string username, string password) {
  2. username = PlayerDB::getProperName(username);
  3. if (username.length() < 3) return -2;
  4. std::ifstream ifs("players/" + username + ".json");
  5. if (ifs.is_open()) {
  6. return -1;
  7. }
  8.  
  9. std::ofstream o("players/" + username + ".json");
  10. if (!o.is_open()) {
  11. cout << GetLastError() << endl;
  12. _getch();
  13. }
  14. json j;
  15. PlayerInfo pinfo;
  16. j["username"] = username;
  17. j["password"] = hashPassword(password);
  18. j["adminLevel"] = 0;
  19. j["ClothBack"] = 0;
  20. j["ClothHand"] = 0;
  21. j["ClothFace"] = 0;
  22. j["ClothShirt"] = 0;
  23. j["ClothPants"] = 0;
  24. j["ClothNeck"] = 0;
  25. j["ClothHair"] = 0;
  26. j["ClothFeet"] = 0;
  27. j["ClothMask"] = 0;
  28. j["Level"] = 0;
  29. j["block"] = 0;
  30. j["isBanned"] = "false";
  31. o << j << std::endl;
  32. return 1;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement