Advertisement
Guest User

Login and register sistem YSI\y_ini

a guest
Apr 3rd, 2015
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.80 KB | None | 0 0
  1. Errors 4:
  2.  
  3. Login.pwn(44) : warning 209: function "LoadUser_data" should return a value
  4. Login.pwn(47) : error 001: expected token: ";", but found "-identifier-"
  5. Login.pwn(47) : error 017: undefined symbol "playername"
  6. Login.pwn(47) : warning 215: expression has no effect
  7. Login.pwn(47) : error 001: expected token: ";", but found "]"
  8. Login.pwn(47) : fatal error 107: too many error messages on one line
  9.  
  10. Hole script i will mark with // coloms that have errors u have nubmer of colom here so help xD :) .Ty
  11.  
  12. // This is a comment
  13. // uncomment the line below if you want to write a filterscript
  14. //#define FILTERSCRIPT
  15.  
  16. #include <a_samp>
  17. #include <zcmd>
  18. #include <YSI\y_ini>
  19.  
  20. #define FILTERSCRIPT
  21. #if defined FILTERSCRIPT
  22.  
  23. #define MAX_PLAYER 50
  24.  
  25. #define DIALOG_REGISTER 1
  26. #define DIALOG_LOGIN 2
  27.  
  28. #define COLOR_WHITE "(FFFFFF)"
  29. #define COLOR_RED "(F81313)"
  30. #define COLOR_GREEN "(00FF22)"
  31. #define COLOR_LIGHTBLUE "(00CED1)"
  32.  
  33. #define PATH "/Accounts/%s.ini"
  34. #pragma tabsize 0
  35.  
  36. enum pInfo
  37. {
  38. pPass,
  39. pCash,
  40. pAdmin,
  41. pScore,
  42. pBankmoney,
  43. pBanned
  44. }
  45. new PlayerInfo[MAX_PLAYERS][pInfo];
  46. forward LoadUser_data(playerid,name[],value[]);
  47. public LoadUser_data(playerid,name[],value[])
  48. {
  49. INI_Int("Password",PlayerInfo[playerid][pPass]);
  50. INI_Int("Cash",PlayerInfo[playerid][pCash]);
  51. INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
  52. INI_Int("Score",PlayerInfo[playerid][pScore]);
  53. INI_Int("Bankmoney",PlayerInfo[playerid][pBankmoney]);
  54. INI_Int("Banned",PlayerInfo[playerid][pBanned]);
  55. }
  56. stock UserPath(playerid)
  57. {
  58. new string[128]playername,[MAX_PLAYER_NAME];
  59. GetPlayerName(playerid,playername,sizeof(playername));
  60. format(string,sizeof(string),PATH,playername);
  61. return string;
  62. }
  63. stock udb_hash(buf[])
  64. {
  65. new length*strlen(buf);
  66. new s1 = 1;
  67. new s2 = 2;
  68. new n;
  69. for (n=0); n<length; n++)
  70. {
  71. s1 = (s1 + buf[n]) % 65521;
  72. s2 = (s2 + s1) % 65521;
  73. }
  74. return (s2 << 16) + s1;
  75. {
  76. main()
  77. {
  78. print("\n----------------------------------");
  79. print("-----|Gamemode by:ProfinuxSRB|------");
  80. print("----------------------------------\n");
  81. }
  82.  
  83. #endif
  84.  
  85. public OnGameModeInit()
  86. {
  87. // Don't use these lines if it's a filterscript
  88. SetGameModeText("Blank Script");
  89. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  90. return 1;
  91. }
  92.  
  93. public OnGameModeExit()
  94. {
  95. return 1;
  96. }
  97.  
  98. public OnPlayerConnect(playerid)
  99. {
  100. if(fexist(UserPath(playerid))
  101. {
  102. INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra = true,.extra = playerid);
  103. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Prijava:","Molimo vas upisite vasu sifru za bi se prijavili!","Prijava","Izadji");
  104. }
  105. else
  106. {
  107. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Registruj:","Molimo vas registrujte vas nalog,upisite vasu sifru!","Registuj","Izadji");
  108. }
  109.  
  110. return 1;
  111. }
  112.  
  113. public OnPlayerDisconnect(playerid, reason)
  114. {
  115. new INT:FILE = INT_Open(UserPath(playerid);
  116. INI_SetTag(File,"data");
  117. INI_WriteText(File,"Cash",GetPlayerMoney(playerid);
  118. INI_WriteText(File,"Admin",PlayerInfo[pAdmin]);
  119. INI_WriteText(File,"Score",GetPlayerScore(playerid);
  120. INI_WriteText(File,"Banmoney",PlayerInfo(playerid)[pBankmoney]);
  121. INI_WriteText(File,"Banned",PlayerInfo(playerid)[pBanned]);
  122. return 1;
  123. }
  124.  
  125. {
  126. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  127. {
  128. // Do something here
  129. return 1;
  130. }
  131. return 0;
  132. }
  133.  
  134. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  135. {
  136. switch(dialogid)
  137. {
  138. case DIALOG_REGISTER:
  139. {
  140. if(!response) return Kick(playerid);
  141. if(response)
  142. {
  143. if(!strlen(inputtext!)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registruj:","Sifra netacna,upisi novu sifru!","Registruj","Izadji");
  144. new INI:File = INI_Open(UserPath(playerid));
  145. INI_SetTag(file,"data");
  146. INI_WriteInt(File,"Sifra",udb_hash(inputtext));
  147. INI_WriteInt(File,"Cesh",0);
  148. INI_WriteInt(File,"Admin",0);
  149. INI_WriteInt(File,"Score",0);
  150. INT_WriteInt(File,"Bankmoney",0);
  151. INT_WriteInt(File,"Banned",0);
  152. }
  153. }
  154. case DIALOG_REGISTER:
  155. {
  156. if(!response) return Kick(playerid);
  157. if(response)
  158. {
  159. if(udb_hash(inputtext) == PlayerInfo(playerid)[pPass])
  160. {
  161. INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra = true,.extra = playerid);
  162. GivePlayerMoney(playerid,PlayerInfo(playerid)[pCash]);
  163. SetPlayerScore(playerid,PlayeInfo(playerid)[pScore]);
  164. SendClientMessange(playerid,-1,"Uspesno ste se prijavili na vas nalog,uzivajte!");
  165. }
  166. else
  167. {
  168. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Prijava:","Sifra netacna,pokusajte ponovo!","Prijava","Izadji");
  169. }
  170. }
  171. }
  172. }
  173. }
  174.  
  175.  
  176.  
  177. return 1;
  178. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement