Guest User

Jebat cu te

a guest
Dec 13th, 2022
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.15 KB | None | 0 0
  1. #include <a_samp>
  2. #include <crashdetect>
  3. #include <easyDialog>
  4. #include <ysilib\YSI_Storage\y_ini>
  5. #include <ysilib\YSI_Coding\y_hooks>
  6. #include <ysilib\YSI_Coding\y_malloc>
  7. #include <ysilib\YSI_Coding\y_timers>
  8. #include <ysilib\YSI_Coding\y_va>
  9. #include <ysilib\YSI_Core\y_master>
  10. #include <ysilib\YSI_Core\y_utils>
  11. #include <ysilib\YSI_Data\y_foreach>
  12. #include <sscanf2>
  13. #include <streamer>
  14.  
  15. #define KORISNICI_FILE "/Korisnici/%s.ini"
  16.  
  17. enum pInfo {
  18. pLozinka,
  19. pNovac,
  20. pLevel,
  21. pRespekti,
  22. pPotrebnoRespekta,
  23. pAdmin,
  24. pSkin
  25. };
  26.  
  27. new PlayerInfo[MAX_PLAYERS][pInfo];
  28.  
  29. stock UserPath(const playerid)
  30. {
  31. new string[128],playername[MAX_PLAYER_NAME];
  32. GetPlayerName(playerid,playername,sizeof(playername));
  33. format(string,sizeof(string),KORISNICI_FILE,playername);
  34. return string;
  35. }
  36.  
  37. stock udb_hash(const buf[])
  38. {
  39. new length=strlen(buf);
  40. new s1 = 1;
  41. new s2 = 0;
  42. new n;
  43. for (n=0; n<length; n++)
  44. {
  45. s1 = (s1 + buf[n]) % 65521;
  46. s2 = (s2 + s1) % 65521;
  47. }
  48. return (s2 << 16) + s1;
  49. }
  50.  
  51. forward LoadUser_data(const playerid,name[],value[]);
  52. public LoadUser_data(const playerid,name[],value[])
  53. {
  54. INI_Int("Lozinka",PlayerInfo[playerid][pLozinka]);
  55. INI_Int("Novac", PlayerInfo[playerid][pNovac]);
  56. INI_Int("Level", PlayerInfo[playerid][pLevel]);
  57. INI_Int("Respekti", PlayerInfo[playerid][pRespekti]);
  58. INI_Int("PotrebnoRespekta", PlayerInfo[playerid][pPotrebnoRespekta]);
  59. INI_Int("Admin", PlayerInfo[playerid][pAdmin]);
  60. INI_Int("Skin", PlayerInfo[playerid][pSkin]);
  61. return 1;
  62. }
  63.  
  64. hook OnGameModeInit() {
  65. print("|------------------------------|");
  66. print(" reglog is loading... ");
  67. print(" reglog is founded ");
  68. print(" reglog is loaded ");
  69. print("|------------------------------|\n\n");
  70. return 1;
  71. }
  72.  
  73. hook OnPlayerConnect(playerid) {
  74. if(fexist(UserPath(playerid))) {
  75. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra=true, .extra=playerid);
  76. Dialog_Show(playerid, "d_login", DIALOG_STYLE_PASSWORD, ""c_srv"BO > "c_white"Login", "Unesite vasu lozinku\nAko ste ju zaboravili, posjetite nas forum:"c_srv"www.balkan-original.info", ""c_white"Login", ""c_white"Izlaz");
  77. }
  78. else {
  79. Dialog_Show(playerid, "d_register", DIALOG_STYLE_PASSWORD, ""c_srv"BO > "c_white"Register", ""c_white"Unesite zeljenu lozinku", ""c_white"Register", ""c_white"Izlaz");
  80. }
  81. return 1;
  82. }
  83.  
  84. hook OnPlayerDisconnect(playerid, reason) {
  85. new INI:File = INI_Open(UserPath(playerid));
  86. INI_SetTag(File, "Informacije");
  87. INI_WriteInt(File, "Novac", GetPlayerMoney(playerid));
  88. INI_WriteInt(File, "Level", GetPlayerScore(playerid));
  89. INI_WriteInt(File, "Respekti", PlayerInfo[playerid][pRespekti]);
  90. INI_WriteInt(File, "PotrebnoRespekta", PlayerInfo[playerid][pPotrebnoRespekta]);
  91. INI_WriteInt(File, "Admin", PlayerInfo[playerid][pAdmin]);
  92. INI_WriteInt(File, "Skin", PlayerInfo[playerid][pSkin]);
  93. INI_Close(File);
  94. return 1;
  95. }
  96.  
  97. hook OnPlayerSpawn(playerid) {
  98. SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
  99. return 1;
  100. }
  101.  
  102. Dialog:d_register(const playerid, response, listitem, string: inputtext[]) {
  103. if(!response) return Kick(playerid);
  104. if(response) {
  105. if(!strlen(inputtext)) return Dialog_Show(playerid, "d_register", DIALOG_STYLE_PASSWORD, ""c_srv"BO > "c_white"Register", ""c_white"Unesite zeljenu lozinku", ""c_white"Register", ""c_white"Izlaz");
  106. new INI:File = INI_Open(UserPath(playerid));
  107. INI_SetTag(File, "Informacije");
  108. INI_WriteInt(File, "Novac", 15000);
  109. INI_WriteInt(File, "Level", 3);
  110. INI_WriteInt(File, "Respekti", 0);
  111. INI_WriteInt(File, "PotrebnoRespekta", 15);
  112. INI_WriteInt(File, "Admin", 0);
  113. INI_WriteInt(File, "Skin", 7);
  114. INI_Close(File);
  115. SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
  116. SpawnPlayer(playerid);
  117. PlayerInfo[playerid][pNovac] = 15000;
  118. GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]);
  119. PlayerInfo[playerid][pLevel] = 3;
  120. SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
  121. PlayerInfo[playerid][pSkin] = 7;
  122. SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
  123. PlayerInfo[playerid][pPotrebnoRespekta] = 15;
  124. }
  125. return 1;
  126. }
  127.  
  128. Dialog:d_login(const playerid, response, listitem, string: inputtext[]) {
  129. if(!response) return Kick(playerid);
  130. if(response) {
  131. if(udb_hash(inputtext) == PlayerInfo[playerid][pLozinka]) {
  132. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra=true, .extra=playerid);
  133. GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]);
  134. SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
  135. SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
  136. }
  137. else {
  138. Dialog_Show(playerid, "d_login", DIALOG_STYLE_PASSWORD, ""c_srv"BO > "c_white"Login", "Unesite vasu lozinku\nAko ste ju zaboravili, posjetite nas forum:"c_srv"www.balkan-original.info", ""c_white"Login", ""c_white"Izlaz");
  139. }
  140. return 1;
  141. }
  142. return 1;
  143. }
Advertisement
Add Comment
Please, Sign In to add comment