Advertisement
Guest User

OndialogResponse

a guest
Jun 28th, 2014
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.32 KB | None | 0 0
  1. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  2. {
  3. if(dialogid == REGISTER_DIALOG)
  4. {
  5. if(!response) Kick(playerid);
  6. if(response)
  7. {
  8. if(strlen(inputtext) > PASS_MAX_LENGHT || strlen(inputtext) < PASS_MIN_LENGHT) return ShowRegisterDialog(playerid);
  9. new wp_hash[129];
  10. WP_Hash(wp_hash, sizeof(wp_hash), inputtext);
  11. new INI: file = INI_Open(GetPlayerFile(playerid) );
  12. INI_SetTag(file, "Player's File");
  13. INI_WriteString(file, "Name", GetName(playerid) );
  14. INI_WriteString(file, "Password", wp_hash);
  15. //ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_LIST, "Esti baiat sau fata?", "Baiat \nFata", "Selecteaza" , "");
  16. ShowPlayerDialog(playerid, DIALOG_FULLNAME, DIALOG_STYLE_INPUT, "Nume", "Scrie numele complet", "Ok" , "");
  17. }
  18. }
  19. if(dialogid == DIALOG_FULLNAME) {
  20. new INI: file = INI_Open(GetPlayerFile(playerid) );
  21. INI_WriteInt(file, "FullName", strlen(inputtext));
  22. SendClientMessage(playerid,0xFFFFFFFF,"[{3399FF}NemeSys RPG{FFFFFF}]Bine,deci numele tau este %s.");
  23. ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_LIST, "Esti baiat sau fata?", "Baiat \nFata", "Selecteaza" , "");
  24. }
  25. if(dialogid == DIALOG_SEX) {
  26. new INI: file = INI_Open(GetPlayerFile(playerid) );
  27. if(listitem == 0) {
  28. INI_WriteInt(file, "Sex", strlen("Baiat"));
  29. SendClientMessage(playerid,0xFFFFFFFF,"[{3399FF}NemeSys RPG{FFFFFF}]Bine,deci esti baiat.");
  30. ShowPlayerDialog(playerid, DIALOG_VARSTA, DIALOG_STYLE_INPUT, "Varsta", "Cati ani ai?", "Ok" , "");
  31. }
  32. if(listitem == 1) {
  33. INI_WriteInt(file, "Sex", strlen("Fata"));
  34. SendClientMessage(playerid,0xFFFFFFFF,"[{3399FF}NemeSys RPG{FFFFFF}]Bine,deci esti fata.");
  35. ShowPlayerDialog(playerid, DIALOG_VARSTA, DIALOG_STYLE_INPUT, "Varsta", "Cati ani ai?", "Ok" , "");
  36. }
  37. }
  38. if(dialogid == DIALOG_VARSTA) {
  39. new INI: file = INI_Open(GetPlayerFile(playerid) );
  40. INI_WriteInt(file, "Varsta", strval(inputtext));
  41. SendClientMessage(playerid,0xFFFFFFFF,"[{3399FF}NemeSys RPG{FFFFFF}]Bine,deci ai %d ani.");
  42. ShowPlayerDialog(playerid, DIALOG_SPAWN, DIALOG_STYLE_LIST, "Alege locul unde vrei sa fii spawnat.", "Los Santos \nLas Venturas \nSan Fierro", "Selecteaza" , "");
  43. }
  44. if(dialogid == DIALOG_SPAWN) {
  45. new INI: file = INI_Open(GetPlayerFile(playerid) );
  46. if(listitem == 0)
  47. {
  48. SendClientMessage(playerid,COLOR_WHITE,"[{3399FF}HardCore-Gaming{FFFFFF}]Bine,deci vei fi spawnat in Los Santos");
  49. INI_WriteInt(file, "Spawn", 1);//LS
  50. INI_WriteInt(file, "Admin", 0);
  51. INI_WriteInt(file, "Vip", 0);
  52. INI_WriteInt(file, "Kills", 0);
  53. INI_WriteInt(file, "Deaths", 0);
  54. INI_WriteInt(file, "Hours", 0);
  55. INI_WriteInt(file, "Minute", 0);
  56. INI_WriteInt(file, "Second", 0);
  57. INI_WriteInt(file, "Warnings", 0);
  58. INI_WriteInt(file, "Jailed", 0);
  59. INI_WriteInt(file, "Banned", 0);
  60. INI_WriteInt(file, "BanTime", 0);
  61. INI_WriteInt(file, "Muted", 0);
  62. INI_WriteInt(file, "Cash", 0);
  63. INI_WriteInt(file, "Score", 0);
  64. #if SAVE_SKIN == true
  65. INI_WriteInt(file, "Skin", 0);
  66. #endif
  67. INI_Close(file);
  68. SendClientMessage(playerid, XSTADMIN_PRIMARYCOLOR, "[REGISTER] Your account was succesfull register in the database");
  69. ShowLoginDialog(playerid);
  70. }
  71. else if(listitem == 1)
  72. {
  73. SendClientMessage(playerid,COLOR_WHITE,"[{3399FF}HardCore-Gaming{FFFFFF}]Bine,deci vei fi spawnat in San Fierro");
  74. INI_WriteInt(file, "Spawn", 2);//SF
  75. INI_WriteInt(file, "Admin", 0);
  76. INI_WriteInt(file, "Vip", 0);
  77. INI_WriteInt(file, "Kills", 0);
  78. INI_WriteInt(file, "Deaths", 0);
  79. INI_WriteInt(file, "Hours", 0);
  80. INI_WriteInt(file, "Minute", 0);
  81. INI_WriteInt(file, "Second", 0);
  82. INI_WriteInt(file, "Warnings", 0);
  83. INI_WriteInt(file, "Jailed", 0);
  84. INI_WriteInt(file, "Banned", 0);
  85. INI_WriteInt(file, "BanTime", 0);
  86. INI_WriteInt(file, "Muted", 0);
  87. INI_WriteInt(file, "Cash", 0);
  88. INI_WriteInt(file, "Score", 0);
  89. #if SAVE_SKIN == true
  90. INI_WriteInt(file, "Skin", 0);
  91. #endif
  92. INI_Close(file);
  93. ShowLoginDialog(playerid);
  94. }
  95. else if(listitem == 2)
  96. {
  97. SendClientMessage(playerid,COLOR_WHITE,"[{3399FF}HardCore-Gaming{FFFFFF}]Bine,deci vei fi spawnat in Las Venturas");
  98. INI_WriteInt(file, "Spawn", 3);//LV
  99. INI_WriteInt(file, "Admin", 0);
  100. INI_WriteInt(file, "Vip", 0);
  101. INI_WriteInt(file, "Kills", 0);
  102. INI_WriteInt(file, "Deaths", 0);
  103. INI_WriteInt(file, "Hours", 0);
  104. INI_WriteInt(file, "Minute", 0);
  105. INI_WriteInt(file, "Second", 0);
  106. INI_WriteInt(file, "Warnings", 0);
  107. INI_WriteInt(file, "Jailed", 0);
  108. INI_WriteInt(file, "Banned", 0);
  109. INI_WriteInt(file, "BanTime", 0);
  110. INI_WriteInt(file, "Muted", 0);
  111. INI_WriteInt(file, "Cash", 0);
  112. INI_WriteInt(file, "Score", 0);
  113. #if SAVE_SKIN == true
  114. INI_WriteInt(file, "Skin", 0);
  115. #endif
  116. INI_Close(file);
  117. ShowLoginDialog(playerid);
  118. }
  119. }
  120. if(dialogid == LOGIN_DIALOG)
  121. {
  122. if(!response) Kick(playerid);
  123. if(response)
  124. {
  125. new wp_hash[129];
  126. WP_Hash(wp_hash, sizeof(wp_hash), inputtext);
  127. if(!strcmp(wp_hash, PlayerInfo[playerid][Password], false) )
  128. {
  129. INI_ParseFile(GetPlayerFile(playerid), "loadplayerdata", .bExtra = true, .extra = playerid);
  130. SpawnPlayer(playerid);
  131. SetPlayerScore(playerid, PlayerInfo[playerid][Score]);
  132. GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]);
  133. SendClientMessage(playerid, XSTADMIN_PRIMARYCOLOR, "[LOGIN] You sucessfull logged in.");
  134. #if SAVE_SKIN == true
  135. SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
  136. #endif
  137. if(PlayerInfo[playerid][Admin] > 0) {
  138. SendClientMessage(playerid, XSTADMIN_PRIMARYCOLOR, "[ADMIN] You logged in as Admin. type: /ah");
  139. }
  140. if(PlayerInfo[playerid][Vip] > 0) {
  141. SendClientMessage(playerid, XSTADMIN_PRIMARYCOLOR, "[VIP] You logged in as VIP . type: /vh");
  142. }
  143. }
  144. else
  145. {
  146. SendClientMessage(playerid, XSTADMIN_PRIMARYCOLOR, "[LOGIN] Password is incorrect");
  147. ShowLoginDialog(playerid);
  148. }
  149. }
  150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement