28.03.2017, 17:17
Good evening, I have a problem with login. I'm authorized if I enter anything, or I will not even enter it. I apologize in advance for my English. Registration good work.
Code in public OnPlayerConnect :
Code OnDialogResponse:
Code LoadPlayerAccount:
Previously, with such a problem, I have not yet met
Code in public OnPlayerConnect :
Код HTML:
GetPlayerName(playerid,pInfo[playerid][cName],MAX_PLAYER_NAME); new string[MAX_PLAYER_NAME + 6 + 4]; format(string,sizeof(string),"Users/%s.ini",pInfo[playerid][cName]); new openFile = ini_openFile(string); if(openFile < 0) //unknown file { ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"{E10000}Ghosts War {FFFFFF}| Register","Добро пожаловать на Ghosts War! Ваш аккаунт не зарегистрирован.\nВведите ваш пароль для того чтобы создать новый аккаунт.","Ввод","Выход"); return 1; } else { ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"{E10000}Ghosts War {FFFFFF}| Login","Добро пожаловать на Ghosts War! Ваш аккаунт зарегистрирован. \nВведите пароль для входа в свой аккаунт","Логин","Выход"); ini_getString(openFile,"Pass",pInfo[playerid][Pass]); ini_closeFile(openFile); //LoadPlayerAccount(playerid); }
Код HTML:
case 2: //авторизация { if(!response) return Kick(playerid); if(response) { if(!strcmp(inputtext, pInfo[playerid][Pass], false)) //if(strcmp(inputtext) == pInfo[playerid][Pass]) { LoadPlayerAccount(playerid); SetPlayerScore(playerid,pInfo[playerid][Scores]); GivePlayerMoney(playerid,pInfo[playerid][Money]); SendClientMessage(playerid, COLOR_WHITE, "{ff0000}Good Pass"); } else { SendClientMessage(playerid, COLOR_WHITE, "Unknown Pass"); ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"{E10000}Ghosts War {FFFFFF}| Логин","Добро пожаловать на Ghosts War! Ваш аккаунт зарегистрирован. \n{FF0000}Введите пароль для входа в свой аккаунт","Логин","Выход");// код если пароль не верный return 1; } } }
Код HTML:
stock LoadPlayerAccount(playerid) { new str[35]; format(str,sizeof(str),"Users/%s.ini",pInfo[playerid][cName]); new openFile = ini_openFile(str); ini_getInteger(openFile,"Pass",pInfo[playerid][Pass]); ini_getInteger(openFile,"Sex",pInfo[playerid][pSex]); ini_getInteger(openFile,"AdminLevel",pInfo[playerid][Adminlevel]); ini_getInteger(openFile,"VIPLevel",pInfo[playerid][VIPlevel]); ini_getInteger(openFile,"Money",pInfo[playerid][Money]); ini_getInteger(openFile,"Scores",pInfo[playerid][Scores]); ini_getInteger(openFile,"Kills",pInfo[playerid][Kills]); ini_getInteger(openFile,"Ban",pInfo[playerid][Banned]); ini_getInteger(openFile,"Deaths",pInfo[playerid][Deaths]); ini_closeFile(openFile); GivePlayerMoney(playerid, pInfo[playerid][Money]); SetPlayerScore(playerid, pInfo[playerid][Scores]); return 1; }