Guest User

Untitled

a guest
Jul 20th, 2013
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.98 KB | None | 0 0
  1. #include <a_samp>
  2. #include <YSI\y_ini>
  3.  
  4. #define dregister 1
  5. #define dlogin 2
  6. #define UserPath "Korisnici/%s.ini"
  7.  
  8. //Player's data
  9. enum PlayerInfo
  10. {
  11. Pass[129],
  12. Adminlevel,
  13. VIPlevel,
  14. Money,
  15. Scores,
  16. Kills,
  17. Deaths
  18. }
  19. new pInfo[MAX_PLAYERS][PlayerInfo];
  20.  
  21. forward LoadUser_data(playerid,name[],value[]);
  22. public LoadUser_data(playerid,name[],value[])
  23. {
  24. INI_String("Password", pInfo[playerid][Pass],129);
  25. INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);
  26. INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);
  27. INI_Int("Money",pInfo[playerid][Money]);
  28. INI_Int("Scores",pInfo[playerid][Scores]);
  29. INI_Int("Kills",pInfo[playerid][Kills]);
  30. INI_Int("Deaths",pInfo[playerid][Deaths]);
  31. return 1;
  32. }
  33.  
  34. stock Path(playerid)
  35. {
  36. new str[128],name[MAX_PLAYER_NAME];
  37. GetPlayerName(playerid,name,sizeof(name));
  38. format(str,sizeof(str),UserPath,name);
  39. return str;
  40. }
  41.  
  42. main()
  43. {
  44. print("\n----------------------------------");
  45. print(" United Balkan RPG/DM");
  46. print("----------------------------------\n");
  47. }
  48.  
  49.  
  50. public OnGameModeInit()
  51. {
  52. return 1;
  53. }
  54.  
  55. public OnGameModeExit()
  56. {
  57. return 1;
  58. }
  59.  
  60. public OnPlayerRequestClass(playerid, classid)
  61. {
  62. return 1;
  63. }
  64.  
  65. public OnPlayerConnect(playerid)
  66. {
  67. new name[MAX_PLAYER_NAME];
  68. GetPlayerName(playerid,name,sizeof(name));
  69. if(fexist(Path(playerid)))
  70. {
  71. INI_ParseFile(Path(playerid),"LoadUser_%s", .bExtra = true, .extra = playerid);
  72. ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Prijava","Dobrodosli natrag. Ovaj račun je registriran. \nUnesite svoju lozinku da bi se prijavili","Prijava","Izađi");
  73. }
  74. else
  75. {
  76. ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Registrirajte se","Dobro dosli! Ovaj racun nije registriran.\nUnesite svoju lozinku za izradbu novog racuna.","Registracija","Izađi");
  77. return 1;
  78. }
  79. return 1;
  80. }
  81.  
  82. public OnPlayerDisconnect(playerid, reason)
  83. {
  84. new INI:file = INI_Open(Path(playerid));
  85. INI_SetTag(file,"Player's Data");
  86. INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]);
  87. INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);
  88. INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
  89. INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
  90. INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
  91. INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
  92. INI_Close(file);
  93. return 1;
  94. }
  95.  
  96. public OnPlayerSpawn(playerid)
  97. {
  98. return 1;
  99. }
  100.  
  101. public OnPlayerDeath(playerid, killerid, reason)
  102. {
  103. pInfo[killerid][Kills]++;
  104. pInfo[playerid][Deaths]++;
  105. return 1;
  106. }
  107.  
  108. public OnVehicleSpawn(vehicleid)
  109. {
  110. return 1;
  111. }
  112.  
  113. public OnVehicleDeath(vehicleid, killerid)
  114. {
  115. return 1;
  116. }
  117.  
  118. public OnPlayerText(playerid, text[])
  119. {
  120. return 1;
  121. }
  122.  
  123. public OnPlayerCommandText(playerid, cmdtext[])
  124. {
  125. return 1;
  126. }
  127.  
  128. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  129. {
  130. return 1;
  131. }
  132.  
  133. public OnPlayerExitVehicle(playerid, vehicleid)
  134. {
  135. return 1;
  136. }
  137.  
  138. public OnPlayerStateChange(playerid, newstate, oldstate)
  139. {
  140. return 1;
  141. }
  142.  
  143. public OnPlayerEnterCheckpoint(playerid)
  144. {
  145. return 1;
  146. }
  147.  
  148. public OnPlayerLeaveCheckpoint(playerid)
  149. {
  150. return 1;
  151. }
  152.  
  153. public OnPlayerEnterRaceCheckpoint(playerid)
  154. {
  155. return 1;
  156. }
  157.  
  158. public OnPlayerLeaveRaceCheckpoint(playerid)
  159. {
  160. return 1;
  161. }
  162.  
  163. public OnRconCommand(cmd[])
  164. {
  165. return 1;
  166. }
  167.  
  168. public OnPlayerRequestSpawn(playerid)
  169. {
  170. return 1;
  171. }
  172.  
  173. public OnObjectMoved(objectid)
  174. {
  175. return 1;
  176. }
  177.  
  178. public OnPlayerObjectMoved(playerid, objectid)
  179. {
  180. return 1;
  181. }
  182.  
  183. public OnPlayerPickUpPickup(playerid, pickupid)
  184. {
  185. return 1;
  186. }
  187.  
  188. public OnVehicleMod(playerid, vehicleid, componentid)
  189. {
  190. return 1;
  191. }
  192.  
  193. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  194. {
  195. return 1;
  196. }
  197.  
  198. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  199. {
  200. return 1;
  201. }
  202.  
  203. public OnPlayerSelectedMenuRow(playerid, row)
  204. {
  205. return 1;
  206. }
  207.  
  208. public OnPlayerExitedMenu(playerid)
  209. {
  210. return 1;
  211. }
  212.  
  213. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  214. {
  215. return 1;
  216. }
  217.  
  218. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  219. {
  220. return 1;
  221. }
  222.  
  223. public OnRconLoginAttempt(ip[], password[], success)
  224. {
  225. return 1;
  226. }
  227.  
  228. public OnPlayerUpdate(playerid)
  229. {
  230. return 1;
  231. }
  232.  
  233. public OnPlayerStreamIn(playerid, forplayerid)
  234. {
  235. return 1;
  236. }
  237.  
  238. public OnPlayerStreamOut(playerid, forplayerid)
  239. {
  240. return 1;
  241. }
  242.  
  243. public OnVehicleStreamIn(vehicleid, forplayerid)
  244. {
  245. return 1;
  246. }
  247.  
  248. public OnVehicleStreamOut(vehicleid, forplayerid)
  249. {
  250. return 1;
  251. }
  252.  
  253. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  254. {
  255. if(dialogid == dregister)
  256. {
  257. if(!response) return Kick(playerid);
  258. if(response)
  259. {
  260. if(!strlen(inputtext))
  261. {// Unesite lozinku za registraciju
  262. ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Registrirajte se","Dobro dosli!! Ovaj racun nije registriran.\nUnesite svoju lozinku za izradbu novog racuna.\nMolimo unesite lozinku!","Registracija","Izadi");
  263. return 1;
  264. }
  265. //Ako ste unjeli tocnu lozinku...
  266. new hashpass[129];
  267. new INI:file = INI_Open(Path(playerid));
  268. INI_SetTag(file,"Player's Data");
  269. INI_WriteString(file,"Password",hashpass);
  270. INI_WriteInt(file,"AdminLevel",0);
  271. INI_WriteInt(file,"VIPLevel",0);
  272. INI_WriteInt(file,"Money",0);
  273. INI_WriteInt(file,"Scores",0);
  274. INI_WriteInt(file,"Kills",0);
  275. INI_WriteInt(file,"Deaths",0);
  276. INI_Close(file);
  277.  
  278. SetSpawnInfo(playerid, 0, 0, 1732.450, -1912.107, 13.170, 0, 0, 0, 0, 0, 0, 0);
  279. SpawnPlayer(playerid);
  280. SendClientMessage(playerid,-1,"Uspjesno ste se registrirali");
  281. return 1;
  282. }
  283. }
  284. if(dialogid == dlogin)
  285. {
  286. if(!response) return Kick(playerid); //Ako igrac pritisne na "Izadi".
  287. if(response) //Ako igrac pritisne na "Registracija"
  288. {
  289. new hashpass[129];
  290. if(!strcmp(hashpass,pInfo[playerid][Pass]))
  291. {
  292. INI_ParseFile(Path(playerid),"LoadUser_%s",.bExtra = true, .extra = playerid);
  293. SetPlayerScore(playerid,pInfo[playerid][Scores]);
  294. GivePlayerMoney(playerid,pInfo[playerid][Money]);
  295. SendClientMessage(playerid,-1,"Dobrodosao natrag! Uspješno ste prijavljeni");//Ako ste uspjesno prijavljeni.
  296. }
  297. else //Ako ste unijeli pogresnu lozinku
  298. {
  299. ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Prijava","Dobrodosao natrag. Ovaj racun je registriran. \nUnesite svoju lozinku da bi se prijavili.\nNetocna lozinka!","Prijava","Izađi");
  300. return 1;
  301. }
  302. }
  303. }
  304. return 1;
  305. }
  306. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  307. {
  308. return 1;
  309. }
Advertisement
Add Comment
Please, Sign In to add comment