Guest User

Untitled

a guest
Oct 17th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.65 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <dudb>
  4.  
  5. #pragma tabsize 0
  6.  
  7. #define COLOR_GREY 0xAFAFAFAA
  8. #define COLOR_GREEN 0x33AA33AA
  9. #define COLOR_BRIGHTRED 0xFF0000AA
  10. #define COLOR_YELLOW 0xFFFF00AA
  11. #define COLOR_PINK 0xFF66FFAA
  12. #define COLOR_BLUE 0x3A47DEFF
  13. #define COLOR_TAN 0xBDB76BAA
  14. #define COLOR_PURPLE 0x800080AA
  15. #define COLOR_WHITE 0xFFFFFFAA
  16. #define COLOR_LIGHTBLUE 0x33CCFFAA
  17. #define COLOR_ORANGE 0xFF9900AA
  18. #define COLOR_INDIGO 0x4B00B0AA
  19. #define COLOR_BLACK 0x00000000
  20. #define COLOR_DARKGREY 0x696969FF
  21.  
  22. enum playerinfo
  23. {
  24. AdminLevel,
  25. Money,
  26. Score
  27. };
  28.  
  29. new pInfo[MAX_PLAYERS][playerinfo];
  30. new gPlayerLogged[MAX_PLAYERS];
  31.  
  32. #if defined FILTERSCRIPT
  33.  
  34. public OnFilterScriptInit()
  35. {
  36. print("\n--------------------------------------");
  37. print(" Blank Filterscript by your name here");
  38. print("--------------------------------------\n");
  39. return 1;
  40. }
  41.  
  42. public OnFilterScriptExit()
  43. {
  44. return 1;
  45. }
  46.  
  47. #else
  48.  
  49. main()
  50. {
  51. print("\n----------------------------------");
  52. print(" Blank Gamemode by your name here");
  53. print("----------------------------------\n");
  54. }
  55.  
  56. #endif
  57.  
  58. public OnGameModeInit()
  59. {
  60. // Don't use these lines if it's a filterscript
  61. SetGameModeText("Blank Script");
  62. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  63. return 1;
  64. }
  65.  
  66. public OnGameModeExit()
  67. {
  68. return 1;
  69. }
  70.  
  71. public OnPlayerRequestClass(playerid, classid)
  72. {
  73. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  74. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  75. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  76. return 1;
  77. }
  78.  
  79. public OnPlayerConnect(playerid)
  80. {
  81. new n[24],file[128];
  82. GetPlayerName(playerid,n,24);
  83. format(file, 128, "CopsAndRobbers/Users/%s.ini",n);
  84. if(dini_Exists(file))
  85. {
  86. ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"CopsAndRobbers Login Dialog","Please put your pass in below","Login","Leave");
  87. }
  88. else
  89. {
  90. ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"CopsAndRobbers Register Dialog","Please put your registration pass in below","Register","Leave");
  91. }
  92. return 1;
  93. }
  94.  
  95. public OnPlayerDisconnect(playerid, reason)
  96. {
  97. if(gPlayerLogged[playerid] == 1)
  98. {
  99. new n[24],file[128];
  100. GetPlayerName(playerid,n,24);
  101. format(file,128,"CopsAndRobbers/Users/%s.ini",n);
  102. dini_IntSet(file,"AdminLevel",pInfo[playerid][AdminLevel]);
  103. dini_IntSet(file,"Money",GetPlayerMoney(playerid));
  104. dini_IntSet(file,"Score",pInfo[playerid][Score]);
  105. }
  106. return 1;
  107. }
  108.  
  109.  
  110. public OnPlayerDeath(playerid, killerid, reason)
  111. {
  112. return 1;
  113. }
  114.  
  115. public OnVehicleSpawn(vehicleid)
  116. {
  117. return 1;
  118. }
  119.  
  120. public OnVehicleDeath(vehicleid, killerid)
  121. {
  122. return 1;
  123. }
  124.  
  125. public OnPlayerText(playerid, text[])
  126. {
  127. return 1;
  128. }
  129.  
  130. public OnPlayerCommandText(playerid, cmdtext[])
  131. {
  132. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  133. {
  134. // Do something here
  135. return 1;
  136. }
  137. return 0;
  138. }
  139.  
  140. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  141. {
  142. return 1;
  143. }
  144.  
  145. public OnPlayerExitVehicle(playerid, vehicleid)
  146. {
  147. return 1;
  148. }
  149.  
  150. public OnPlayerStateChange(playerid, newstate, oldstate)
  151. {
  152. return 1;
  153. }
  154.  
  155. public OnPlayerEnterCheckpoint(playerid)
  156. {
  157. return 1;
  158. }
  159.  
  160. public OnPlayerLeaveCheckpoint(playerid)
  161. {
  162. return 1;
  163. }
  164.  
  165. public OnPlayerEnterRaceCheckpoint(playerid)
  166. {
  167. return 1;
  168. }
  169.  
  170. public OnPlayerLeaveRaceCheckpoint(playerid)
  171. {
  172. return 1;
  173. }
  174.  
  175. public OnRconCommand(cmd[])
  176. {
  177. return 1;
  178. }
  179.  
  180. public OnPlayerRequestSpawn(playerid)
  181. {
  182. return 1;
  183. }
  184.  
  185. public OnObjectMoved(objectid)
  186. {
  187. return 1;
  188. }
  189.  
  190. public OnPlayerObjectMoved(playerid, objectid)
  191. {
  192. return 1;
  193. }
  194.  
  195. public OnPlayerPickUpPickup(playerid, pickupid)
  196. {
  197. return 1;
  198. }
  199.  
  200. public OnVehicleMod(playerid, vehicleid, componentid)
  201. {
  202. return 1;
  203. }
  204.  
  205. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  206. {
  207. return 1;
  208. }
  209.  
  210. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  211. {
  212. return 1;
  213. }
  214.  
  215. public OnPlayerSelectedMenuRow(playerid, row)
  216. {
  217. return 1;
  218. }
  219.  
  220. public OnPlayerExitedMenu(playerid)
  221. {
  222. return 1;
  223. }
  224.  
  225. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  226. {
  227. return 1;
  228. }
  229.  
  230. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  231. {
  232. return 1;
  233. }
  234.  
  235. public OnRconLoginAttempt(ip[], password[], success)
  236. {
  237. return 1;
  238. }
  239.  
  240. public OnPlayerUpdate(playerid)
  241. {
  242. return 1;
  243. }
  244.  
  245. public OnPlayerStreamIn(playerid, forplayerid)
  246. {
  247. return 1;
  248. }
  249.  
  250. public OnPlayerStreamOut(playerid, forplayerid)
  251. {
  252. return 1;
  253. }
  254.  
  255. public OnVehicleStreamIn(vehicleid, forplayerid)
  256. {
  257. return 1;
  258. }
  259.  
  260. public OnVehicleStreamOut(vehicleid, forplayerid)
  261. {
  262. return 1;
  263. }
  264.  
  265. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  266. {
  267. if(dialogid == 2)
  268. {
  269. new name[MAX_PLAYER_NAME], file[256], string[128];
  270. GetPlayerName(playerid, name, sizeof(name));
  271. format(file, 128, "CopsAndRobbers/Users/%s.ini",name);
  272. if(!response) return Kick(playerid);
  273. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi, your not register", "Welcome, your not register, register to continue", "Register", "Leave");
  274. dini_Create(file);
  275. dini_IntSet(file, "Password", udb_hash(inputtext));
  276. dini_IntSet(file, "AdminLevel",pInfo[playerid][AdminLevel] = 0);
  277. dini_IntSet(file, "Money",pInfo[playerid][Money] = 0);
  278. dini_IntSet(file, "Score",pInfo[playerid][Score] = 0);
  279. format(string, 128, "[SYSTEM]: You succesfully registered the username %s with password %s, you have been auto logged in.", name, inputtext);
  280. SendClientMessage(playerid, COLOR_YELLOW, string);
  281. gPlayerLogged[playerid] = 1;
  282. }
  283. if(dialogid == 1)
  284. {
  285. new name[MAX_PLAYER_NAME], file[256];
  286. GetPlayerName(playerid, name, sizeof(name));
  287. format(file, sizeof(file), "CopsAndRobbers/Users/%s.ini", name);
  288. if(!response) return Kick(playerid);
  289. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi, you are registerd", "Login to load your stats", "Login", "Leave");
  290. new tmp;
  291. tmp = dini_Int(file, "Password");
  292. if(udb_hash(inputtext) != tmp)
  293. {
  294. SendClientMessage(playerid, COLOR_BRIGHTRED, "WRONG PASSWORD, PLEASE TRY AGAIN.");
  295. ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi, your register", "Login to load your stats", "Login", "Leave");
  296. }
  297. else
  298. {
  299. gPlayerLogged[playerid] = 1;
  300. pInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
  301. pInfo[playerid][Score] = dini_Int(file, "Score");
  302. SetPlayerScore(playerid, pInfo[playerid][Score]);
  303. GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
  304. SendClientMessage(playerid, COLOR_GREEN, "You Successfully logged in!");
  305. }
  306. }
  307. return 1;
  308. }
Add Comment
Please, Sign In to add comment