Advertisement
Guest User

Untitled

a guest
Aug 14th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.20 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. ////////defines//////////////
  4. #define BELA "{FFFFFF}"
  5. #define CRVENA "{FF3333}"
  6. #define COL_ZELENA "{008000}"
  7. #define COL_PLAVA "{00FFFF}"
  8. #define DIALOG_REGISTRACIJA 1
  9. #define DIALOG_LOGIN 2
  10. #define DIALOG_LOGIN_STYLE_INPUT
  11. ///////////////////////////////////
  12. main() {
  13. print("PROBA SRW ");
  14. print("PROBA SRW ");
  15. print("PROBA SRW ");
  16. print("PROBA SRW ");
  17. print("PROBA SRW ");
  18. print("///////////////// ");
  19. }
  20. public OnGameModeInit() {
  21. AddPlayerClass(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  22. return 1; }
  23.  
  24. public OnPlayerConnect(playerid)
  25. {
  26. new File[64]
  27. new name[MAX_PLAYER_NAME];
  28. GetPlayerName(playerid,name,sizeof(name));
  29. format(File,sizeof(File),"/Nalozi/%s.txt",name);
  30. if(dini_Exists(File))
  31. {
  32. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login :","Dobro dosli nazad, ukucajte svoju sifru da bi se ulogovao u svoj nalog !", "Uloguj se!" , "Odbij!");
  33. }
  34. else
  35. {
  36. ShowPlayerDialog(playerid,DIALOG_REGISTRACIJA,DIALOG_STYLE_INPUT,"Registracija :","Ukucaj sifru za svoj nalog!","Registruj se!","Odbij!");
  37.  
  38. }
  39. return 1; }
  40.  
  41.  
  42. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  43. {
  44. if(dialogid == DIALOG_LOGIN)
  45. {
  46. if(response == 0)
  47. {
  48. SendClientMessage(playerid,COL_PLAVA,"Moras se ulogovati da bi mogao igrati na serveru!");
  49. Kick(playerid);
  50. }
  51. if(response == 1)
  52. {
  53. if(strlen(inputtext))
  54. {
  55. SendClientMessage(playerid,COL_ZELENA,"Pogresna sifra");
  56. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login :","Dobro dosli nazad, ukucajte svoju sifru da bi se ulogovao u svoj nalog !", "Uloguj se!" , "Odbij!");
  57. return 1;
  58. }
  59. else
  60. {
  61. Uloguj(playerid,inputtext);
  62. return 1;
  63. }
  64. }
  65. }
  66. if(dialogid == DIALOG_REGISTRACIJA)
  67. }
  68. if(response == 0)
  69. {
  70. SendClientMessage(playerid,COL_PLAVA,"Moras se registrovati da bi mogao igrati na serveru!");
  71. Kick(playerid);
  72. }
  73. if(response == 1)
  74. {
  75. if(!strlen(inputtext)
  76. {
  77. SendClientMessage(playerid,COL_ZELENA,"Pogresna sifra");
  78. ShowPlayerDialog(playerid,DIALOG_REGISTRACIJA,DIALOG_STYLE_INPUT,"Registracija :","Ukucaj sifru za svoj nalog!","Registruj se!","Odbij!");
  79. return 1;
  80. }
  81. else
  82. {
  83. Registruj(playerid,(inputtext);
  84. return 1;
  85. }
  86. }
  87.  
  88. stock Registruj(playerid,key[])
  89. {
  90. new File[64];
  91. new name[MAX_PLAYER_NAME];
  92. GetPlayerName(playerid,name,sizeof(name));
  93. format(File,sizeof(File),"/Nalozi/%.txt",name);
  94. dini_Create(File);
  95. dini_Set(File,"Sifra",key);
  96. SendClientMessage(playerid,PLAVA,"Uspesno si se registrovao");
  97. sini_InSet(File,"Skor",0);
  98. SetPVarInt(playerid,"Ulogovan",1);
  99. return 1;
  100. }
  101. stock Uloguj(playerid,key[])
  102. {
  103. new File[64];
  104. new name[MAX_PLAYER_NAME];
  105. GetPlayerName(playerid,name,sizeof(name));
  106. format(File,sizeof(File),"Nalozi/%s.txt",name);
  107. if(!strcmp(key,dini_Get(File,"Sifra"),false))
  108. {
  109. UcitajNalog(playerid);
  110. SendClientMessage(playerid),PLAVA,"Uspesno si se ulogovao!);
  111. return 1;
  112. }
  113. else
  114. {
  115. SendClientMessage(playerid,COL_ZELENA,"Pogresna sifra!);
  116. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login :","Dobro dosli nazad, ukucajte svoju sifru da bi se ulogovao u svoj nalog !", "Uloguj se!" , "Odbij!");
  117. return 1;
  118. }
  119. }
  120. stock UcitajNalog(playerid)
  121. {
  122. new File[64];
  123. new name[MAX_PLAYER_NAME];
  124. GetPlayerName(playerid,name,sizeof(name));
  125. format(File,sizeof(File),"Nalozi/%s.txt",name);
  126. SetPlayerScore(playerid),dini_Int(File,"Skor"));
  127. GivePlayerMoney(playerid,dini_Int(File,"Novac'));
  128. SetPVarInt(playerid,"ulogovan",1);
  129. return 1;
  130. }
  131. stock SnimiPodatke(playerid)
  132. {
  133. if(GetPVarInt(playerid,"ulogovan")== 1)
  134. {
  135. new File[64];
  136. new name[MAX_PLAYER_NAME];
  137. GetPlayerName(playerid,name,sizeof(name));
  138. format(File,sizeof(File),"Nalozi/%s.txt",name);
  139. dini_IntSet(File,"Skor",GetPlayerScore(playerid));
  140. dini_IntSet(File,"Novac",GetplayerMoney
  141. }
  142. return 1;
  143. }
  144. public OnPlayerDisconnect(playerid,reason)
  145. {
  146. if(GetPVarInt(playerid,"ulogovan")== 1)
  147. {
  148. SnimiPodatke(playerid);
  149. }
  150. return 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement