jlalt

666666

Dec 12th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.91 KB | None | 0 0
  1. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  2. {
  3.     switch(dialogid)
  4.     {
  5.         case DIALOG_FORGET:
  6.         {
  7.             new query[250];
  8.             mysql_format(database,query,sizeof(query),"SELECT * FROM Accounts WHERE Nick = '%e'", GetName(playerid));
  9.             mysql_tquery(database,query,"LoadPQ","i",playerid);
  10.             if(!response)
  11.             {
  12.                 Kick(playerid);
  13.             }
  14.             else
  15.             {
  16.                 printf("ANSWER TO CHECK IS: %s",PlayerInfo[playerid][Answer]);
  17.                 if(!strcmp(PlayerInfo[playerid][Answer], inputtext, true, 129))
  18.                 {
  19.                     MySQL_Login(playerid); will give him stat back.
  20.                     PlayerInfo[playerid][LoggedIn] = 1;
  21.                     SendClientMessage(playerid, -1, "Access granted.");
  22.                 }
  23.                 else
  24.                 {
  25.                     new string[780];
  26.                     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]);
  27.                     ShowPlayerDialog(playerid, DIALOG_FORGET, DIALOG_STYLE_INPUT, "{FF0000}AwC Security Question", string, "Answer", "Quit");
  28.                 }
  29.             }
  30.         }
  31.      }
  32.   }
  33. forward LoadPQ(playerid);
  34. public LoadPQ(playerid) {
  35.     new rows, fields;
  36.     cache_get_data(rows, fields, database);
  37.     if(rows) {
  38.       new save[2][128];
  39.       cache_get_field_content(0, "Question", save[0], database, 128);
  40.       cache_get_field_content(0, "Answer", save[1], database, 128);
  41.       printf("Question MySQL: %s, Answer MySQL: %s",save[0],save[1]);
  42.       strmid(PlayerInfo[playerid][Question], save[0], 0, strlen(save[0]), 255);
  43.       strmid(PlayerInfo[playerid][Answer], save[1], 0, strlen(save[1]), 255);
  44.       printf("Question Info: %s, Answer Info: %s",PlayerInfo[playerid][Question],PlayerInfo[playerid][Answer]);
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment