Guest User

Untitled

a guest
Apr 13th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.66 KB | None | 0 0
  1. 1. ode
  2.  
  3. Encrypt(string[])
  4. {
  5. for(new x=0; x < strlen(string); x++)
  6. {
  7. string[x] += (3^x) * (x % 15);
  8.  
  9. if(string[x] > (0xff))
  10. {
  11. string[x] -= 256;
  12. }
  13. }
  14. return 1;
  15. }
  16.  
  17.  
  18. //============================================================0
  19.  
  20.  
  21.  
  22.  
  23. 2.
  24.  
  25.  
  26.  
  27. public OnPlayerRequestClass(playerid, classid)
  28. {
  29. if (!GetPVarInt(playerid, "gPlayerLogged"))
  30. {
  31. new playername[MAX_PLAYER_NAME],
  32. file[128];
  33.  
  34. // Clear Chat
  35. ClearChatBox(playerid);
  36.  
  37. // Removes Class Selection
  38. TogglePlayerSpectating(playerid, 1);
  39.  
  40. // Show Connect TextDraws
  41. ShowConnectTextDraws(playerid);
  42.  
  43. GetPlayerName(playerid, playername, sizeof(playername));
  44. format(file, sizeof(file), "/accounts/%s.ini", playername);
  45.  
  46. if(fexist(file))
  47. {
  48. new string[256];
  49.  
  50. format(string, sizeof(string), DialogTexts[0],
  51. playername,
  52. MAX_LOGIN_TIME);
  53. if(IsPlayerNPC(playerid))
  54. {
  55. if(strcmp(playername, "Vozi_Misko", true) == 0)
  56. {
  57. new tmppass[64];
  58. strmid(tmppass, "imjustnpc", 0, strlen("imjustnpc"), 255);
  59. // --> Encrypt(tmppass);
  60. LoginPlayer(playerid, tmppass);
  61. SetPlayerColor(playerid,0xFFFFFF00);
  62. }
  63. }
  64. else
  65. ShowPlayerDialog(playerid, DIALOG_LOGIN + playerid, DIALOG_STYLE_PASSWORD, "PRIJAVA", string, "Prijava", "Odustani");
  66. return 1;
  67. }
  68. else
  69. {
  70. // Registration Step 1 (Agreement)...
  71. SetPVarInt(playerid, "PlayerRegistrating", 1);
  72. ShowPlayerDialog(playerid, DIALOG_REG_AGREEMENT + playerid, DIALOG_STYLE_MSGBOX, "REGISTRACIJA - PRVI KORAK (UVJETI KORISTENJA)", DialogTexts[2], "Da", "Ne");
  73. return 1;
  74. }
  75. }
  76. else
  77. {
  78. // Class Selection after death (F4)
  79. TogglePlayerSpectating(playerid, 1);
  80. SetTimerEx("OnPlayerRequestClassEx", 2000, 0, "i", playerid);
  81. SendClientMessage(playerid, COLOR_WHITE, "Ako zelite promjeniti izgled (Skin) svoga lika, posjetite \"Clothing Shop\".");
  82. return 1;
  83. }
  84. }
  85.  
  86.  
  87.  
  88.  
  89.  
  90. //=======================================================================
  91.  
  92. 3.
  93.  
  94. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  95. {
  96. new string[128],
  97. playername[MAX_PLAYER_NAME],
  98. sendername[MAX_PLAYER_NAME];
  99.  
  100. if (dialogid == DIALOG_LOGIN + playerid) // Login Dialog
  101. {
  102. if (response == 1) // Prijava
  103. {
  104. if (!strlen(inputtext)) // IMPORTANT!!!
  105. {
  106. PovecajPVarInt(playerid, "gPlayerLogTries", 1);
  107.  
  108. new LoginTriesLeft = (MAX_LOGIN_TRIES - GetPVarInt(playerid, "gPlayerLogTries")),
  109. loginstring[512];
  110.  
  111. format(loginstring,sizeof(loginstring), DialogTexts[1],
  112. MAX_LOGIN_TRIES,
  113. LoginTriesLeft);
  114.  
  115. ShowPlayerDialog(playerid, DIALOG_LOGIN + playerid, DIALOG_STYLE_PASSWORD, "PRIJAVA", loginstring, "Prijava", "Odustani");
  116.  
  117. if (GetPVarInt(playerid, "gPlayerLogTries") == MAX_LOGIN_TRIES)
  118. {
  119. HideConnectTextDraws(playerid);
  120. HidePlayerDialog(playerid);
  121. Ban(playerid);
  122. }
  123. return 1;
  124. }
  125. new tmppass[64];
  126. strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
  127. //-----> Encrypt(tmppass);
  128. LoginPlayer(playerid, tmppass);
  129. return 1;
  130. }
  131. else // Odustani
  132. {
  133. // Hide Connect TextDraws and Kick Player
  134. HideConnectTextDraws(playerid);
  135. Kick(playerid);
  136. return 1;
  137. }
  138. }
  139.  
  140.  
  141.  
  142. //====================================0
  143. 4.
  144.  
  145. else if(dialogid == DIALOG_CHANGEPASSWORD)//novo ubacio
  146. {
  147. new novasifra = strlen(inputtext),
  148. tmppass[64];
  149.  
  150. format(string, sizeof(string), "/accounts/%s.ini", ReturnPVarString(playerid, "ImePrezime"));
  151.  
  152. if(response == 1)
  153. {
  154. if (novasifra < MIN_PASSWORD) // Password too short
  155. {
  156. SendClientMessage(playerid, COLOR_RED, "Lozinka je prekratka! (Min 6 znakova)");
  157. return 1;
  158. }
  159. else if (novasifra > MAX_PASSWORD) // Password too long
  160. {
  161. SendClientMessage(playerid, COLOR_RED, "Lozinka je preduga! (Max 14 znakova)");
  162. return 1;
  163. }
  164. strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
  165. //----> Encrypt(tmppass);
  166. RegisterPlayer(playerid, tmppass);
  167. format(string, sizeof(string), "Nova lozinka: %s", inputtext);
  168. SendClientMessage(playerid, COLOR_YELLOW, string);
  169. SetPVarInt(playerid, "gPlayerLogged", 0);
  170. SendClientMessage(playerid, COLOR_YELLOW, "Ulogirajte se ponovno s novom sifrom!");
  171. return 1;
  172. }
  173. else
  174. HidePlayerDialog(playerid);
  175. }
  176. //=========================================
  177. 5.
Advertisement
Add Comment
Please, Sign In to add comment