Advertisement
Guest User

Untitled

a guest
Feb 8th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.09 KB | None | 0 0
  1.  
  2. #include <a_samp>
  3. #include <YSI\y_ini>
  4.  
  5. #define DIALOG_REGISTER
  6. #define DIALOG_LOGIN 2
  7.  
  8. #define COLOR_GREY 0xAFAFAFAA
  9. #define COLOR_GREEN 0x33AA33AA
  10. #define COLOR_RED 0xAA3333AA
  11. #define COLOR_YELLOW 0xFFFF00AA
  12. #define COLOR_WHITE 0xFFFFFFAA
  13. #define COLOR_BLUE 0x0000BBAA
  14. #define COLOR_LIGHTBLUE 0x33CCFFAA
  15. #define COLOR_ORANGE 0xFF9900AA
  16. #define COLOR_RED 0xAA3333AA
  17. #define COLOR_LIME 0x10F441AA
  18. #define COLOR_MAGENTA 0xFF00FFFF
  19. #define COLOR_NAVY 0x000080AA
  20. #define COLOR_AQUA 0xF0F8FFAA
  21. #define COLOR_CRIMSON 0xDC143CAA
  22. #define COLOR_FLBLUE 0x6495EDAA
  23. #define COLOR_BISQUE 0xFFE4C4AA
  24. #define COLOR_BLACK 0x000000AA
  25. #define COLOR_CHARTREUSE 0x7FFF00AA
  26. #define COLOR_BROWN 0XA52A2AAA
  27. #define COLOR_CORAL 0xFF7F50AA
  28. #define COLOR_GOLD 0xB8860BAA
  29. #define COLOR_GREENYELLOW 0xADFF2FAA
  30. #define COLOR_INDIGO 0x4B00B0AA
  31. #define COLOR_IVORY 0xFFFF82AA
  32. #define COLOR_LAWNGREEN 0x7CFC00AA
  33. #define COLOR_SEAGREEN 0x20B2AAAA
  34.  
  35. #define PATH "/Korisnici/%s.ini"
  36. #pragama tablist 0
  37.  
  38. enum pInfo
  39. (
  40. pPass,
  41. pCash,
  42. pAdmin,
  43. pScore,
  44. pBankmoney,
  45. pBanned
  46. )
  47. new PlayerInfo[MAX_PLAYERS][pInfo];
  48. forward LoadUser_data(plaxerid,name[],value[]);
  49. public LoadUser_data(playerid,name[],value[])
  50. (
  51. INI_Int("Password",PlayerInfo[playerid][pPass]);
  52. INI_Int("Cash",PlayerInfo[playerid][pCash]);
  53. INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
  54. INI_Int("Score",PlayerInfo[playerid][pScore]);
  55. INI_Int("Bankmoney",PlayerInfo[playerid][pBankmoney]);
  56. INI_Int("Banned",Player nfo[playerid][pBanned]);
  57. return 1;
  58. )
  59. stock UserPath(playerid)
  60. (
  61. new string[128],playername[MAX_PLAYER_NAME];
  62. GetPlayerName(playerid,playername,sizeof(playername));
  63. format(strig,sizeof(string),PATH,playername);
  64. return string;
  65. )
  66. stock udb_hash(buf[])
  67. {
  68. new length=strlen(buf);
  69. new s1 = 1;
  70. new s2 = 0;
  71. new n;
  72. for (n=0; n<length; n++)
  73. {
  74. s1 = (s1 + buf[n]) % 65521;
  75. s2 = (s2 + s1) % 65521;
  76. }
  77. return (s2 << 16) + s1;
  78. }
  79. main()
  80. {
  81. print("\n----------------------------------");
  82. print(" Blank Gamemode by your name here");
  83. print("----------------------------------\n");
  84. }
  85.  
  86. #endif
  87.  
  88. public OnGameModeInit()
  89. {
  90. // Don't use these lines if it's a filterscript
  91. SetGameModeText("Blank Script");
  92. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  93. return 1;
  94. }
  95.  
  96. public OnGameModeExit()
  97. {
  98. return 1;
  99. }
  100.  
  101. public OnPlayerRequestClass(playerid, classid)
  102. {
  103. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  104. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  105. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  106. return 1;
  107. }
  108.  
  109. public OnPlayerConnect(playerid)
  110. {
  111. if(fexist(UserPath(playerid)))
  112. (
  113. INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra = true,.extra = playerid);
  114. ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STAYLE_INPUT,"Login:","Please enter your password to log in your account!","Login","Quit");
  115. )
  116. else
  117. (
  118. ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register:","Please register new account,type your password!","Register","Quit");
  119. )
  120.  
  121. return 1;
  122. }
  123.  
  124. public OnPlayerDisconnect(playerid, reason)
  125. {
  126. new INI:File = INI_Open(UserPath(playerid));
  127. INI_SetTag(File,"data");
  128. INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
  129. INI_writeInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
  130. INI_writeInt(File,"Score",GetPlayerScore(playerid));
  131. INI_writeInt(File,"Bankmoney",PlayerInfo[playerid][pBankmoney]);
  132. INI_writeInt(File,"Banned",PlayerInfo[playerid][pBanned]);
  133. INI_Close(File);
  134. return 1;
  135. }
  136.  
  137. public OnPlayerSpawn(playerid)
  138. {
  139. return 1;
  140. }
  141.  
  142. public OnPlayerDeath(playerid, killerid, reason)
  143. {
  144. return 1;
  145. }
  146.  
  147. public OnVehicleSpawn(vehicleid)
  148. {
  149. return 1;
  150. }
  151.  
  152. public OnVehicleDeath(vehicleid, killerid)
  153. {
  154. return 1;
  155. }
  156.  
  157. public OnPlayerText(playerid, text[])
  158. {
  159. return 1;
  160. }
  161.  
  162. public OnPlayerCommandText(playerid, cmdtext[])
  163. {
  164. if (strcmp("/KRA", cmdtext, true, 10) == 0)
  165. {
  166. // Do something here
  167. return 1;
  168. }
  169. return 0;
  170. }
  171.  
  172. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  173. {
  174. return 1;
  175. }
  176.  
  177. public OnPlayerExitVehicle(playerid, vehicleid)
  178. {
  179. return 1;
  180. }
  181.  
  182. public OnPlayerStateChange(playerid, newstate, oldstate)
  183. {
  184. return 1;
  185. }
  186.  
  187. public OnPlayerEnterCheckpoint(playerid)
  188. {
  189. return 1;
  190. }
  191.  
  192. public OnPlayerLeaveCheckpoint(playerid)
  193. {
  194. return 1;
  195. }
  196.  
  197. public OnPlayerEnterRaceCheckpoint(playerid)
  198. {
  199. return 1;
  200. }
  201.  
  202. public OnPlayerLeaveRaceCheckpoint(playerid)
  203. {
  204. return 1;
  205. }
  206.  
  207. public OnRconCommand(cmd[])
  208. {
  209. return 1;
  210. }
  211.  
  212. public OnPlayerRequestSpawn(playerid)
  213. {
  214. return 1;
  215. }
  216.  
  217. public OnObjectMoved(objectid)
  218. {
  219. return 1;
  220. }
  221.  
  222. public OnPlayerObjectMoved(playerid, objectid)
  223. {
  224. return 1;
  225. }
  226.  
  227. public OnPlayerPickUpPickup(playerid, pickupid)
  228. {
  229. return 1;
  230. }
  231.  
  232. public OnVehicleMod(playerid, vehicleid, componentid)
  233. {
  234. return 1;
  235. }
  236.  
  237. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  238. {
  239. return 1;
  240. }
  241.  
  242. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  243. {
  244. return 1;
  245. }
  246.  
  247. public OnPlayerSelectedMenuRow(playerid, row)
  248. {
  249. return 1;
  250. }
  251.  
  252. public OnPlayerExitedMenu(playerid)
  253. {
  254. return 1;
  255. }
  256.  
  257. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  258. {
  259. return 1;
  260. }
  261.  
  262. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  263. {
  264. return 1;
  265. }
  266.  
  267. public OnRconLoginAttempt(ip[], password[], success)
  268. {
  269. return 1;
  270. }
  271.  
  272. public OnPlayerUpdate(playerid)
  273. {
  274. return 1;
  275. }
  276.  
  277. public OnPlayerStreamIn(playerid, forplayerid)
  278. {
  279. return 1;
  280. }
  281.  
  282. public OnPlayerStreamOut(playerid, forplayerid)
  283. {
  284. return 1;
  285. }
  286.  
  287. public OnVehicleStreamIn(vehicleid, forplayerid)
  288. {
  289. return 1;
  290. }
  291.  
  292. public OnVehicleStreamOut(vehicleid, forplayerid)
  293. {
  294. return 1;
  295. }
  296.  
  297. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  298. {
  299. switch(dialogid)
  300. (
  301. case DIALOG_REGISTER:
  302. (
  303. if(!response) return Kick(playerid);
  304. if(response)
  305. (
  306. if(!strlen(inputttext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER_STYLE_INPUT,"Register","Password invalid,type new password!","Register","Quit)
  307. new INI:File = INI_Open(UserPath(playerid));
  308. INI_SetTag(File,"data");
  309. INI_WriteInt(File,"Password",udb_hash(inputtext));
  310. INI_WriteInt(File,"Cash",0);
  311. INI_WriteInt(File,"Admin",0);
  312. INI_WriteInt(File,"Score",0);
  313. INI_WriteInt(File,"Bankmoney,0);
  314. INI_WriteInt(File,"Banned",0);
  315. INI_Close(File);
  316. )
  317. )
  318. case DIALOG_LOGIN:
  319. (
  320. if(!response) return Kick(playerid);
  321. if(response)
  322. (
  323. if(udb_hash(inputtext) == PlayerInfo(playerid)[pPass])
  324. (
  325. INI_ParseFile(UserPath(playerid),"LoadUser_%s,.bExtra = true,.extra = playerid):
  326. GivePlayerMoney(playerid,PlayerInfo[playerid][pCash];
  327. SetPlayerScore(playerid),PlayerInfo[playerid][pScore];
  328. SendClientMessage(playerid,-1,"You soccesfuly logged in your account!");
  329. )
  330. else
  331. (
  332. ShowPlayerDialog(playerid,DIALOG_LOGIN_STYLE_INPUT,"Login:","Password incorrect,try again","Login!","Quit");
  333. )
  334. )
  335. )
  336. )
  337.  
  338. return 1:
  339.  
  340.  
  341.  
  342. }
  343.  
  344.  
  345.  
  346. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  347. {
  348. return 1;
  349. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement