Advertisement
Guest User

Loginregister--ZA DAJICA BRATA <3

a guest
Oct 10th, 2015
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.58 KB | None | 0 0
  1. #include <a_samp>
  2. #include <YSI\y_ini>
  3. public OnFilterScriptInit()
  4. {
  5. print("\n--------------------------------------");
  6. print(" ------------ Balkan Skyline RP -------");
  7. print("--------------------------------------\n");
  8. return 1;
  9. }
  10.  
  11. public OnGameModeInit()
  12. {
  13. SetGameModeText("BSRP by Dino");
  14. }
  15.  
  16. /***************************************************************************/
  17.  
  18.  
  19.  
  20. //=========================Login & Register system by Dino==============================
  21.  
  22.  
  23.  
  24.  
  25.  
  26. #define REGISTRACIJA 01
  27. #define LOGIN 02
  28. #define UserPath "Users/%s.ini"
  29. #define Password
  30. native WP_Hash(buffer[],len,const str[]);
  31. enum PlayerInfo
  32. {
  33. Lozinka[129],
  34. Adminlevel,
  35. VIPlevel,
  36. Novac,
  37. Level,
  38. Ubojstva,
  39. Poginuca,
  40. }
  41. new pInfo[MAX_PLAYERS][PlayerInfo];
  42.  
  43. stock Path(playerid)
  44. {
  45. new str[128],name[MAX_PLAYER_NAME];
  46. GetPlayerName(playerid,name,sizeof(name));
  47. format(str,sizeof(str),UserPath,name);
  48. return str;
  49. }
  50.  
  51. forward loadaccount_user(playerid, name[], value[]);
  52. public loadaccount_user(playerid, name[], value[])
  53. {
  54. INI_String("Password",pInfo[playerid][Password],[129]);
  55. INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);
  56. INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);
  57. INI_Int("Money",pInfo[playerid][Money]);
  58. INI_Int("Scores",pInfo[playerid][Scores]);
  59. INI_Int("Ubojstva",pInfo[playerid][Kills]);
  60. INI_Int("Poginuća",pInfo[playerid][Deaths]);
  61. return 1;
  62. }
  63.  
  64. #if defined FILTERSCRIPT
  65.  
  66. public OnFilterScriptInit()
  67. {
  68. print("\n--------------------------------------");
  69. print(" Login and Register system by Dino");
  70. print("--------------------------------------\n");
  71. return 1;
  72. }
  73.  
  74. public OnFilterScriptExit()
  75. {
  76. return 1;
  77. }
  78.  
  79. #endif
  80.  
  81. public OnPlayerRequestClass(playerid, classid)
  82. {
  83. SetPlayerPos(playerid, 816.47693, -1343.97681, 13.52600);
  84. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  85. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  86. return 1;
  87. }
  88.  
  89. public OnPlayerConnect(playerid)
  90. {
  91. new name[MAX_PLAYER_NAME];
  92. GetPlayerName(playerid,name,sizeof(name));
  93. if(fexist(Path(playerid)))
  94. {
  95. INI_ParseFile(Path(playerid),"loadaccount_user", .bExtra = true, .extra = playerid);
  96. ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Dobrodosli natrag. Vas account je registriran. \nUnesite lozinku kako bi ste se prijavili","Login","Izlaz");
  97. }
  98. else
  99. {
  100. ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Registracija","Dobrodosao/la! Ovaj account nije registriran.\nUpisite lozinku kako bi ste se registrirali.","Registracija","Izlaz");
  101. return 1;
  102. }
  103. return 1;
  104. }
  105.  
  106. public OnPlayerDisconnect(playerid, reason)
  107. {
  108.  
  109. if(fexist(Path(playerid)))
  110. {
  111. new INI:file = INI_Open(Path(playerid));
  112. INI_SetTag(file,"Player's Data");
  113. INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]);
  114. INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);/
  115. INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
  116. INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
  117. INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
  118. INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
  119. INI_Close(file);
  120. return 1;
  121. }
  122. return 1;
  123. }
  124.  
  125. public OnPlayerSpawn(playerid)
  126. {
  127. SetPlayerMoney(playerid, 10000);
  128. SetPlayerScore(playerid, 3);
  129.  
  130. return 1;
  131. }
  132.  
  133. public OnPlayerDeath(playerid, killerid, reason)
  134. {
  135. pInfo[killerid][Kills]++;
  136. pInfo[playerid][Deaths]++;
  137. return 1;
  138. }
  139.  
  140. public OnVehicleSpawn(vehicleid)
  141. {
  142. return 1;
  143. CreateObject
  144.  
  145.  
  146. }
  147.  
  148. public OnVehicleDeath(vehicleid, killerid)
  149. {
  150. return 1;
  151. }
  152.  
  153. public OnPlayerText(playerid, text[])
  154. {
  155. return 1;
  156. }
  157.  
  158. public OnPlayerCommandText(playerid, cmdtext[])
  159. {
  160. if (strcmp("/stats", cmdtext, true, 10) == 0)
  161. {
  162.  
  163. return 1;
  164. }
  165. return 0;
  166. }
  167.  
  168. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  169. {
  170. return 1;
  171. }
  172.  
  173. public OnPlayerExitVehicle(playerid, vehicleid)
  174. {
  175. return 1;
  176. }
  177.  
  178. public OnPlayerStateChange(playerid, newstate, oldstate)
  179. {
  180. return 1;
  181. }
  182.  
  183. public OnPlayerEnterCheckpoint(playerid)
  184. {
  185. return 1;
  186. }
  187.  
  188. public OnPlayerLeaveCheckpoint(playerid)
  189. {
  190. return 1;
  191. }
  192.  
  193. public OnPlayerEnterRaceCheckpoint(playerid)
  194. {
  195. return 1;
  196. }
  197.  
  198. public OnPlayerLeaveRaceCheckpoint(playerid)
  199. {
  200. return 1;
  201. }
  202.  
  203. public OnRconCommand(cmd[])
  204. {
  205. return 1;
  206. }
  207.  
  208. public OnPlayerRequestSpawn(playerid)
  209. {
  210. return 1;
  211. }
  212.  
  213. public OnObjectMoved(objectid)
  214. {
  215. return 1;
  216. }
  217.  
  218. public OnPlayerObjectMoved(playerid, objectid)
  219. {
  220. return 1;
  221. }
  222.  
  223. public OnPlayerPickUpPickup(playerid, pickupid)
  224. {
  225. return 1;
  226. }
  227.  
  228. public OnVehicleMod(playerid, vehicleid, componentid)
  229. {
  230. return 1;
  231. }
  232.  
  233. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  234. {
  235. return 1;
  236. }
  237.  
  238. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  239. {
  240. return 1;
  241. }
  242.  
  243. public OnPlayerSelectedMenuRow(playerid, row)
  244. {
  245. return 1;
  246. }
  247.  
  248. public OnPlayerExitedMenu(playerid)
  249. {
  250. return 1;
  251. }
  252.  
  253. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  254. {
  255. return 1;
  256. }
  257.  
  258. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  259. {
  260. return 1;
  261. }
  262.  
  263. public OnRconLoginAttempt(ip[], password[], success)
  264. {
  265. return 1;
  266. }
  267.  
  268. public OnPlayerUpdate(playerid)
  269. {
  270. return 1;
  271. }
  272.  
  273. public OnPlayerStreamIn(playerid, forplayerid)
  274. {
  275. return 1;
  276. }
  277.  
  278. public OnPlayerStreamOut(playerid, forplayerid)
  279. {
  280. return 1;
  281. }
  282.  
  283. public OnVehicleStreamIn(vehicleid, forplayerid)
  284. {
  285. return 1;
  286. }
  287.  
  288. public OnVehicleStreamOut(vehicleid, forplayerid)
  289. {
  290. return 1;
  291. }
  292.  
  293. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  294. {
  295. if(dialogid == dregister)
  296. {
  297. if(!response) return Kick(playerid);
  298. if(response)
  299. {
  300. if(!strlen(inputtext)) /
  301. {
  302. ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Registracija","Welcomet! Ovaj account nije registriran.\nUnesite lozinku za daljnju registraciju.\nMolimo unesite lozinku!","Registracija","Izlaz");
  303. return 1;
  304. }
  305.  
  306. new hashpass[129];
  307. WP_Hash(hashpass,sizeof(hashpass),inputtext);
  308. new INI:file = INI_Open(Path(playerid));
  309. INI_SetTag(file,"Player's Data");
  310. INI_WriteString(file,"Password",hashpass);
  311. INI_WriteInt(file,"AdminLevel",0);
  312. INI_WriteInt(file,"VIPLevel",0);
  313. INI_WriteInt(file,"Money",0);
  314. INI_WriteInt(file,"Scores",0);
  315. INI_WriteInt(file,"Kills",0);
  316. INI_WriteInt(file,"Deaths",0);
  317. INI_Close(file);
  318. SendClientMessage(playerid,-1,"Cestitamo,Uspjesno si se registrirao/la!");
  319. return 1;
  320. }
  321. }
  322. if(dialogid == dlogin)
  323. {
  324. if(!response) return Kick(playerid);
  325. if(response)
  326. {
  327. new hashpass[129];
  328. WP_Hash(hashpass,sizeof(hashpass),inputtext);
  329. if(!strcmp(hashpass,pInfo[playerid][Pass])) d
  330. {
  331. INI_ParseFile(Path(playerid),"loadaccount_user",.bExtra = true, .extra = playerid);
  332. SetPlayerScore(playerid,pInfo[playerid][Scores]);
  333. GivePlayerMoney(playerid,pInfo[playerid][Money]);
  334. SendClientMessage(playerid,-1,"Dobrodosao/la natrag! Uspjesno si se prijavio");
  335. else
  336. {
  337. ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Prijava","Dobrodosao/la natrag. Ovaj account je registriran!. \nUkucajte svoju lozinku kako bi se priijavili!.\nNetocna lozinka!!","Prijava","Izlaz");
  338. return 1;
  339. }
  340. }
  341. }
  342. return 1;
  343. }
  344.  
  345. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  346. {
  347. return 1;
  348. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement