Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch(dialogid)
- {
- case DIALOG_FORGET:
- {
- new query[250];
- mysql_format(database,query,sizeof(query),"SELECT * FROM Accounts WHERE Nick = '%e'", GetName(playerid));
- mysql_tquery(database,query,"LoadPQ","i",playerid);
- if(!response)
- {
- Kick(playerid);
- }
- else
- {
- printf("ANSWER TO CHECK IS: %s",PlayerInfo[playerid][Answer]);
- if(!strcmp(PlayerInfo[playerid][Answer], inputtext, true, 129))
- {
- MySQL_Login(playerid); will give him stat back.
- PlayerInfo[playerid][LoggedIn] = 1;
- SendClientMessage(playerid, -1, "Access granted.");
- }
- else
- {
- new string[780];
- format(string, sizeof(string), "You have forgotten your password? If that's the case, answer the question you set on your account and you'll access your account.\n\nQuestion: %s \n\nAnswer?\nPress Quit if you are willing to quit.\n\nERROR: Wrong Answer on the question.",PlayerInfo[playerid][Question]);
- ShowPlayerDialog(playerid, DIALOG_FORGET, DIALOG_STYLE_INPUT, "{FF0000}AwC Security Question", string, "Answer", "Quit");
- }
- }
- }
- }
- }
- forward LoadPQ(playerid);
- public LoadPQ(playerid) {
- new rows, fields;
- cache_get_data(rows, fields, database);
- if(rows) {
- new save[2][128];
- cache_get_field_content(0, "Question", save[0], database, 128);
- cache_get_field_content(0, "Answer", save[1], database, 128);
- printf("Question MySQL: %s, Answer MySQL: %s",save[0],save[1]);
- strmid(PlayerInfo[playerid][Question], save[0], 0, strlen(save[0]), 255);
- strmid(PlayerInfo[playerid][Answer], save[1], 0, strlen(save[1]), 255);
- printf("Question Info: %s, Answer Info: %s",PlayerInfo[playerid][Question],PlayerInfo[playerid][Answer]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment