Advertisement
Guest User

Untitled

a guest
Sep 11th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.53 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <dfile>
  4. #include <kolory>
  5. #include <sscanf>
  6. #pragma tabsize 0
  7. #define MENU01 3
  8. #define FOLDER_KONT "/Konta/"
  9. #define DIALOG_REJESTRACJA 0
  10. #define DIALOG_LOGOWANIE 1
  11. #define PUNKTY_NA_START 10
  12. #define KASA_NA_START 10500
  13.  
  14.  
  15. main()
  16. {
  17. print("\n----------------------------------");
  18. print(" Mapa stworzona przez Dj_Malina!");
  19. print("----------------------------------\n");
  20. }
  21.  
  22. enum Dgracza
  23. {
  24. bool:Zalogowany
  25. };
  26. new DaneGracza[MAX_PLAYERS][Dgracza];
  27.  
  28. public OnGameModeInit()
  29. {
  30. for(new idskina=0; idskina < 311; idskina++)
  31. {
  32. AddPlayerClass(idskina, 00.00, 00.00, 00.00, 00.00, 0, 0, 0, 0, 0, 0);
  33. }
  34. UsePlayerPedAnims();
  35. // Don't use these lines if it's a filterscript
  36. /*SetGameModeText("Aktualizacja 1.1.2 ");
  37. AddPlayerClass(19, 00.00, 00.00, 00.00, 00.00, 0, 0, 0, 0, 0, 0);
  38. AddPlayerClass(22, 00.00, 00.00, 00.00, 00.00, 0, 0, 0, 0, 0, 0);
  39. AddPlayerClass(26, 00.00, 00.00, 00.00, 00.00, 0, 0, 0, 0, 0, 0);
  40. AddPlayerClass(302, 00.00, 00.00, 00.00, 00.00, 0, 0, 0, 0, 0, 0);
  41. AddPlayerClass(303, 00.00, 00.00, 00.00, 00.00, 0, 0, 0, 0, 0, 0);
  42. AddPlayerClass(251, 00.00, 00.00, 00.00, 00.00, 0, 0, 0, 0, 0, 0);*/
  43.  
  44. if(!dfile_FileExists(FOLDER_KONT))
  45. return printf("Folder %s nie istnieje w folderze Scriptfiles! Stwórz go!", FOLDER_KONT);
  46. else printf("Folder %s istnieje i jest gotowy do wczytania kont!", FOLDER_KONT);
  47. return 1;
  48. }
  49. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext [])
  50. if(dialogid == DIALOG_LOGOWANIE)
  51. {
  52. if(response)
  53. {
  54. dfile_Open(SciezkaKontaGracza(playerid));
  55. new haslo[300];
  56. haslo = dfile_ReadString("Haslo");
  57. dfile_CloseFile();
  58. if(strcmp(inputtext, haslo, false) == 0)
  59. {
  60. }
  61. WczytajKonto(playerid);
  62. DaneGracza[playerid][Zalogowany] = true;
  63. TogglePlayerSpectating(playerid, false);
  64. WymusWyborPostaci(playerid);
  65. SendClientMessage(playerid, COLOR_GREEN, "Serwer: Hasło się zgadza, zostałeś(aś) pomyśle zalogowany(a)!");
  66. {
  67. else
  68. OknoLogowania(playerid);
  69. SendClientMessage(playerid, COLOR_GREEN, "Serwer: Hasło musi posiadać minimum 6 znaków");
  70. }
  71. }
  72. else Kick(playerid);
  73. if(dialogid == DIALOG_REJESTRACJA)
  74. if (response)
  75. if(strlen(inputtext) >= 6)
  76. {
  77. StworzKonto(playerid, inputtext);
  78. OknoLogowania(playerid);
  79. SendClientMessage(playerid, COLOR_GREEN, "Serwer: Konto zostało pomyślnie założone");
  80. }
  81. else
  82. {
  83. OknoRejestracji(playerid);
  84. SendClientMessage(playerid, COLOR_RED, "Serwer: Hasło się nie zgadza!");
  85. }
  86. else Kick(playerid);
  87. }
  88.  
  89. public OnPlayerSpawn(playerid)
  90. {
  91. if(DaneGracza[playerid][Zalogowany] == false)
  92. {
  93. TogglePlayerSpectating(playerid, true);
  94. if(!dfile_FileExists(SciezkaKontaGracza(playerid)))
  95. OknoRejestracji(playerid);
  96. }
  97. else
  98. OknoLogowania(playerid);
  99. }
  100.  
  101. public OnPlayerRequestClass(playerid,classid)
  102. {
  103. if(DaneGracza[playerid][Zalogowany] == false)
  104. {
  105. SetTimerEx("SpawnujGracza", 150, false, "i", playerid);
  106. }
  107. SetPlayerPos(playerid, 245.7793,-63.5309,4.3786);
  108. SetPlayerFacingAngle(playerid, 87.6020);
  109. SetPlayerCameraPos(playerid, 234.7242,-65.7141,1.4222);
  110. SetPlayerCameraLookAt(playerid, 245.7793,-63.5309,4.3786);
  111. return 1;
  112. }
  113.  
  114. stock SciezkaKontaGracza(playerid)
  115. {
  116. new sciezka[128];
  117. format(sciezka, sizeof sciezka, FOLDER_KONT "%s.ini", NazwaGracza(playerid));
  118. return sciezka;
  119. }
  120.  
  121. stock WczytajKonto(playerid)
  122. {
  123. ResetPlayerMoney(playerid);
  124.  
  125. dfile_Open(SciezkaKontaGracza(playerid));
  126.  
  127. SetPlayerScore(playerid, dfile_ReadInt("Punkty"));
  128. GivePlayerMoney(playerid, dfile_ReadInt("Kasa"));
  129.  
  130. dfile_CloseFile();
  131. return 1;
  132. }
  133. {
  134. stock StworzKonto(playerid, haslo[])
  135. dfile_Create(SciezkaKontaGracza(playerid));
  136.  
  137. dfile_Open(SciezkaKontaGracza(playerid));
  138.  
  139. dfile_WriteString("Haslo", haslo);
  140. dfile_WriteInt("Punkty", PUNKTY_NA_START);
  141. dfile_WriteInt("Kasa", KASA_NA_START);
  142. dfile_WriteInt("Level", 9);
  143.  
  144. dfile_SaveFile();
  145. dfile_CloseFile();
  146. return 1;
  147. }
  148. stock OknoRejestracji(playerid)
  149. {
  150. ShowPlayerDialog(playerid, DIALOG_REJESTRACJA, DIALOG_STYLE_PASSWORD, "Rejestracja", "Witaj na serwerze!\nNie posiadasz konta, proszę się zarejestrować!", "Zarejestruj", "Wyjdź");
  151. return 1;
  152. }
  153.  
  154. stock OknoLogowania(playerid)
  155. {
  156. ShowPlayerDialog(playerid, DIALOG_LOGOWANIE, DIALOG_STYLE_PASSWORD, "Logowanie", "Witaj na serwerze!\nproszę się Zalogować!", "Zaloguj", "Wyjdź");
  157. return 1;
  158. }
  159.  
  160. stock NazwaGracza(playerid)
  161. {
  162. new nazwa [MAX_PLAYER_NAME];
  163. GetPlayerName(playerid, nazwa, sizeof nazwa);
  164. return nazwa;
  165. }
  166.  
  167. forward SpawnujGracza(playerid);
  168. public SpawnujGracza(playerid)
  169. {
  170. SpawnPlayer(playerid);
  171. return 1;
  172. }
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179. //FILM - 1H 30MIN 07SEC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement