Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int PlayerDB::playerRegister(string username, string password) {
- username = PlayerDB::getProperName(username);
- if (username.length() < 3) return -2;
- std::ifstream ifs("players/" + username + ".json");
- if (ifs.is_open()) {
- return -1;
- }
- std::ofstream o("players/" + username + ".json");
- if (!o.is_open()) {
- cout << GetLastError() << endl;
- _getch();
- }
- json j;
- PlayerInfo pinfo;
- j["username"] = username;
- j["password"] = hashPassword(password);
- j["adminLevel"] = 0;
- j["ClothBack"] = 0;
- j["ClothHand"] = 0;
- j["ClothFace"] = 0;
- j["ClothShirt"] = 0;
- j["ClothPants"] = 0;
- j["ClothNeck"] = 0;
- j["ClothHair"] = 0;
- j["ClothFeet"] = 0;
- j["ClothMask"] = 0;
- j["Level"] = 0;
- j["block"] = 0;
- j["isBanned"] = "false";
- o << j << std::endl;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement