20.10.2016, 23:53
Good evening, I followed a tutorial to create register/login system.
But now I want to store 3 names into the .ini file. But it doesn't save the names.
This is what happens when people register:
It saves the password perfectly, but the names do not get saved.
But now I want to store 3 names into the .ini file. But it doesn't save the names.
This is what happens when people register:
Код:
if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Password",udb_hash(inputtext)); INI_WriteString(File, "Name", "Empty"); INI_WriteString(File, "Name2", "Empty"); INI_WriteString(File, "Name3", "Empty"); INI_Close(File); SaveAccount(playerid); SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok",""); }
Код:
enum mInfo { mPass, mName[32], mName2[32], mName3[32] } new MasterInfo[MAX_PLAYERS][mInfo]; forward LoadUser_data(playerid,name[],value[]); public LoadUser_data(playerid,name[],value[]) { INI_Int("Password",MasterInfo[playerid][mPass]); INI_String("Name",MasterInfo[playerid][mName], 32); INI_String("Name2",MasterInfo[playerid][mName2], 32); INI_String("Name3",MasterInfo[playerid][mName3], 32); return 1; } stock SaveAccount(playerid) { new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteString(File, "Name", MasterInfo[playerid][mName]); INI_WriteString(File, "Name2", MasterInfo[playerid][mName2]); INI_WriteString(File, "Name3", MasterInfo[playerid][mName3]); INI_Close(File); }