Advertisement
Guest User

TheDM_GM

a guest
Nov 21st, 2011
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.04 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.  
  5. #include <a_samp>
  6. #include <core>
  7. #include <float>
  8. #include <time>
  9. #include <file>
  10. #include <streamer>
  11. #include <morphinc>
  12. #include <a_npc>
  13. #include <Dini>
  14. #include <ipcheck>
  15. #include <sscanf>
  16. #include <YSI\y_ini>
  17. #include <YSI\y_commands>
  18. #include <YSI\y_groups>
  19.  
  20.  
  21. //KeyStateChange defines
  22. #define RELEASED(%0) \
  23. (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
  24.  
  25. //Login & Register defines
  26. #define DIALOG_REGISTER 1
  27. #define DIALOG_LOGIN 2
  28. #define DIALOG_SUCCESS_1 3
  29. #define DIALOG_SUCCESS_2 4
  30.  
  31. #define PATH "/Users/%s.ini"
  32.  
  33. //Admin defines
  34. #define MAX_ADMIN_LEVELS (4)
  35.  
  36. //Login & Register color defines
  37. #define COL_WHITE "{FFFFFF}"
  38. #define COL_RED "{F81414}"
  39. #define COL_GREEN "{00FF22}"
  40. #define COL_LIGHTBLUE "{00CED1}"
  41.  
  42. // System Defined Colors
  43. #define COLOR_ACTIVEBORDER 0xB4B4B4FF
  44. #define COLOR_ACTIVECAPTION 0x99B4D1FF
  45. #define COLOR_ACTIVECAPTIONTEXT 0x000000FF
  46. #define COLOR_ALICEBLUE 0xF0F8FFFF
  47. #define COLOR_ANTIQUEWHITE 0xFAEBD7FF
  48. #define COLOR_APPWORKSPACE 0xABABABFF
  49. #define COLOR_AQUA 0x00FFFFFF
  50. #define COLOR_AQUAMARINE 0x7FFFD4FF
  51. #define COLOR_AZURE 0xF0FFFFFF
  52. #define COLOR_BEIGE 0xF5F5DCFF
  53. #define COLOR_BISQUE 0xFFE4C4FF
  54. #define COLOR_BLACK 0x000000FF
  55. #define COLOR_BLANCHEDALMOND 0xFFEBCDFF
  56. #define COLOR_BLUE 0x0000FFFF
  57. #define COLOR_BLUEVIOLET 0x8A2BE2FF
  58. #define COLOR_BROWN 0xA52A2AFF
  59. #define COLOR_BURLYWOOD 0xDEB887FF
  60. #define COLOR_BUTTONFACE 0xF0F0F0FF
  61. #define COLOR_BUTTONHIGHLIGHT 0xFFFFFFFF
  62. #define COLOR_BUTTONSHADOW 0xA0A0A0FF
  63. #define COLOR_CADETBLUE 0x5F9EA0FF
  64. #define COLOR_CHARTREUSE 0x7FFF00FF
  65. #define COLOR_CHOCOLATE 0xD2691EFF
  66. #define COLOR_CONTROL 0xF0F0F0FF
  67. #define COLOR_CONTROLDARK 0xA0A0A0FF
  68. #define COLOR_CONTROLDARKDARK 0x696969FF
  69. #define COLOR_CONTROLLIGHT 0xE3E3E3FF
  70. #define COLOR_CONTROLLIGHTLIGHT 0xFFFFFFFF
  71. #define COLOR_CONTROLTEXT 0x000000FF
  72. #define COLOR_CORAL 0xFF7F50FF
  73. #define COLOR_CORNFLOWERBLUE 0x6495EDFF
  74. #define COLOR_CORNSILK 0xFFF8DCFF
  75. #define COLOR_CRIMSON 0xDC143CFF
  76. #define COLOR_CYAN 0x00FFFFFF
  77. #define COLOR_DARKBLUE 0x00008BFF
  78. #define COLOR_DARKCYAN 0x008B8BFF
  79. #define COLOR_DARKGOLDENROD 0xB8860BFF
  80. #define COLOR_DARKGRAY 0xA9A9A9FF
  81. #define COLOR_DARKGREEN 0x006400FF
  82. #define COLOR_DARKKHAKI 0xBDB76BFF
  83. #define COLOR_DARKMAGENTA 0x8B008BFF
  84. #define COLOR_DARKOLIVEGREEN 0x556B2FFF
  85. #define COLOR_DARKORANGE 0xFF8C00FF
  86. #define COLOR_DARKORCHID 0x9932CCFF
  87. #define COLOR_DARKRED 0x8B0000FF
  88. #define COLOR_DARKSALMON 0xE9967AFF
  89. #define COLOR_DARKSEAGREEN 0x8FBC8BFF
  90. #define COLOR_DARKSLATEBLUE 0x483D8BFF
  91. #define COLOR_DARKSLATEGRAY 0x2F4F4FFF
  92. #define COLOR_DARKTURQUOISE 0x00CED1FF
  93. #define COLOR_DARKVIOLET 0x9400D3FF
  94. #define COLOR_DEEPPINK 0xFF1493FF
  95. #define COLOR_DEEPSKYBLUE 0x00BFFFFF
  96. #define COLOR_DESKTOP 0x000000FF
  97. #define COLOR_DIMGRAY 0x696969FF
  98. #define COLOR_DODGERBLUE 0x1E90FFFF
  99. #define COLOR_FIREBRICK 0xB22222FF
  100. #define COLOR_FLORALWHITE 0xFFFAF0FF
  101. #define COLOR_FORESTGREEN 0x228B22FF
  102. #define COLOR_FUCHSIA 0xFF00FFFF
  103. #define COLOR_GAINSBORO 0xDCDCDCFF
  104. #define COLOR_GHOSTWHITE 0xF8F8FFFF
  105. #define COLOR_GOLD 0xFFD700FF
  106. #define COLOR_GOLDENROD 0xDAA520FF
  107. #define COLOR_GRADIENTACTIVECAPTION 0xB9D1EAFF
  108. #define COLOR_GRADIENTINACTIVECAPTION 0xD7E4F2FF
  109. #define COLOR_GRAY 0x808080FF
  110. #define COLOR_GRAYTEXT 0x808080FF
  111. #define COLOR_GREEN 0x008000FF
  112. #define COLOR_GREENYELLOW 0xADFF2FFF
  113. #define COLOR_HIGHLIGHT 0x3399FFFF
  114. #define COLOR_HIGHLIGHTTEXT 0xFFFFFFFF
  115. #define COLOR_HONEYDEW 0xF0FFF0FF
  116. #define COLOR_HOTPINK 0xFF69B4FF
  117. #define COLOR_HOTTRACK 0x0066CCFF
  118. #define COLOR_INACTIVEBORDER 0xF4F7FCFF
  119. #define COLOR_INACTIVECAPTION 0xBFCDDBFF
  120. #define COLOR_INACTIVECAPTIONTEXT 0x434E54FF
  121. #define COLOR_INDIANRED 0xCD5C5CFF
  122. #define COLOR_INDIGO 0x4B0082FF
  123. #define COLOR_INFO 0xFFFFE1FF
  124. #define COLOR_INFOTEXT 0x000000FF
  125. #define COLOR_IVORY 0xFFFFF0FF
  126. #define COLOR_KHAKI 0xF0E68CFF
  127. #define COLOR_LAVENDER 0xE6E6FAFF
  128. #define COLOR_LAVENDERBLUSH 0xFFF0F5FF
  129. #define COLOR_LAWNGREEN 0x7CFC00FF
  130. #define COLOR_LEMONCHIFFON 0xFFFACDFF
  131. #define COLOR_LIGHTBLUE 0xADD8E6FF
  132. #define COLOR_LIGHTCORAL 0xF08080FF
  133. #define COLOR_LIGHTCYAN 0xE0FFFFFF
  134. #define COLOR_LIGHTGOLDENRODYELLOW 0xFAFAD2FF
  135. #define COLOR_LIGHTGRAY 0xD3D3D3FF
  136. #define COLOR_LIGHTGREEN 0x90EE90FF
  137. #define COLOR_LIGHTPINK 0xFFB6C1FF
  138. #define COLOR_LIGHTSALMON 0xFFA07AFF
  139. #define COLOR_LIGHTSEAGREEN 0x20B2AAFF
  140. #define COLOR_LIGHTSKYBLUE 0x87CEFAFF
  141. #define COLOR_LIGHTSLATEGRAY 0x778899FF
  142. #define COLOR_LIGHTSTEELBLUE 0xB0C4DEFF
  143. #define COLOR_LIGHTYELLOW 0xFFFFE0FF
  144. #define COLOR_LIME 0x00FF00FF
  145. #define COLOR_LIMEGREEN 0x32CD32FF
  146. #define COLOR_LINEN 0xFAF0E6FF
  147. #define COLOR_MAGENTA 0xFF00FFFF
  148. #define COLOR_MAROON 0x800000FF
  149. #define COLOR_MEDIUMAQUAMARINE 0x66CDAAFF
  150. #define COLOR_MEDIUMBLUE 0x0000CDFF
  151. #define COLOR_MEDIUMORCHID 0xBA55D3FF
  152. #define COLOR_MEDIUMPURPLE 0x9370DBFF
  153. #define COLOR_MEDIUMSEAGREEN 0x3CB371FF
  154. #define COLOR_MEDIUMSLATEBLUE 0x7B68EEFF
  155. #define COLOR_MEDIUMSPRINGGREEN 0x00FA9AFF
  156. #define COLOR_MEDIUMTURQUOISE 0x48D1CCFF
  157. #define COLOR_MEDIUMVIOLETRED 0xC71585FF
  158. #define COLOR_MENU 0xF0F0F0FF
  159. #define COLOR_MENUBAR 0xF0F0F0FF
  160. #define COLOR_MENUHIGHLIGHT 0x3399FFFF
  161. #define COLOR_MENUTEXT 0x000000FF
  162. #define COLOR_MIDNIGHTBLUE 0x191970FF
  163. #define COLOR_MINTCREAM 0xF5FFFAFF
  164. #define COLOR_MISTYROSE 0xFFE4E1FF
  165. #define COLOR_MOCCASIN 0xFFE4B5FF
  166. #define COLOR_NAVAJOWHITE 0xFFDEADFF
  167. #define COLOR_NAVY 0x000080FF
  168. #define COLOR_OLDLACE 0xFDF5E6FF
  169. #define COLOR_OLIVE 0x808000FF
  170. #define COLOR_OLIVEDRAB 0x6B8E23FF
  171. #define COLOR_ORANGE 0xFFA500FF
  172. #define COLOR_ORANGERED 0xFF4500FF
  173. #define COLOR_ORCHID 0xDA70D6FF
  174. #define COLOR_PALEGOLDENROD 0xEEE8AAFF
  175. #define COLOR_PALEGREEN 0x98FB98FF
  176. #define COLOR_PALETURQUOISE 0xAFEEEEFF
  177. #define COLOR_PALEVIOLETRED 0xDB7093FF
  178. #define COLOR_PAPAYAWHIP 0xFFEFD5FF
  179. #define COLOR_PEACHPUFF 0xFFDAB9FF
  180. #define COLOR_PERU 0xCD853FFF
  181. #define COLOR_PINK 0xFFC0CBFF
  182. #define COLOR_PLUM 0xDDA0DDFF
  183. #define COLOR_POWDERBLUE 0xB0E0E6FF
  184. #define COLOR_PURPLE 0x800080FF
  185. #define COLOR_RED 0xFF0000FF
  186. #define COLOR_ROSYBROWN 0xBC8F8FFF
  187. #define COLOR_ROYALBLUE 0x4169E1FF
  188. #define COLOR_SADDLEBROWN 0x8B4513FF
  189. #define COLOR_SALMON 0xFA8072FF
  190. #define COLOR_SANDYBROWN 0xF4A460FF
  191. #define COLOR_SCROLLBAR 0xC8C8C8FF
  192. #define COLOR_SEAGREEN 0x2E8B57FF
  193. #define COLOR_SEASHELL 0xFFF5EEFF
  194. #define COLOR_SIENNA 0xA0522DFF
  195. #define COLOR_SILVER 0xC0C0C0FF
  196. #define COLOR_SKYBLUE 0x87CEEBFF
  197. #define COLOR_SLATEBLUE 0x6A5ACDFF
  198. #define COLOR_SLATEGRAY 0x708090FF
  199. #define COLOR_SNOW 0xFFFAFAFF
  200. #define COLOR_SPRINGGREEN 0x00FF7FFF
  201. #define COLOR_STEELBLUE 0x4682B4FF
  202. #define COLOR_TAN 0xD2B48CFF
  203. #define COLOR_TEAL 0x008080FF
  204. #define COLOR_THISTLE 0xD8BFD8FF
  205. #define COLOR_TOMATO 0xFF6347FF
  206. #define COLOR_TRANSPARENT 0xFFFFFF00
  207. #define COLOR_TURQUOISE 0x40E0D0FF
  208. #define COLOR_VIOLET 0xEE82EEFF
  209. #define COLOR_WHEAT 0xF5DEB3FF
  210. #define COLOR_WHITE 0xFFFFFFFF
  211. #define COLOR_WHITESMOKE 0xF5F5F5FF
  212. #define COLOR_WINDOW 0xFFFFFFFF
  213. #define COLOR_WINDOWFRAME 0x646464FF
  214. #define COLOR_WINDOWTEXT 0x000000FF
  215. #define COLOR_YELLOW 0xFFFF00FF
  216. #define COLOR_YELLOWGREEN 0x9ACD32FF
  217. #define STEALTH_ORANGE 0xFF880000
  218. #define STEALTH_OLIVE 0x66660000
  219. #define STEALTH_GREEN 0x33DD1100
  220. #define STEALTH_PINK 0xFF22EE00
  221. #define STEALTH_BLUE 0x0077BB00
  222.  
  223. new GotProposedBy[MAX_PLAYERS];
  224. new police;
  225. new ballas;
  226. new grove;
  227. new mafia;
  228. new Group:gAdmins[MAX_ADMIN_LEVELS];
  229.  
  230. enum pData
  231. {
  232. AdminLevel,
  233. Pass,
  234. Cash,
  235. Kills,
  236. Deaths
  237. };
  238. new PlayerData[MAX_PLAYERS][pData];
  239.  
  240. stock UserPath(playerid)
  241. {
  242. new string[128],playername[MAX_PLAYER_NAME];
  243. GetPlayerName(playerid,playername,sizeof(playername));
  244. format(string,sizeof(string),PATH,playername);
  245. return string;
  246. }
  247.  
  248. strtok(const string[], &index)
  249. {
  250. new length = strlen(string);
  251. while ((index < length) && (string[index] <= ' '))
  252. {
  253. index++;
  254. }
  255.  
  256. new offset = index;
  257. new result[20];
  258. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  259. {
  260. result[index - offset] = string[index];
  261. index++;
  262. }
  263. result[index - offset] = EOS;
  264. return result;
  265. }
  266.  
  267. YCMD:kick(playerid, params[], help)
  268. {
  269. if (help)
  270. {
  271. return SendClientMessage(playerid, 0xFF0000AA, "Kicks another player.");
  272. }
  273. else
  274. {
  275. new
  276. pid,
  277. reason[32];
  278. if (sscanf(params, "uS[32]", pid, reason))
  279. {
  280. return SendClientMessage(playerid, 0xFF0000AA, "Parameters: <playerid/name> [reason]");
  281. }
  282. if (reason[0])
  283. {
  284. SendClientMessage(pid, 0xFF0000AA, "You have been kicked. Reason:");
  285. SendClientMessage(pid, 0xFF0000AA, reason);
  286. }
  287. else
  288. {
  289. SendClientMessage(pid, 0xFF0000AA, "You have been kicked.");
  290. }
  291. Kick(pid);
  292. }
  293. return 1;
  294. }
  295.  
  296. YCMD:ban(playerid, params[], help)
  297. {
  298. if (help)
  299. {
  300. return SendClientMessage(playerid, 0xFF0000AA, "Bans another player.");
  301. }
  302. else
  303. {
  304. new
  305. pid,
  306. reason[32];
  307. if (sscanf(params, "uS[32]", pid, reason))
  308. {
  309. return SendClientMessage(playerid, 0xFF0000AA, "Parameters: <playerid/name> [reason]");
  310. }
  311. if (reason[0])
  312. {
  313. SendClientMessage(pid, 0xFF0000AA, "You have been banned. Reason:");
  314. SendClientMessage(pid, 0xFF0000AA, reason);
  315. }
  316. else
  317. {
  318. SendClientMessage(pid, 0xFF0000AA, "You have been banned.");
  319. }
  320. Ban(pid);
  321. }
  322. return 1;
  323. }
  324.  
  325. YCMD:pm(playerid, params[], help)
  326. {
  327. if (help)
  328. {
  329. return SendClientMessage(playerid, 0xFF0000AA, "Sends a private message to another player.");
  330. }
  331. else
  332. {
  333. new
  334. pid,
  335. message[32];
  336. if (sscanf(params, "us[32]", pid, message))
  337. {
  338. return SendClientMessage(playerid, 0xFF0000AA, "Parameters: <playerid/name> <message>");
  339. }
  340. SendClientMessage(pid, 0xFF0000AA, "Incoming message:");
  341. SendClientMessage(pid, 0xFF0000AA, message);
  342. SendClientMessage(playerid, 0xFF0000AA, "Sent!");
  343. }
  344. return 1;
  345. }
  346.  
  347. forward LoadUser_data(playerid,name[],value[]);
  348. public LoadUser_data(playerid,name[],value[])
  349. {
  350. INI_Int("Password",PlayerData[playerid][Pass]);
  351. INI_Int("Cash",PlayerData[playerid][Cash]);
  352. INI_Int("Admin",PlayerData[playerid][AdminLevel]);
  353. INI_Int("Kills",PlayerData[playerid][Kills]);
  354. INI_Int("Deaths",PlayerData[playerid][Deaths]);
  355. return 1;
  356. }
  357.  
  358. stock udb_hash(buf[]) {
  359. new length=strlen(buf);
  360. new s1 = 1;
  361. new s2 = 0;
  362. new n;
  363. for (n=0; n<length; n++)
  364. {
  365. s1 = (s1 + buf[n]) % 65521;
  366. s2 = (s2 + s1) % 65521;
  367. }
  368. return (s2 << 16) + s1;
  369. }
  370.  
  371. public OnGameModeInit()
  372. {
  373. // Don't use these lines if it's a filterscript
  374. SetGameModeText("TheDM v1.0");
  375. //Police forces
  376. police = AddPlayerClass(280,1542.6294,-1675.2057,13.5549,84.1688,0,0,0,0,0,0); // police.1
  377. police = AddPlayerClass(281,1542.6294,-1675.2057,13.5549,84.1688,0,0,0,0,0,0); // police.2
  378. police = AddPlayerClass(282,1542.6294,-1675.2057,13.5549,84.1688,0,0,0,0,0,0); // police.3
  379. police = AddPlayerClass(283,1542.6294,-1675.2057,13.5549,84.1688,0,0,0,0,0,0); // police.4
  380. police = AddPlayerClass(284,1542.6294,-1675.2057,13.5549,84.1688,0,0,0,0,0,0); // police.5
  381. police = AddPlayerClass(285,1542.6294,-1675.2057,13.5549,84.1688,0,0,0,0,0,0); // police.6
  382. police = AddPlayerClass(286,1542.6294,-1675.2057,13.5549,84.1688,0,0,0,0,0,0); // police.7
  383. police = AddPlayerClass(287,1542.6294,-1675.2057,13.5549,84.1688,0,0,0,0,0,0); // police.8
  384. police = AddPlayerClass(288,1542.6294,-1675.2057,13.5549,84.1688,0,0,0,0,0,0); // police.9
  385. //Ballas Gang
  386. ballas = AddPlayerClass(102,2008.2842,-1733.1367,13.5469,87.0397,0,0,0,0,0,0); // ballas.1
  387. ballas = AddPlayerClass(103,2008.2842,-1733.1367,13.5469,87.0397,0,0,0,0,0,0); // ballas.2
  388. ballas = AddPlayerClass(104,2008.2842,-1733.1367,13.5469,87.0397,0,0,0,0,0,0); // ballas.3
  389. //Grove gang
  390. grove = AddPlayerClass(105,2495.0957,-1682.1321,13.3388,0.9898,0,0,0,0,0,0); // grove.1
  391. grove = AddPlayerClass(106,2495.0957,-1682.1321,13.3388,0.9898,0,0,0,0,0,0); // grove.2
  392. grove = AddPlayerClass(107,2495.0957,-1682.1321,13.3388,0.9898,0,0,0,0,0,0); // grove.3
  393. //Russian Mafia
  394. mafia = AddPlayerClass(111,1110.0437,-1796.7803,16.5938,86.2630,0,0,0,0,0,0); // mafia.1
  395. mafia = AddPlayerClass(112,1110.0437,-1796.7803,16.5938,86.2630,0,0,0,0,0,0); // mafia.2
  396. mafia = AddPlayerClass(113,1110.0437,-1796.7803,16.5938,86.2630,0,0,0,0,0,0); // mafia.3
  397. //Vehicles
  398. AddStaticVehicle(411,1535.7905,-1666.9576,13.1099,0.7674,112,1); // carpos
  399. //-----------------------------------------------------------------------------------------------------
  400. new name[16];
  401. for (new i = 0; i != MAX_ADMIN_LEVELS; ++i)
  402. {
  403. format(name, sizeof (name), "Admin Level %d+", i + 1);
  404. gAdmins[i] = Group_Create(name);
  405. }
  406. // "/kick" is a level 1 admin command.
  407. SetAdminCommand("kick", 1);
  408. // "/ban" is a level 2 admin command.
  409. SetAdminCommand("ban", 2);
  410. // "/pm" is not an admin command (not required as it's the default).
  411. SetAdminCommand("pm", 0);
  412. return 1;
  413. }
  414.  
  415. SetAdminCommand(command[], level)
  416. {
  417. // Get the ID of the command (required):
  418. new
  419. id = Command_GetID(command);
  420. if (level)
  421. {
  422. // To be used only by admins.
  423. // First let no normal people use it.
  424. Group_SetGlobalCommand(id, false);
  425. // Then loop through admin levels and set it true on the ones it can be
  426. // used by and false on the others.
  427. new
  428. cl = 0;
  429. while (cl != MAX_ADMIN_LEVELS)
  430. {
  431. new
  432. Group:group = gAdmins[cl];
  433. ++cl;
  434. if (cl == level)
  435. {
  436. // Set this level as using the command.
  437. Group_SetCommand(group, id, true);
  438. }
  439. else
  440. {
  441. // Set this level as not using this command.
  442. Group_SetCommand(group, id, false);
  443. }
  444. }
  445. }
  446. else
  447. {
  448. // To be used by everyone, so let everyone use it.
  449. Group_SetGlobalCommand(id, true);
  450. }
  451. }
  452.  
  453. public OnGameModeExit()
  454. {
  455. return 1;
  456. }
  457.  
  458. public OnPlayerRequestClass(playerid, classid)
  459. {
  460. if(GetPlayerSkin(playerid) == police)
  461. {
  462. SetPlayerPos(playerid, 1542.6294,-1675.2057,13.5549);
  463. SetPlayerCameraPos(playerid, 1542.6294,-1675.2057,13.5549);
  464. SetPlayerCameraLookAt(playerid, 1542.6294,-1675.2057,13.5549);
  465. SetPlayerFacingAngle(playerid, 84.1688);
  466. GameTextForPlayer(playerid, "~b~Police Force", 2000, 4);
  467. GivePlayerMoney(playerid, 10000);
  468. }
  469. if(GetPlayerSkin(playerid) == ballas)
  470. {
  471. SetPlayerPos(playerid, 2008.2842,-1733.1367,13.5469);
  472. SetPlayerCameraPos(playerid, 2008.2842,-1733.1367,13.5469);
  473. SetPlayerCameraLookAt(playerid, 2008.2842,-1733.1367,13.5469);
  474. SetPlayerFacingAngle(playerid, 87.0397);
  475. GameTextForPlayer(playerid, "~p~Ballas Gang", 2000, 4);
  476. GivePlayerMoney(playerid, 10000);
  477. }
  478. if(GetPlayerSkin(playerid) == grove)
  479. {
  480. SetPlayerPos(playerid, 2495.0957,-1682.1321,13.3388);
  481. SetPlayerCameraPos(playerid, 2495.0957,-1682.1321,13.3388);
  482. SetPlayerCameraLookAt(playerid, 2495.0957,-1682.1321,13.3388);
  483. SetPlayerFacingAngle(playerid, 0.9898);
  484. GameTextForPlayer(playerid, "~g~Grove Gang", 2000, 4);
  485. GivePlayerMoney(playerid, 10000);
  486. }
  487. if(GetPlayerSkin(playerid) == mafia)
  488. {
  489. SetPlayerPos(playerid, 1110.0437,-1796.7803,16.5938);
  490. SetPlayerCameraPos(playerid, 1110.0437,-1796.7803,16.5938);
  491. SetPlayerCameraLookAt(playerid, 1110.0437,-1796.7803,16.5938);
  492. SetPlayerFacingAngle(playerid, 86.2630);
  493. GameTextForPlayer(playerid, "~r~Russian Mafia", 2000, 4);
  494. GivePlayerMoney(playerid, 10000);
  495. }
  496. return 1;
  497. }
  498.  
  499. public OnPlayerConnect(playerid)
  500. {
  501. //
  502. GotProposedBy[playerid] = 999;
  503. //
  504. if(fexist(UserPath(playerid)))
  505. {
  506. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  507. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
  508. }
  509. else
  510. {
  511. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Register",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
  512. }
  513. if (IsPlayerAdmin(playerid))
  514. {
  515. // Add the player to the second admin level. Default is not a member.
  516. Group_SetPlayer(gAdmins[2], playerid, true);
  517. // "false" is used to remove a player.
  518. }
  519. return 1;
  520. }
  521.  
  522. public OnPlayerDisconnect(playerid, reason)
  523. {
  524. new INI:File = INI_Open(UserPath(playerid));
  525. INI_SetTag(File,"data");
  526. INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
  527. INI_WriteInt(File,"Admin",PlayerData[playerid][AdminLevel]);
  528. INI_WriteInt(File,"Kills",PlayerData[playerid][Kills]);
  529. INI_WriteInt(File,"Deaths",PlayerData[playerid][Deaths]);
  530. INI_Close(File);
  531. return 1;
  532. }
  533.  
  534. public OnPlayerSpawn(playerid)
  535. {
  536. if(GetPlayerSkin(playerid) == police)
  537. {
  538. SetPlayerPos(playerid, 1542.6294,-1675.2057,13.5549);
  539. SetPlayerCameraPos(playerid, 1542.6294,-1675.2057,13.5549);
  540. SetPlayerCameraLookAt(playerid, 1542.6294,-1675.2057,13.5549);
  541. SetPlayerFacingAngle(playerid, 84.1688);
  542. GameTextForPlayer(playerid, "~b~Police Force", 2000, 4);
  543. GivePlayerMoney(playerid, 10000);
  544. SetPlayerColor(playerid, COLOR_BLUE);
  545. }
  546. if(GetPlayerSkin(playerid) == ballas)
  547. {
  548. SetPlayerPos(playerid, 2008.2842,-1733.1367,13.5469);
  549. SetPlayerCameraPos(playerid, 2008.2842,-1733.1367,13.5469);
  550. SetPlayerCameraLookAt(playerid, 2008.2842,-1733.1367,13.5469);
  551. SetPlayerFacingAngle(playerid, 87.0397);
  552. GameTextForPlayer(playerid, "~p~Ballas Gang", 2000, 4);
  553. GivePlayerMoney(playerid, 10000);
  554. SetPlayerColor(playerid, COLOR_PURPLE);
  555. }
  556. if(GetPlayerSkin(playerid) == grove)
  557. {
  558. SetPlayerPos(playerid, 2495.0957,-1682.1321,13.3388);
  559. SetPlayerCameraPos(playerid, 2495.0957,-1682.1321,13.3388);
  560. SetPlayerCameraLookAt(playerid, 2495.0957,-1682.1321,13.3388);
  561. SetPlayerFacingAngle(playerid, 0.9898);
  562. GameTextForPlayer(playerid, "~g~Grove Gang", 2000, 4);
  563. GivePlayerMoney(playerid, 10000);
  564. SetPlayerColor(playerid, COLOR_GREEN);
  565. }
  566. if(GetPlayerSkin(playerid) == mafia)
  567. {
  568. SetPlayerPos(playerid, 1110.0437,-1796.7803,16.5938);
  569. SetPlayerCameraPos(playerid, 1110.0437,-1796.7803,16.5938);
  570. SetPlayerCameraLookAt(playerid, 1110.0437,-1796.7803,16.5938);
  571. SetPlayerFacingAngle(playerid, 86.2630);
  572. GameTextForPlayer(playerid, "~r~Russian Mafia", 2000, 4);
  573. GivePlayerMoney(playerid, 10000);
  574. SetPlayerColor(playerid, COLOR_RED);
  575. }
  576. return 1;
  577. }
  578.  
  579. public OnPlayerDeath(playerid, killerid, reason)
  580. {
  581. PlayerData[killerid][Kills]++;
  582. PlayerData[playerid][Deaths]++;
  583. GivePlayerMoney(killerid, 2000);
  584. SendClientMessage(killerid, COLOR_YELLOW, "You killed a player and earned $2000.");
  585. GivePlayerMoney(playerid, -1000);
  586. SendClientMessage(playerid, COLOR_YELLOW, "You died and lost $1000.");
  587. return 1;
  588. }
  589.  
  590. public OnVehicleSpawn(vehicleid)
  591. {
  592. return 1;
  593. }
  594.  
  595. public OnVehicleDeath(vehicleid, killerid)
  596. {
  597. return 1;
  598. }
  599.  
  600. public OnPlayerText(playerid, text[])
  601. {
  602. new gplayer[MAX_PLAYER_NAME];
  603. new sendername[MAX_PLAYER_NAME];
  604. new string[156];
  605. if(IsIp(text))
  606. {
  607. GetPlayerName(playerid, sendername, sizeof(sendername));
  608. GetPlayerName(GotProposedBy[playerid], gplayer, sizeof(gplayer));
  609. SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have been kicked for attempting to advertise.");
  610. format(string, sizeof(string), "%s has been kicked by Anticheat for attempt of advertise.", sendername);
  611. SendClientMessageToAll(COLOR_RED, string);
  612. Kick(playerid);
  613. return 0;
  614. }
  615. return 1;
  616. }
  617.  
  618. public OnPlayerCommandText(playerid, cmdtext[])
  619. {
  620. if (strcmp("/help", cmdtext, true, 10) == 0)
  621. {
  622. SendClientMessage(playerid, COLOR_GREEN, "___________[CMDS]__________");
  623. SendClientMessage(playerid, COLOR_LIGHTBLUE, "[CMD]: /admins /status /shop /kill");
  624. SendClientMessage(playerid, COLOR_LIGHTBLUE, "[CMD]: More coming.");
  625. return 1;
  626. }
  627. if (strcmp("/kill", cmdtext, true, 10) == 0)
  628. {
  629. SetPlayerHealth(playerid, 0);
  630. return 1;
  631. }
  632. if (strcmp("/status", cmdtext, true, 10) == 0)
  633. {
  634. new kills = PlayerData[playerid][Kills];
  635. new deaths = PlayerData[playerid][Deaths];
  636. new string[156];
  637. format(string, sizeof(string), "Kills: %d Deaths: %d",kills,deaths);
  638. SendClientMessage(playerid, COLOR_GREEN, string);
  639. return 1;
  640. }
  641. if (strcmp("/shop", cmdtext, true, 10) == 0)
  642. {
  643. SendClientMessage(playerid, COLOR_GREEN, "_______Weapon Names_______");
  644. SendClientMessage(playerid, COLOR_GREEN, "M4 - 200 bullets - $8000");
  645. SendClientMessage(playerid, COLOR_GREEN, "MP5 - 200 bullets - $5000");
  646. SendClientMessage(playerid, COLOR_GREEN, "Combat shotgun - 200 bullets - $10000");
  647. SendClientMessage(playerid, COLOR_GREEN, "Regular shotgun - 200 bullets - $5000");
  648. SendClientMessage(playerid, COLOR_GREEN, "Desert eagle - 200 bullets - $8000");
  649. SendClientMessage(playerid, COLOR_GREEN, "TEC-9 - 500 bullets - $11000");
  650. SendClientMessage(playerid, COLOR_GREEN, "Sniper rifle - 100 bullets - $8000");
  651. SendClientMessage(playerid, COLOR_GREEN, "AK-47 - 200 bullets - $8000");
  652. SendClientMessage(playerid, COLOR_GREEN, "If you want to buy one of those weapons type /buy [weaponname]");
  653. return 1;
  654. }
  655. if (strcmp("/buy", cmdtext, true, 10) == 0)
  656. {
  657. new idx;
  658. idx = 184;
  659. new x_nr[64];
  660. x_nr = strtok(cmdtext, idx);
  661. if(!strlen(x_nr))
  662. {
  663. SendClientMessage(playerid, COLOR_LIGHTCYAN, "HINT: /buy [name]");
  664. SendClientMessage(playerid, COLOR_CYAN, "Available names: M4, MP5, Combat shotgun, Regular shotgun, Desert eagle, TEC-9, Sniper rifle, AK-47");
  665. return 1;
  666. }
  667. if(strcmp(x_nr, "M4", true) == 0)
  668. {
  669. if(GetPlayerMoney(playerid) == 8000)
  670. {
  671. GivePlayerWeapon(playerid, 31, 200);
  672. GivePlayerMoney(playerid, -8000);
  673. return 1;
  674. }
  675. else
  676. {
  677. SendClientMessage(playerid, COLOR_LIGHTCYAN, "Not enough money to buy this weapon.");
  678. }
  679. }
  680. else if(strcmp(x_nr, "MP5", true) == 0)
  681. {
  682. if(GetPlayerMoney(playerid) == 5000)
  683. {
  684. GivePlayerWeapon(playerid, 29, 200);
  685. GivePlayerMoney(playerid, -5000);
  686. return 1;
  687. }
  688. else
  689. {
  690. SendClientMessage(playerid, COLOR_LIGHTCYAN, "Not enough money to buy this weapon.");
  691. }
  692. }
  693. else if(strcmp(x_nr, "Combat shotgun", true) == 0)
  694. {
  695. if(GetPlayerMoney(playerid) == 10000)
  696. {
  697. GivePlayerWeapon(playerid, 27, 200);
  698. GivePlayerMoney(playerid, -10000);
  699. return 1;
  700. }
  701. else
  702. {
  703. SendClientMessage(playerid, COLOR_LIGHTCYAN, "Not enough money to buy this weapon.");
  704. }
  705. }
  706. else if(strcmp(x_nr, "Regular shotgun", true) == 0)
  707. {
  708. if(GetPlayerMoney(playerid) == 5000)
  709. {
  710. GivePlayerWeapon(playerid, 25, 200);
  711. GivePlayerMoney(playerid, -5000);
  712. return 1;
  713. }
  714. else
  715. {
  716. SendClientMessage(playerid, COLOR_LIGHTCYAN, "Not enough money to buy this weapon.");
  717. }
  718. }
  719. else if(strcmp(x_nr, "Desert eagle", true) == 0)
  720. {
  721. if(GetPlayerMoney(playerid) == 8000)
  722. {
  723. GivePlayerWeapon(playerid, 31, 200);
  724. GivePlayerMoney(playerid, -8000);
  725. return 1;
  726. }
  727. else
  728. {
  729. SendClientMessage(playerid, COLOR_LIGHTCYAN, "Not enough money to buy this weapon.");
  730. }
  731. }
  732. else if(strcmp(x_nr, "TEC-9", true) == 0)
  733. {
  734. if(GetPlayerMoney(playerid) == 11000)
  735. {
  736. GivePlayerWeapon(playerid, 32, 500);
  737. GivePlayerMoney(playerid, -11000);
  738. return 1;
  739. }
  740. else
  741. {
  742. SendClientMessage(playerid, COLOR_LIGHTCYAN, "Not enough money to buy this weapon.");
  743. }
  744. }
  745. else if(strcmp(x_nr, "Sniper rifle", true) == 0)
  746. {
  747. if(GetPlayerMoney(playerid) == 8000)
  748. {
  749. GivePlayerWeapon(playerid, 34, 100);
  750. GivePlayerMoney(playerid, -8000);
  751. return 1;
  752. }
  753. else
  754. {
  755. SendClientMessage(playerid, COLOR_LIGHTCYAN, "Not enough money to buy this weapon.");
  756. }
  757. }
  758. else if(strcmp(x_nr, "AK-47", true) == 0)
  759. {
  760. if(GetPlayerMoney(playerid) == 8000)
  761. {
  762. GivePlayerWeapon(playerid, 30, 200);
  763. GivePlayerMoney(playerid, -8000);
  764. return 1;
  765. }
  766. else
  767. {
  768. SendClientMessage(playerid, COLOR_LIGHTCYAN, "Not enough money to buy this weapon.");
  769. }
  770. }
  771. }
  772. return 0;
  773. }
  774.  
  775. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  776. {
  777. return 1;
  778. }
  779.  
  780. public OnPlayerExitVehicle(playerid, vehicleid)
  781. {
  782. return 1;
  783. }
  784.  
  785. public OnPlayerStateChange(playerid, newstate, oldstate)
  786. {
  787. return 1;
  788. }
  789.  
  790. public OnPlayerEnterCheckpoint(playerid)
  791. {
  792. return 1;
  793. }
  794.  
  795. public OnPlayerLeaveCheckpoint(playerid)
  796. {
  797. return 1;
  798. }
  799.  
  800. public OnPlayerEnterRaceCheckpoint(playerid)
  801. {
  802. return 1;
  803. }
  804.  
  805. public OnPlayerLeaveRaceCheckpoint(playerid)
  806. {
  807. return 1;
  808. }
  809.  
  810. public OnRconCommand(cmd[])
  811. {
  812. return 1;
  813. }
  814.  
  815. public OnPlayerRequestSpawn(playerid)
  816. {
  817. return 1;
  818. }
  819.  
  820. public OnObjectMoved(objectid)
  821. {
  822. return 1;
  823. }
  824.  
  825. public OnPlayerObjectMoved(playerid, objectid)
  826. {
  827. return 1;
  828. }
  829.  
  830. public OnPlayerPickUpPickup(playerid, pickupid)
  831. {
  832. return 1;
  833. }
  834.  
  835. public OnVehicleMod(playerid, vehicleid, componentid)
  836. {
  837. return 1;
  838. }
  839.  
  840. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  841. {
  842. return 1;
  843. }
  844.  
  845. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  846. {
  847. return 1;
  848. }
  849.  
  850. public OnPlayerSelectedMenuRow(playerid, row)
  851. {
  852. return 1;
  853. }
  854.  
  855. public OnPlayerExitedMenu(playerid)
  856. {
  857. return 1;
  858. }
  859.  
  860. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  861. {
  862. return 1;
  863. }
  864.  
  865. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  866. {
  867. new sendername[MAX_PLAYER_NAME];
  868. new string[156];
  869. if ( RELEASED(KEY_CROUCH) )
  870. {
  871. Kick(playerid);
  872. format(string, sizeof(string), "%s has been kicked by Anticheat for C-bug attempt", sendername);
  873. SendClientMessageToAll(COLOR_RED, string);
  874. SendClientMessage(playerid, COLOR_LIGHTCYAN, "You have been kicked by Anticheat for C-bug attempt.");
  875. }
  876. return 1;
  877. }
  878.  
  879. public OnRconLoginAttempt(ip[], password[], success)
  880. {
  881. return 1;
  882. }
  883.  
  884. public OnPlayerUpdate(playerid)
  885. {
  886. return 1;
  887. }
  888.  
  889. public OnPlayerStreamIn(playerid, forplayerid)
  890. {
  891. return 1;
  892. }
  893.  
  894. public OnPlayerStreamOut(playerid, forplayerid)
  895. {
  896. return 1;
  897. }
  898.  
  899. public OnVehicleStreamIn(vehicleid, forplayerid)
  900. {
  901. return 1;
  902. }
  903.  
  904. public OnVehicleStreamOut(vehicleid, forplayerid)
  905. {
  906. return 1;
  907. }
  908.  
  909. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  910. {
  911. switch( dialogid )
  912. {
  913. case DIALOG_REGISTER:
  914. {
  915. if (!response) return Kick(playerid);
  916. if(response)
  917. {
  918. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
  919. new INI:File = INI_Open(UserPath(playerid));
  920. INI_SetTag(File,"data");
  921. INI_WriteInt(File,"Password",udb_hash(inputtext));
  922. INI_WriteInt(File,"Cash",0);
  923. INI_WriteInt(File,"Admin",0);
  924. INI_WriteInt(File,"Kills",0);
  925. INI_WriteInt(File,"Deaths",0);
  926. INI_Close(File);
  927.  
  928. SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
  929. SpawnPlayer(playerid);
  930. ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Welcome! In order to view our commands you should type /help","Ok","");
  931. }
  932. }
  933.  
  934. case DIALOG_LOGIN:
  935. {
  936. if ( !response ) return Kick ( playerid );
  937. if( response )
  938. {
  939. if(udb_hash(inputtext) == PlayerData[playerid][Pass])
  940. {
  941. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  942. GivePlayerMoney(playerid, PlayerData[playerid][Cash]);
  943. ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
  944. }
  945. else
  946. {
  947. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
  948. }
  949. return 1;
  950. }
  951. }
  952. }
  953. return 1;
  954. }
  955.  
  956. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  957. {
  958. return 1;
  959. }
  960.  
  961.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement