Guest User

Untitled

a guest
Feb 14th, 2012
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.21 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4. //INCLUDED
  5. #include <a_samp>
  6. #include <streamer>
  7. #include <SII>
  8. #include <zcmd>
  9. #include <dutils>
  10. #include <Dini>
  11.  
  12. //Defined
  13. #define COLOR_YELLOW 0xFFFF00FF
  14.  
  15. //Pragma
  16. #pragma unused ret_memcpy
  17.  
  18. //Variables
  19. new players = 0;
  20.  
  21. #if defined FILTERSCRIPT
  22.  
  23.  
  24. enum pInfo
  25. {
  26. pw,
  27. AdminLevel,
  28. cash,
  29. level
  30. }
  31. new PlayerInfo[ MAX_PLAYERS ][ pInfo ];
  32.  
  33. public OnFilterScriptInit()
  34. {
  35. print("\n--------------------------------------");
  36. print(" Blank Filterscript by your name here");
  37. print("--------------------------------------\n");
  38. return 1;
  39. }
  40.  
  41. public OnFilterScriptExit()
  42. {
  43. return 1;
  44. }
  45.  
  46. #else
  47.  
  48. main()
  49. {
  50. print("\n----------------------------------");
  51. print(" Blank Gamemode by your name here");
  52. print("----------------------------------\n");
  53. }
  54.  
  55. #endif
  56.  
  57. public OnGameModeInit()
  58. {
  59. // Don't use these lines if it's a filterscript
  60. SetGameModeText("C:RP 0.0.1");
  61. AddPlayerClass(299,2412.2659,90.9850,26.4721,90.9184,0,0,0,0,0,0); // Country
  62. return 1;
  63. }
  64.  
  65. public OnGameModeExit()
  66. {
  67. return 1;
  68. }
  69.  
  70. public OnPlayerRequestClass(playerid, classid)
  71. {
  72. SetPlayerPos(playerid, 2412.2659, 90.9850, 26.4721);
  73. SetPlayerCameraPos(playerid, 2412.2659, 90.9850, 26.4721);
  74. SetPlayerCameraLookAt(playerid, 2412.2659, 90.9850, 26.4721);
  75. return 1;
  76. }
  77.  
  78. public OnPlayerConnect(playerid)
  79. {
  80. SendClientMessage(playerid, COLOR_YELLOW, "Welcome to Country Roleplay version 0.0.1");
  81. new name[MAX_PLAYER_NAME], file[128];
  82. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  83. format(file, sizeof(file), ".../Users/%s.ini", name);
  84. if(!fexist(file)) {
  85. SendClientMessage(playerid, COLOR_YELLOW, "You are not registered, please register");
  86. ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Please Register", "Enter Your Password Below", "Register", "Cancel");
  87. }
  88. else {
  89. new str[128];
  90. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  91. format(str, sizeof(str), "Welcome Back ~r~%s. Enjoy!", name);
  92. SendClientMessage(playerid, COLOR_YELLOW, str);
  93. ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Please Login", "Enter Your Password Below", "Login", "Cancel");
  94. }
  95. return 1;
  96. }
  97.  
  98. public OnPlayerDisconnect(playerid, reason)
  99. {
  100. new file[128], name[MAX_PLAYER_NAME];
  101. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  102. format(file, sizeof(file), ".../Users/%s.ini", name);
  103. if(dini_Exists(file)) {
  104. dini_IntSet(file, "pw", PlayerInfo[playerid][pw]);
  105. dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][AdminLevel]);
  106. dini_IntSet(file, "cash", PlayerInfo[playerid][cash]);
  107. dini_IntSet(file, "level", PlayerInfo[playerid][level]);
  108. }
  109. return 1;
  110. }
  111.  
  112. public OnPlayerSpawn(playerid)
  113. {
  114. SetPlayerPos(playerid, 2412.2659,90.9850,26.4721);
  115. return 1;
  116. }
  117.  
  118. public OnPlayerDeath(playerid, killerid, reason)
  119. {
  120. return 1;
  121. }
  122.  
  123. public OnVehicleSpawn(vehicleid)
  124. {
  125. return 1;
  126. }
  127.  
  128. public OnVehicleDeath(vehicleid, killerid)
  129. {
  130. return 1;
  131. }
  132.  
  133. public OnPlayerText(playerid, text[])
  134. {
  135. return 1;
  136. }
  137.  
  138. public OnPlayerCommandText(playerid, cmdtext[])
  139. {
  140. return 1;
  141. }
  142.  
  143. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  144. {
  145. return 1;
  146. }
  147.  
  148. public OnPlayerExitVehicle(playerid, vehicleid)
  149. {
  150. return 1;
  151. }
  152.  
  153. public OnPlayerStateChange(playerid, newstate, oldstate)
  154. {
  155. return 1;
  156. }
  157.  
  158. public OnPlayerEnterCheckpoint(playerid)
  159. {
  160. return 1;
  161. }
  162.  
  163. public OnPlayerLeaveCheckpoint(playerid)
  164. {
  165. return 1;
  166. }
  167.  
  168. public OnPlayerEnterRaceCheckpoint(playerid)
  169. {
  170. return 1;
  171. }
  172.  
  173. public OnPlayerLeaveRaceCheckpoint(playerid)
  174. {
  175. return 1;
  176. }
  177.  
  178. public OnRconCommand(cmd[])
  179. {
  180. return 1;
  181. }
  182.  
  183. public OnPlayerRequestSpawn(playerid)
  184. {
  185. return 1;
  186. }
  187.  
  188. public OnObjectMoved(objectid)
  189. {
  190. return 1;
  191. }
  192.  
  193. public OnPlayerObjectMoved(playerid, objectid)
  194. {
  195. return 1;
  196. }
  197.  
  198. public OnPlayerPickUpPickup(playerid, pickupid)
  199. {
  200. return 1;
  201. }
  202.  
  203. public OnVehicleMod(playerid, vehicleid, componentid)
  204. {
  205. return 1;
  206. }
  207.  
  208. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  209. {
  210. return 1;
  211. }
  212.  
  213. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  214. {
  215. return 1;
  216. }
  217.  
  218. public OnPlayerSelectedMenuRow(playerid, row)
  219. {
  220. return 1;
  221. }
  222.  
  223. public OnPlayerExitedMenu(playerid)
  224. {
  225. return 1;
  226. }
  227.  
  228. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  229. {
  230. return 1;
  231. }
  232.  
  233. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  234. {
  235. return 1;
  236. }
  237.  
  238. public OnRconLoginAttempt(ip[], password[], success)
  239. {
  240. return 1;
  241. }
  242.  
  243. public OnPlayerUpdate(playerid)
  244. {
  245. return 1;
  246. }
  247.  
  248. public OnPlayerStreamIn(playerid, forplayerid)
  249. {
  250. return 1;
  251. }
  252.  
  253. public OnPlayerStreamOut(playerid, forplayerid)
  254. {
  255. return 1;
  256. }
  257.  
  258. public OnVehicleStreamIn(vehicleid, forplayerid)
  259. {
  260. return 1;
  261. }
  262.  
  263. public OnVehicleStreamOut(vehicleid, forplayerid)
  264. {
  265. return 1;
  266. }
  267.  
  268. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  269. {
  270. if(dialogid == 1) {
  271. new file[128], name[MAX_PLAYER_NAME], str[128];
  272. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  273. format(file, sizeof(file), ".../Users/%s.ini", name);
  274. if(response) {
  275. if(strlen(inputtext)) {
  276. dini_Create(file);
  277. dini_IntSet(file, "pw", num_hash(inputtext));
  278. dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][AdminLevel]);
  279. dini_IntSet(file, "cash", PlayerInfo[playerid][cash]);
  280. dini_IntSet(file, "level", PlayerInfo[playerid][level]);
  281. format(str, sizeof(str), "You are registered as ~r~%s. Your password is ~r~%s. /changepass to change it", name, inputtext);
  282. SendClientMessage(playerid, COLOR_SYSTEM, str);
  283. PlayerInfo[playerid][level] = dini_Int(file, "level");
  284. PlayerInfo[playerid][cash] = dini_Int(file, "cash");
  285. PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
  286. }
  287. }
  288. else {
  289. Kick(playerid);
  290. }
  291. }
  292. if(dialogid == 2) {
  293. new file[128], name[MAX_PLAYER_NAME], str[128];
  294. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  295. format(str, sizeof(str), ".../Users/%s.ini", name);
  296. if(response) {
  297. if(strlen(inputtext)) {
  298. if(num_hash(inputtext) != dini_Int(file, "pw")) {
  299. SendClientMessage(playerid, COLOR_SYSTEM, "Wrong Password");
  300. ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Please Login", "Enter Your Password Below", "Login", "Cancel");
  301. }
  302. else {
  303. SendClientMessage(playerid, COLOR_SYSTEM, "Succesfuly logged in");
  304. PlayerInfo[playerid][level] = dini_Int(file, "level");
  305. PlayerInfo[playerid][cash] = dini_Int(file, "cash");
  306. GivePlayerMoney(playerid, dini_Int(file, "cash"));
  307. PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
  308. }
  309. }
  310. }
  311. else {
  312. Kick(playerid);
  313. }
  314. }
  315. return 1;
  316. }
  317.  
  318. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  319. {
  320. return 1;
  321. }
Advertisement
Add Comment
Please, Sign In to add comment