Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  2. {
  3. switch( dialogid )
  4. {
  5. case DIALOG_REGISTER:
  6. {
  7. if (!response) return Kick(playerid);
  8. if(response)
  9. {
  10. 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");
  11. new INI:File = INI_Open(UserPath(playerid));
  12. INI_SetTag(File,"data");
  13. INI_WriteString(File,"Password",inputtext);
  14. INI_WriteInt(File,"Cash",0);
  15. INI_WriteInt(File,"Admin",0);
  16. INI_WriteInt(File,"Level",1);
  17. INI_Close(File);
  18.  
  19. SpawnPlayer(playerid);
  20. 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","");
  21. SetPlayerScore(playerid, 1);
  22. }
  23. }
  24.  
  25. case DIALOG_LOGIN:
  26. {
  27. if ( !response ) return Kick ( playerid );
  28. if( response )
  29. {
  30. if(strlen(inputtext) == 0) return
  31. if(strcmp(inputtext, PlayerInfo[playerid][pPass],false) == 0)
  32. {
  33. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  34. GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
  35. ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
  36. }
  37. else
  38. {
  39. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
  40. }
  41. return 1;
  42. }
  43. }
  44. }
  45. return 1;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement