Guest User

Multi Modes

a guest
Jan 4th, 2017
821
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 78.79 KB | None | 0 0
  1. /*
  2. Multi Modes
  3. Made by Jelly23
  4. */
  5.  
  6. /*Includes*/
  7. #include <a_samp>
  8. #include <sscanf2>
  9. #include <foreach>
  10. #include <TextMenu>
  11. #include <izcmd>
  12. #include <a_mysql>
  13.  
  14. /*MySQL*/
  15. #define mysql_host "localhost"
  16. #define mysql_user "root"
  17. #define mysql_database "multimode"
  18. #define mysql_pass ""
  19.  
  20. /*Whirlpool*/
  21. native WP_Hash(buffer[], len, const str[]);
  22.  
  23. /*Web*/
  24. #define YOUR_WEB "www.yourweb.com"
  25.  
  26. /*Mode Settings*/
  27. #define WAR_VERSION "1.0" //War minigame's version
  28. #define TDM_VERSION "1.0" //TDM minigame's version
  29. #define MDM_VERSION "1.0" //Minigun dm minigame's version
  30.  
  31. /*TextDraws*/
  32. new Text:Lobby_TD[24],
  33. Text:Mode_Text[8],
  34. Text:Mode_Two[2];
  35.  
  36. /*Teams - TDM Only*/
  37. #define SWAT (0)
  38. #define TERRORIST (1)
  39.  
  40. /*Colors*/
  41. #define COLOR_RED (0xAA333300)
  42. #define COLOR_BLUE (0x33CCFF00)
  43.  
  44. /*Dialogs*/
  45. #define DIALOG_REGISTER (0)
  46. #define DIALOG_LOGIN (1)
  47. #define DIALOG_BANLIST (2)
  48. #define DIALOG_BANLIST2 (3)
  49. #define DIALOG_BANLIST3 (4)
  50. #define DIALOG_BANLIST4 (5)
  51. #define DIALOG_BANLIST5 (6)
  52. #define DIALOG_BANLIST6 (7)
  53. #define DIALOG_BANLIST7 (8)
  54. #define DIALOG_BANLIST8 (9)
  55. #define DIALOG_BANLIST9 (10)
  56. #define DIALOG_BANLIST10 (11)
  57. #define DIALOG_BANLIST11 (12)
  58.  
  59. /*TextDraw Menus*/
  60. #define MENU_SHOP (0)
  61. #define MENU_PISTOLS (1)
  62. #define MENU_SMACHINE (3)
  63. #define MENU_SHOTGUNS (4)
  64. #define MENU_ARIFLES (5)
  65. #define MENU_RIFLES (6)
  66. #define MENU_CMDS (7)
  67.  
  68. /*Enumerators*/
  69. enum tdm_mapinfo //TDM Enum
  70. {
  71. MapName[50],
  72. time,
  73. interior,
  74. Float:SwatSpawnX,
  75. Float:SwatSpawnY,
  76. Float:SwatSpawnZ,
  77. Float:TerrorSpawnX,
  78. Float:TerrorSpawnY,
  79. Float:TerrorSpawnZ
  80. };
  81.  
  82. enum mdm_mapinfo //Minigun DM Enum
  83. {
  84. MapName[50],
  85. time,
  86. interior,
  87. weather,
  88. Float:Spawn1X,
  89. Float:Spawn1Y,
  90. Float:Spawn1Z,
  91. Float:Spawn2X,
  92. Float:Spawn2Y,
  93. Float:Spawn2Z,
  94. Float:Spawn3X,
  95. Float:Spawn3Y,
  96. Float:Spawn3Z,
  97. };
  98.  
  99. enum playerinfo //Player enum
  100. {
  101. ID,
  102. Pass[129],
  103. Logged,
  104. Level,
  105. Kills,
  106. Deaths
  107. };
  108.  
  109. /*Arrays*/
  110. new PlayerInfo[MAX_PLAYERS][playerinfo],
  111. mode[MAX_PLAYERS],
  112. TDM_Map[tdm_mapinfo],
  113. MDM_Map[mdm_mapinfo],
  114. MapTimer,
  115. mysql,
  116. swat,
  117. terrorist,
  118. global[128];
  119.  
  120. /*Ban List*/
  121. new banrowid[MAX_PLAYERS];
  122. new banrowname[MAX_PLAYERS][24];
  123. new banrowname2[MAX_PLAYERS][24];
  124. new addbaname[MAX_PLAYERS][24];
  125. new LBAN2[MAX_PLAYERS][31][24];
  126. new LBAN[MAX_PLAYERS][31];
  127.  
  128. /*Random Colors - Minigun DM*/
  129. new RandomColors[21] =
  130. {
  131. 0xADFF2FFF, 0x90EE90FF, 0xFF4500FF, 0x4169FFFF, 0x9ACD32FF,
  132. 0xFFFF00FF, 0xDA70D6FF, 0x87CEFAFF, 0xFAFAD2FF, 0xFAEBD7FF,
  133. 0x6495EDFF, 0x4EEE94FF, 0xC0FF3EFF, 0xFFFF00FF, 0xFFB90FFF,
  134. 0x7171C6FF, 0x9B30FFFF, 0xA2B5CDFF, 0xC0FF3EFF, 0xFFD700FF
  135. };
  136.  
  137. /*GameMode*/
  138. main()
  139. {
  140. print("\n----------------------------------");
  141. print(" Multi Modes");
  142. print("----------------------------------\n");
  143. }
  144.  
  145. /*Callbacks*/
  146. public OnGameModeInit()
  147. {
  148. /*Disable interior markers*/
  149. DisableInteriorEnterExits();
  150.  
  151. /*MySQL connection*/
  152. mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG);
  153. mysql = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_pass);
  154. if(mysql_errno(mysql) != 0)
  155. {
  156. print("Wasn't possible to connect to the database!"); SendRconCommand("hostname MYSQL ERROR");
  157. }
  158. else
  159. {
  160. printf("Connected to database: %s",mysql_database);
  161. }
  162.  
  163. /*Map Time*/
  164. TDM_Map[time] = 400,
  165. MDM_Map[time] = 300;
  166.  
  167. /*Class & Game Mode Text*/
  168. SetGameModeText("Multi Modes");
  169. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  170.  
  171. /*Map timer*/
  172. MapTimer = SetTimer("MapUpdate",1000,true);
  173.  
  174. /*TextDraws*/
  175. Lobby_TD[0] = TextDrawCreate(105.400001, 127.583389, "box");
  176. TextDrawLetterSize(Lobby_TD[0], 0.000000, 30.440917);
  177. TextDrawTextSize(Lobby_TD[0], 234.775024, 0.000000);
  178. TextDrawAlignment(Lobby_TD[0], 1);
  179. TextDrawColor(Lobby_TD[0], -1);
  180. TextDrawUseBox(Lobby_TD[0], 1);
  181. TextDrawBoxColor(Lobby_TD[0], -1061109610);
  182. TextDrawSetShadow(Lobby_TD[0], 0);
  183. TextDrawSetOutline(Lobby_TD[0], 0);
  184. TextDrawBackgroundColor(Lobby_TD[0], 255);
  185. TextDrawFont(Lobby_TD[0], 1);
  186. TextDrawSetProportional(Lobby_TD[0], 1);
  187. TextDrawSetShadow(Lobby_TD[0], 0);
  188.  
  189. Lobby_TD[1] = TextDrawCreate(109.125000, 107.666648, "Server_Lobby");
  190. TextDrawLetterSize(Lobby_TD[1], 0.400000, 1.600000);
  191. TextDrawAlignment(Lobby_TD[1], 1);
  192. TextDrawColor(Lobby_TD[1], -1);
  193. TextDrawSetShadow(Lobby_TD[1], 0);
  194. TextDrawSetOutline(Lobby_TD[1], 1);
  195. TextDrawBackgroundColor(Lobby_TD[1], 255);
  196. TextDrawFont(Lobby_TD[1], 2);
  197. TextDrawSetProportional(Lobby_TD[1], 1);
  198. TextDrawSetShadow(Lobby_TD[1], 0);
  199.  
  200. Lobby_TD[2] = TextDrawCreate(239.625000, 127.333282, "box");
  201. TextDrawLetterSize(Lobby_TD[2], 0.000000, 30.480514);
  202. TextDrawTextSize(Lobby_TD[2], 237.750000, 0.000000);
  203. TextDrawAlignment(Lobby_TD[2], 1);
  204. TextDrawColor(Lobby_TD[2], -1);
  205. TextDrawUseBox(Lobby_TD[2], 1);
  206. TextDrawBoxColor(Lobby_TD[2], 90);
  207. TextDrawSetShadow(Lobby_TD[2], 0);
  208. TextDrawSetOutline(Lobby_TD[2], 0);
  209. TextDrawBackgroundColor(Lobby_TD[2], 255);
  210. TextDrawFont(Lobby_TD[2], 1);
  211. TextDrawSetProportional(Lobby_TD[2], 1);
  212. TextDrawSetShadow(Lobby_TD[2], 0);
  213.  
  214. Lobby_TD[3] = TextDrawCreate(102.125000, 127.333282, "box");
  215. TextDrawLetterSize(Lobby_TD[3], 0.000000, 30.480514);
  216. TextDrawTextSize(Lobby_TD[3], 100.250000, 0.000000);
  217. TextDrawAlignment(Lobby_TD[3], 1);
  218. TextDrawColor(Lobby_TD[3], -1);
  219. TextDrawUseBox(Lobby_TD[3], 1);
  220. TextDrawBoxColor(Lobby_TD[3], 90);
  221. TextDrawSetShadow(Lobby_TD[3], 0);
  222. TextDrawSetOutline(Lobby_TD[3], 0);
  223. TextDrawBackgroundColor(Lobby_TD[3], 255);
  224. TextDrawFont(Lobby_TD[3], 1);
  225. TextDrawSetProportional(Lobby_TD[3], 1);
  226. TextDrawSetShadow(Lobby_TD[3], 0);
  227.  
  228. Lobby_TD[4] = TextDrawCreate(102.500000, 123.916610, "box");
  229. TextDrawLetterSize(Lobby_TD[4], 0.000000, -0.116500);
  230. TextDrawTextSize(Lobby_TD[4], 237.640060, 0.000000);
  231. TextDrawAlignment(Lobby_TD[4], 1);
  232. TextDrawColor(Lobby_TD[4], -1);
  233. TextDrawUseBox(Lobby_TD[4], 1);
  234. TextDrawBoxColor(Lobby_TD[4], 90);
  235. TextDrawSetShadow(Lobby_TD[4], 0);
  236. TextDrawSetOutline(Lobby_TD[4], 0);
  237. TextDrawBackgroundColor(Lobby_TD[4], 255);
  238. TextDrawFont(Lobby_TD[4], 1);
  239. TextDrawSetProportional(Lobby_TD[4], 1);
  240. TextDrawSetShadow(Lobby_TD[4], 0);
  241.  
  242. Lobby_TD[5] = TextDrawCreate(102.500000, 406.416625, "box");
  243. TextDrawLetterSize(Lobby_TD[5], 0.000000, -0.116500);
  244. TextDrawTextSize(Lobby_TD[5], 237.640060, 0.000000);
  245. TextDrawAlignment(Lobby_TD[5], 1);
  246. TextDrawColor(Lobby_TD[5], -1);
  247. TextDrawUseBox(Lobby_TD[5], 1);
  248. TextDrawBoxColor(Lobby_TD[5], 90);
  249. TextDrawSetShadow(Lobby_TD[5], 0);
  250. TextDrawSetOutline(Lobby_TD[5], 0);
  251. TextDrawBackgroundColor(Lobby_TD[5], 255);
  252. TextDrawFont(Lobby_TD[5], 1);
  253. TextDrawSetProportional(Lobby_TD[5], 1);
  254. TextDrawSetShadow(Lobby_TD[5], 0);
  255.  
  256. Lobby_TD[6] = TextDrawCreate(143.625000, 131.250000, "ADMINs");
  257. TextDrawLetterSize(Lobby_TD[6], 0.331874, 1.156666);
  258. TextDrawAlignment(Lobby_TD[6], 1);
  259. TextDrawColor(Lobby_TD[6], -1);
  260. TextDrawSetShadow(Lobby_TD[6], 0);
  261. TextDrawSetOutline(Lobby_TD[6], 1);
  262. TextDrawBackgroundColor(Lobby_TD[6], 255);
  263. TextDrawFont(Lobby_TD[6], 2);
  264. TextDrawSetProportional(Lobby_TD[6], 1);
  265. TextDrawSetShadow(Lobby_TD[6], 0);
  266.  
  267. Lobby_TD[7] = TextDrawCreate(109.125000, 147.250000, " ");
  268. TextDrawLetterSize(Lobby_TD[7], 0.293749, 0.940833);
  269. TextDrawAlignment(Lobby_TD[7], 1);
  270. TextDrawColor(Lobby_TD[7], -1);
  271. TextDrawSetShadow(Lobby_TD[7], 0);
  272. TextDrawSetOutline(Lobby_TD[7], 1);
  273. TextDrawBackgroundColor(Lobby_TD[7], 255);
  274. TextDrawFont(Lobby_TD[7], 1);
  275. TextDrawSetProportional(Lobby_TD[7], 1);
  276. TextDrawSetShadow(Lobby_TD[7], 0);
  277.  
  278. Lobby_TD[8] = TextDrawCreate(105.500000, 207.416625, "box");
  279. TextDrawLetterSize(Lobby_TD[8], 0.000000, -0.116500);
  280. TextDrawTextSize(Lobby_TD[8], 234.960006, 0.000000);
  281. TextDrawAlignment(Lobby_TD[8], 1);
  282. TextDrawColor(Lobby_TD[8], -1);
  283. TextDrawUseBox(Lobby_TD[8], 1);
  284. TextDrawBoxColor(Lobby_TD[8], 150);
  285. TextDrawSetShadow(Lobby_TD[8], 0);
  286. TextDrawSetOutline(Lobby_TD[8], 0);
  287. TextDrawBackgroundColor(Lobby_TD[8], 255);
  288. TextDrawFont(Lobby_TD[8], 1);
  289. TextDrawSetProportional(Lobby_TD[8], 1);
  290. TextDrawSetShadow(Lobby_TD[8], 0);
  291.  
  292. Lobby_TD[9] = TextDrawCreate(133.125000, 215.250000, "TOP_KILLS");
  293. TextDrawLetterSize(Lobby_TD[9], 0.331874, 1.156666);
  294. TextDrawAlignment(Lobby_TD[9], 1);
  295. TextDrawColor(Lobby_TD[9], -1);
  296. TextDrawSetShadow(Lobby_TD[9], 0);
  297. TextDrawSetOutline(Lobby_TD[9], 1);
  298. TextDrawBackgroundColor(Lobby_TD[9], 255);
  299. TextDrawFont(Lobby_TD[9], 2);
  300. TextDrawSetProportional(Lobby_TD[9], 1);
  301. TextDrawSetShadow(Lobby_TD[9], 0);
  302.  
  303. Lobby_TD[10] = TextDrawCreate(109.125000, 232.750000, "1_-_Jelly23_-_1000~n~2_-_Test_-_900~n~3_-_Test2_-_700~n~4_-_Test3_-_500~n~5_-_Test4_-_100~n~6_-_Test5_-_90~n~7_-_Test6_-_60~n~8_-_Test7_-_50~n~9_-_Test8_-_40~n~10_-_Test9_-_30");
  304. TextDrawLetterSize(Lobby_TD[10], 0.293749, 0.940833);
  305. TextDrawAlignment(Lobby_TD[10], 1);
  306. TextDrawColor(Lobby_TD[10], -1);
  307. TextDrawSetShadow(Lobby_TD[10], 0);
  308. TextDrawSetOutline(Lobby_TD[10], 1);
  309. TextDrawBackgroundColor(Lobby_TD[10], 255);
  310. TextDrawFont(Lobby_TD[10], 1);
  311. TextDrawSetProportional(Lobby_TD[10], 1);
  312. TextDrawSetShadow(Lobby_TD[10], 0);
  313.  
  314. Lobby_TD[11] = TextDrawCreate(105.500000, 326.916625, "box");
  315. TextDrawLetterSize(Lobby_TD[11], 0.000000, -0.116500);
  316. TextDrawTextSize(Lobby_TD[11], 234.960006, 0.000000);
  317. TextDrawAlignment(Lobby_TD[11], 1);
  318. TextDrawColor(Lobby_TD[11], -1);
  319. TextDrawUseBox(Lobby_TD[11], 1);
  320. TextDrawBoxColor(Lobby_TD[11], 150);
  321. TextDrawSetShadow(Lobby_TD[11], 0);
  322. TextDrawSetOutline(Lobby_TD[11], 0);
  323. TextDrawBackgroundColor(Lobby_TD[11], 255);
  324. TextDrawFont(Lobby_TD[11], 1);
  325. TextDrawSetProportional(Lobby_TD[11], 1);
  326. TextDrawSetShadow(Lobby_TD[11], 0);
  327.  
  328. Lobby_TD[12] = TextDrawCreate(122.625000, 336.750000, "Server_INfo");
  329. TextDrawLetterSize(Lobby_TD[12], 0.331874, 1.156666);
  330. TextDrawAlignment(Lobby_TD[12], 1);
  331. TextDrawColor(Lobby_TD[12], -1);
  332. TextDrawSetShadow(Lobby_TD[12], 0);
  333. TextDrawSetOutline(Lobby_TD[12], 1);
  334. TextDrawBackgroundColor(Lobby_TD[12], 255);
  335. TextDrawFont(Lobby_TD[12], 2);
  336. TextDrawSetProportional(Lobby_TD[12], 1);
  337. TextDrawSetShadow(Lobby_TD[12], 0);
  338.  
  339. Lobby_TD[13] = TextDrawCreate(109.125000, 355.250000, "__www.yourweb.com~n~~n~-Players:_0/100~n~-Admins:_0~n~-Modes:_3");
  340. TextDrawLetterSize(Lobby_TD[13], 0.293749, 0.940833);
  341. TextDrawAlignment(Lobby_TD[13], 1);
  342. TextDrawColor(Lobby_TD[13], -1);
  343. TextDrawSetShadow(Lobby_TD[13], 0);
  344. TextDrawSetOutline(Lobby_TD[13], 1);
  345. TextDrawBackgroundColor(Lobby_TD[13], 255);
  346. TextDrawFont(Lobby_TD[13], 1);
  347. TextDrawSetProportional(Lobby_TD[13], 1);
  348. TextDrawSetShadow(Lobby_TD[13], 0);
  349.  
  350. Lobby_TD[14] = TextDrawCreate(286.875000, 124.166641, "box");
  351. TextDrawLetterSize(Lobby_TD[14], 0.000000, 9.289999);
  352. TextDrawTextSize(Lobby_TD[14], 519.403625, 0.000000);
  353. TextDrawAlignment(Lobby_TD[14], 1);
  354. TextDrawColor(Lobby_TD[14], -1);
  355. TextDrawUseBox(Lobby_TD[14], 1);
  356. TextDrawBoxColor(Lobby_TD[14], 120);
  357. TextDrawSetShadow(Lobby_TD[14], 0);
  358. TextDrawSetOutline(Lobby_TD[14], 0);
  359. TextDrawBackgroundColor(Lobby_TD[14], 120);
  360. TextDrawFont(Lobby_TD[14], 1);
  361. TextDrawSetProportional(Lobby_TD[14], 1);
  362. TextDrawSetShadow(Lobby_TD[14], 0);
  363.  
  364. Lobby_TD[15] = TextDrawCreate(326.325775, 107.566642, "MODE_SELECTION");
  365. TextDrawLetterSize(Lobby_TD[15], 0.400000, 1.600000);
  366. TextDrawAlignment(Lobby_TD[15], 1);
  367. TextDrawColor(Lobby_TD[15], -1);
  368. TextDrawSetShadow(Lobby_TD[15], 0);
  369. TextDrawSetOutline(Lobby_TD[15], 1);
  370. TextDrawBackgroundColor(Lobby_TD[15], 255);
  371. TextDrawFont(Lobby_TD[15], 2);
  372. TextDrawSetProportional(Lobby_TD[15], 1);
  373. TextDrawSetShadow(Lobby_TD[15], 0);
  374.  
  375. Lobby_TD[16] = TextDrawCreate(286.875000, 216.566238, "box");
  376. TextDrawLetterSize(Lobby_TD[16], 0.000000, 9.289999);
  377. TextDrawTextSize(Lobby_TD[16], 519.403625, 0.000000);
  378. TextDrawAlignment(Lobby_TD[16], 1);
  379. TextDrawColor(Lobby_TD[16], 120);
  380. TextDrawUseBox(Lobby_TD[16], 1);
  381. TextDrawBoxColor(Lobby_TD[16], 120);
  382. TextDrawSetShadow(Lobby_TD[16], 0);
  383. TextDrawSetOutline(Lobby_TD[16], 0);
  384. TextDrawBackgroundColor(Lobby_TD[16], 120);
  385. TextDrawFont(Lobby_TD[16], 1);
  386. TextDrawSetProportional(Lobby_TD[16], 1);
  387. TextDrawSetShadow(Lobby_TD[16], 0);
  388.  
  389. Lobby_TD[17] = TextDrawCreate(286.875000, 309.666992, "box");
  390. TextDrawLetterSize(Lobby_TD[17], 0.000000, 9.289999);
  391. TextDrawTextSize(Lobby_TD[17], 519.403625, 0.000000);
  392. TextDrawAlignment(Lobby_TD[17], 1);
  393. TextDrawColor(Lobby_TD[17], -1);
  394. TextDrawUseBox(Lobby_TD[17], 1);
  395. TextDrawBoxColor(Lobby_TD[17], 120);
  396. TextDrawSetShadow(Lobby_TD[17], 0);
  397. TextDrawSetOutline(Lobby_TD[17], 0);
  398. TextDrawBackgroundColor(Lobby_TD[17], 255);
  399. TextDrawFont(Lobby_TD[17], 1);
  400. TextDrawSetProportional(Lobby_TD[17], 1);
  401. TextDrawSetShadow(Lobby_TD[17], 0);
  402.  
  403. Lobby_TD[18] = TextDrawCreate(291.250000, 125.833366, "WAR_GAME~n~~n~Players:_10~n~map:_area_51~n~VERSION:_1.0");
  404. TextDrawLetterSize(Lobby_TD[18], 0.400000, 1.600000);
  405. TextDrawAlignment(Lobby_TD[18], 1);
  406. TextDrawColor(Lobby_TD[18], -5963521);
  407. TextDrawSetShadow(Lobby_TD[18], 0);
  408. TextDrawSetOutline(Lobby_TD[18], 1);
  409. TextDrawBackgroundColor(Lobby_TD[18], 255);
  410. TextDrawFont(Lobby_TD[18], 2);
  411. TextDrawSetProportional(Lobby_TD[18], 1);
  412. TextDrawSetShadow(Lobby_TD[18], 0);
  413.  
  414. Lobby_TD[19] = TextDrawCreate(479.725158, 132.833328, "PLAY");
  415. TextDrawLetterSize(Lobby_TD[19], 0.400000, 1.600000);
  416. TextDrawTextSize(Lobby_TD[19], 15.000000, 66.705001);
  417. TextDrawAlignment(Lobby_TD[19], 2);
  418. TextDrawColor(Lobby_TD[19], -1);
  419. TextDrawUseBox(Lobby_TD[19], 1);
  420. TextDrawBoxColor(Lobby_TD[19], 255);
  421. TextDrawSetShadow(Lobby_TD[19], 0);
  422. TextDrawSetOutline(Lobby_TD[19], 1);
  423. TextDrawBackgroundColor(Lobby_TD[19], 255);
  424. TextDrawFont(Lobby_TD[19], 2);
  425. TextDrawSetProportional(Lobby_TD[19], 1);
  426. TextDrawSetShadow(Lobby_TD[19], 0);
  427. TextDrawSetSelectable(Lobby_TD[19], 1);
  428.  
  429. Lobby_TD[20] = TextDrawCreate(291.250000, 219.632965, "tdm_game~n~~n~players:_5~n~map:_lvpd~n~version:_1.0");
  430. TextDrawLetterSize(Lobby_TD[20], 0.400000, 1.600000);
  431. TextDrawAlignment(Lobby_TD[20], 1);
  432. TextDrawColor(Lobby_TD[20], -5963521);
  433. TextDrawSetShadow(Lobby_TD[20], 0);
  434. TextDrawSetOutline(Lobby_TD[20], 1);
  435. TextDrawBackgroundColor(Lobby_TD[20], 255);
  436. TextDrawFont(Lobby_TD[20], 2);
  437. TextDrawSetProportional(Lobby_TD[20], 1);
  438. TextDrawSetShadow(Lobby_TD[20], 0);
  439.  
  440. Lobby_TD[21] = TextDrawCreate(479.725158, 225.232925, "PLAY");
  441. TextDrawLetterSize(Lobby_TD[21], 0.400000, 1.600000);
  442. TextDrawTextSize(Lobby_TD[21], 15.000000, 66.705001);
  443. TextDrawAlignment(Lobby_TD[21], 2);
  444. TextDrawColor(Lobby_TD[21], -1);
  445. TextDrawUseBox(Lobby_TD[21], 1);
  446. TextDrawBoxColor(Lobby_TD[21], 255);
  447. TextDrawSetShadow(Lobby_TD[21], 0);
  448. TextDrawSetOutline(Lobby_TD[21], 1);
  449. TextDrawBackgroundColor(Lobby_TD[21], 255);
  450. TextDrawFont(Lobby_TD[21], 2);
  451. TextDrawSetProportional(Lobby_TD[21], 1);
  452. TextDrawSetShadow(Lobby_TD[21], 0);
  453. TextDrawSetSelectable(Lobby_TD[21], 1);
  454.  
  455. Lobby_TD[22] = TextDrawCreate(291.250000, 312.733795, "minigun_dm~n~~n~players:_2~n~map:_stadium~n~version:_1.0");
  456. TextDrawLetterSize(Lobby_TD[22], 0.400000, 1.600000);
  457. TextDrawAlignment(Lobby_TD[22], 1);
  458. TextDrawColor(Lobby_TD[22], -5963521);
  459. TextDrawSetShadow(Lobby_TD[22], 0);
  460. TextDrawSetOutline(Lobby_TD[22], 1);
  461. TextDrawBackgroundColor(Lobby_TD[22], 255);
  462. TextDrawFont(Lobby_TD[22], 2);
  463. TextDrawSetProportional(Lobby_TD[22], 1);
  464. TextDrawSetShadow(Lobby_TD[22], 0);
  465.  
  466. Lobby_TD[23] = TextDrawCreate(479.725158, 318.333892, "PLAY");
  467. TextDrawLetterSize(Lobby_TD[23], 0.400000, 1.600000);
  468. TextDrawTextSize(Lobby_TD[23], 15.000000, 66.705001);
  469. TextDrawAlignment(Lobby_TD[23], 2);
  470. TextDrawColor(Lobby_TD[23], -1);
  471. TextDrawUseBox(Lobby_TD[23], 1);
  472. TextDrawBoxColor(Lobby_TD[23], 255);
  473. TextDrawSetShadow(Lobby_TD[23], 0);
  474. TextDrawSetOutline(Lobby_TD[23], 1);
  475. TextDrawBackgroundColor(Lobby_TD[23], 255);
  476. TextDrawFont(Lobby_TD[23], 2);
  477. TextDrawSetProportional(Lobby_TD[23], 1);
  478. TextDrawSetShadow(Lobby_TD[23], 0);
  479. TextDrawSetSelectable(Lobby_TD[23], 1);
  480.  
  481. Mode_Text[0] = TextDrawCreate(31.599992, 271.386749, "box");
  482. TextDrawLetterSize(Mode_Text[0], 0.000000, 6.800001);
  483. TextDrawTextSize(Mode_Text[0], 134.799911, 0.000000);
  484. TextDrawAlignment(Mode_Text[0], 1);
  485. TextDrawColor(Mode_Text[0], -1);
  486. TextDrawUseBox(Mode_Text[0], 1);
  487. TextDrawBoxColor(Mode_Text[0], 100);
  488. TextDrawSetShadow(Mode_Text[0], 0);
  489. TextDrawSetOutline(Mode_Text[0], 0);
  490. TextDrawBackgroundColor(Mode_Text[0], 255);
  491. TextDrawFont(Mode_Text[0], 1);
  492. TextDrawSetProportional(Mode_Text[0], 1);
  493. TextDrawSetShadow(Mode_Text[0], 0);
  494.  
  495. Mode_Text[1] = TextDrawCreate(31.600025, 271.586730, "box");
  496. TextDrawLetterSize(Mode_Text[1], 0.000000, 0.320000);
  497. TextDrawTextSize(Mode_Text[1], 134.800003, 0.000000);
  498. TextDrawAlignment(Mode_Text[1], 1);
  499. TextDrawColor(Mode_Text[1], -1);
  500. TextDrawUseBox(Mode_Text[1], 1);
  501. TextDrawBoxColor(Mode_Text[1], 150);
  502. TextDrawSetShadow(Mode_Text[1], 0);
  503. TextDrawSetOutline(Mode_Text[1], 0);
  504. TextDrawBackgroundColor(Mode_Text[1], 255);
  505. TextDrawFont(Mode_Text[1], 1);
  506. TextDrawSetProportional(Mode_Text[1], 1);
  507. TextDrawSetShadow(Mode_Text[1], 0);
  508.  
  509. Mode_Text[2] = TextDrawCreate(52.500057, 267.153320, "MAP_INFO");
  510. TextDrawLetterSize(Mode_Text[2], 0.302399, 1.107199);
  511. TextDrawAlignment(Mode_Text[2], 1);
  512. TextDrawColor(Mode_Text[2], -1);
  513. TextDrawSetShadow(Mode_Text[2], 0);
  514. TextDrawSetOutline(Mode_Text[2], 1);
  515. TextDrawBackgroundColor(Mode_Text[2], 255);
  516. TextDrawFont(Mode_Text[2], 2);
  517. TextDrawSetProportional(Mode_Text[2], 1);
  518. TextDrawSetShadow(Mode_Text[2], 0);
  519.  
  520. Mode_Text[3] = TextDrawCreate(33.199974, 282.586730, "MAP:_Jefferson");
  521. TextDrawLetterSize(Mode_Text[3], 0.280799, 1.308799);
  522. TextDrawAlignment(Mode_Text[3], 1);
  523. TextDrawColor(Mode_Text[3], -1);
  524. TextDrawSetShadow(Mode_Text[3], 0);
  525. TextDrawSetOutline(Mode_Text[3], 1);
  526. TextDrawBackgroundColor(Mode_Text[3], 255);
  527. TextDrawFont(Mode_Text[3], 2);
  528. TextDrawSetProportional(Mode_Text[3], 1);
  529. TextDrawSetShadow(Mode_Text[3], 0);
  530.  
  531. Mode_Text[4] = TextDrawCreate(33.199974, 293.387390, "TIME_LEFT:_400");
  532. TextDrawLetterSize(Mode_Text[4], 0.280799, 1.308799);
  533. TextDrawAlignment(Mode_Text[4], 1);
  534. TextDrawColor(Mode_Text[4], -1);
  535. TextDrawSetShadow(Mode_Text[4], 0);
  536. TextDrawSetOutline(Mode_Text[4], 1);
  537. TextDrawBackgroundColor(Mode_Text[4], 255);
  538. TextDrawFont(Mode_Text[4], 2);
  539. TextDrawSetProportional(Mode_Text[4], 1);
  540. TextDrawSetShadow(Mode_Text[4], 0);
  541.  
  542. Mode_Text[5] = TextDrawCreate(33.199974, 303.388000, "---------------------------");
  543. TextDrawLetterSize(Mode_Text[5], 0.280799, 1.308799);
  544. TextDrawAlignment(Mode_Text[5], 1);
  545. TextDrawColor(Mode_Text[5], -1);
  546. TextDrawSetShadow(Mode_Text[5], 0);
  547. TextDrawSetOutline(Mode_Text[5], 1);
  548. TextDrawBackgroundColor(Mode_Text[5], 255);
  549. TextDrawFont(Mode_Text[5], 2);
  550. TextDrawSetProportional(Mode_Text[5], 1);
  551. TextDrawSetShadow(Mode_Text[5], 0);
  552.  
  553. Mode_Text[6] = TextDrawCreate(33.199974, 312.888580, "SWAT_TEAM:_0");
  554. TextDrawLetterSize(Mode_Text[6], 0.280799, 1.308799);
  555. TextDrawAlignment(Mode_Text[6], 1);
  556. TextDrawColor(Mode_Text[6], -1);
  557. TextDrawSetShadow(Mode_Text[6], 0);
  558. TextDrawSetOutline(Mode_Text[6], 1);
  559. TextDrawBackgroundColor(Mode_Text[6], 255);
  560. TextDrawFont(Mode_Text[6], 2);
  561. TextDrawSetProportional(Mode_Text[6], 1);
  562. TextDrawSetShadow(Mode_Text[6], 0);
  563.  
  564. Mode_Text[7] = TextDrawCreate(33.199974, 323.589233, "TERRORISTS:__0");
  565. TextDrawLetterSize(Mode_Text[7], 0.280799, 1.308799);
  566. TextDrawAlignment(Mode_Text[7], 1);
  567. TextDrawColor(Mode_Text[7], -1);
  568. TextDrawSetShadow(Mode_Text[7], 0);
  569. TextDrawSetOutline(Mode_Text[7], 1);
  570. TextDrawBackgroundColor(Mode_Text[7], 255);
  571. TextDrawFont(Mode_Text[7], 2);
  572. TextDrawSetProportional(Mode_Text[7], 1);
  573. TextDrawSetShadow(Mode_Text[7], 0);
  574.  
  575. Mode_Two[0] = TextDrawCreate(33.199974, 282.586730, "MAP:_Jefferson");
  576. TextDrawLetterSize(Mode_Two[0], 0.280799, 1.308799);
  577. TextDrawAlignment(Mode_Two[0], 1);
  578. TextDrawColor(Mode_Two[0], -1);
  579. TextDrawSetShadow(Mode_Two[0], 0);
  580. TextDrawSetOutline(Mode_Two[0], 1);
  581. TextDrawBackgroundColor(Mode_Two[0], 255);
  582. TextDrawFont(Mode_Two[0], 2);
  583. TextDrawSetProportional(Mode_Two[0], 1);
  584. TextDrawSetShadow(Mode_Two[0], 0);
  585.  
  586. Mode_Two[1] = TextDrawCreate(33.199974, 293.387390, "TIME_LEFT:_400");
  587. TextDrawLetterSize(Mode_Two[1], 0.280799, 1.308799);
  588. TextDrawAlignment(Mode_Two[1], 1);
  589. TextDrawColor(Mode_Two[1], -1);
  590. TextDrawSetShadow(Mode_Two[1], 0);
  591. TextDrawSetOutline(Mode_Two[1], 1);
  592. TextDrawBackgroundColor(Mode_Two[1], 255);
  593. TextDrawFont(Mode_Two[1], 2);
  594. TextDrawSetProportional(Mode_Two[1], 1);
  595. TextDrawSetShadow(Mode_Two[1], 0);
  596.  
  597. /*War mode vehicles*/
  598. new Warveh0 = CreateVehicle(432,293.3999900,1907.0999800,17.7000000,314.0000000,95,10,15); //Rhino
  599. new Warveh1 = CreateVehicle(432,293.7999900,1896.5000000,17.7000000,313.9950000,95,10,15); //Rhino
  600. new Warveh2 = CreateVehicle(432,294.7999900,1886.4000200,17.7000000,313.9950000,95,10,15); //Rhino
  601. new Warveh3 = CreateVehicle(432,294.8999900,1873.4000200,17.7000000,313.9950000,95,10,15); //Rhino
  602. new Warveh4 = CreateVehicle(432,294.5000000,1859.5000000,17.7000000,313.9950000,95,10,15); //Rhino
  603. new Warveh5 = CreateVehicle(432,295.0000000,1850.8000500,17.7000000,313.9950000,95,10,15); //Rhino
  604. new Warveh6 = CreateVehicle(432,281.8999900,1934.3000500,17.7000000,269.9950000,95,10,15); //Rhino
  605. new Warveh7 = CreateVehicle(432,278.8999900,1960.0999800,17.7000000,269.9950000,95,10,15); //Rhino
  606. new Warveh8 = CreateVehicle(432,359.0000000,1969.4000200,17.7000000,117.9950000,95,10,15); //Rhino
  607. new Warveh9 = CreateVehicle(432,359.6992200,1985.2998000,17.7000000,117.9880000,95,10,15); //Rhino
  608. new Warveh10 = CreateVehicle(432,371.7999900,1964.5999800,17.7000000,117.9930000,95,10,15); //Rhino
  609. new Warveh11 = CreateVehicle(520,280.6000100,2029.5999800,18.2000000,270.0000000,-1,-1,15); //Hydra
  610. new Warveh12 = CreateVehicle(520,280.7000100,2019.4000200,18.2000000,270.0000000,-1,-1,15); //Hydra
  611. new Warveh13 = CreateVehicle(520,279.2999900,1993.5999800,18.2000000,270.0000000,-1,-1,15); //Hydra
  612. new Warveh14 = CreateVehicle(520,280.0000000,1984.0000000,18.2000000,296.0000000,-1,-1,15); //Hydra
  613. new Warveh15 = CreateVehicle(520,302.1000100,2044.5999800,18.2000000,180.0000000,-1,-1,15); //Hydra
  614. new Warveh16 = CreateVehicle(520,317.6000100,2044.0999800,18.2000000,180.0000000,-1,-1,15); //Hydra
  615. new Warveh17 = CreateVehicle(520,315.5000000,1817.0000000,18.2000000,0.0000000,-1,-1,15); //Hydra
  616. new Warveh18 = CreateVehicle(520,303.8999900,1817.3000500,18.2000000,0.0000000,-1,-1,15); //Hydra
  617. new Warveh19 = CreateVehicle(425,348.7999900,1923.0000000,18.4000000,90.0000000,95,10,15); //Hunter
  618. new Warveh20 = CreateVehicle(425,348.8999900,1938.5999800,18.4000000,90.0000000,95,10,15); //Hunter
  619. new Warveh21 = CreateVehicle(425,337.6000100,1957.3000500,18.4000000,90.0000000,95,10,15); //Hunter
  620. new Warveh22 = CreateVehicle(425,329.3999900,1928.3000500,18.4000000,90.0000000,95,10,15); //Hunter
  621. new Warveh23 = CreateVehicle(425,335.0000000,1909.0000000,18.4000000,90.0000000,95,10,15); //Hunter
  622. new Warveh24 = CreateVehicle(425,294.0000000,1921.1999500,18.4000000,280.0000000,95,10,15); //Hunter
  623. new Warveh25 = CreateVehicle(476,209.2000000,1955.3000500,18.7000000,0.0000000,170,157,15); //Rustler
  624. new Warveh26 = CreateVehicle(476,222.3999900,1955.4000200,18.7000000,0.0000000,170,157,15); //Rustler
  625. new Warveh27 = CreateVehicle(476,238.1000100,1955.5999800,18.7000000,0.0000000,170,157,15); //Rustler
  626. new Warveh28 = CreateVehicle(476,251.8000000,1962.4000200,18.7000000,32.0000000,170,157,15); //Rustler
  627. SetVehicleVirtualWorld(Warveh0,0);SetVehicleVirtualWorld(Warveh1,0);SetVehicleVirtualWorld(Warveh2,0);SetVehicleVirtualWorld(Warveh3,0);
  628. SetVehicleVirtualWorld(Warveh4,0);SetVehicleVirtualWorld(Warveh5,0);SetVehicleVirtualWorld(Warveh6,0);SetVehicleVirtualWorld(Warveh7,0);SetVehicleVirtualWorld(Warveh8,0);
  629. SetVehicleVirtualWorld(Warveh9,0);SetVehicleVirtualWorld(Warveh10,0);SetVehicleVirtualWorld(Warveh11,0);SetVehicleVirtualWorld(Warveh12,0);SetVehicleVirtualWorld(Warveh13,0);
  630. SetVehicleVirtualWorld(Warveh14,0);SetVehicleVirtualWorld(Warveh15,0);SetVehicleVirtualWorld(Warveh16,0);SetVehicleVirtualWorld(Warveh17,0);SetVehicleVirtualWorld(Warveh28,0);
  631. SetVehicleVirtualWorld(Warveh18,0);SetVehicleVirtualWorld(Warveh19,0);SetVehicleVirtualWorld(Warveh20,0);SetVehicleVirtualWorld(Warveh21,0);SetVehicleVirtualWorld(Warveh22,0);
  632. SetVehicleVirtualWorld(Warveh23,0);SetVehicleVirtualWorld(Warveh24,0);SetVehicleVirtualWorld(Warveh25,0);SetVehicleVirtualWorld(Warveh26,0);SetVehicleVirtualWorld(Warveh27,0);
  633.  
  634. /*Top 10 Kills - Lobby*/
  635. new query[115];
  636. mysql_tquery(mysql,"SELECT `name`, `kills` FROM `players` ORDER BY `kills` DESC LIMIT 10", "TopTen", "", "" );
  637.  
  638. /*TDM Map*/
  639. mysql_tquery(mysql, "SELECT * FROM `tdm_maps` ORDER BY RAND() LIMIT 1", "LoadMaps", "i", 2);
  640.  
  641. /*MDM Map*/
  642. mysql_tquery(mysql, "SELECT * FROM `mdm_maps` ORDER BY RAND() LIMIT 1", "LoadMaps", "i", 3);
  643.  
  644. /*Update Draws Info*/
  645. ResetDraws();
  646. return 1;
  647. }
  648.  
  649. forward TopTen();
  650. public TopTen()
  651. {
  652. new top[MAX_PLAYER_NAME],str[260];
  653. for(new i =0; i < cache_num_rows(); i++)
  654. {
  655. cache_get_field_content(i,"name",top,mysql,MAX_PLAYER_NAME);
  656. format(str,sizeof(str),"%s%i - %s - %d~n~",str,i+1,top,cache_get_field_content_int(i,"kills"));
  657. }
  658. TextDrawSetString(Lobby_TD[10], str);
  659. }
  660.  
  661. forward MapUpdate();
  662. public MapUpdate()
  663. {
  664. /*TDM Map time*/
  665. new str[4];
  666. if(TDM_Map[time] != 0)
  667. {
  668. TDM_Map[time]--;
  669. format(str,sizeof(str),"%i",TDM_Map[time]);
  670. TextDrawSetString(Mode_Text[4],str);
  671. TextDrawShowForMode(2,Mode_Text[4]);
  672. }
  673. else
  674. {
  675. new cstr[115];
  676. mysql_format(mysql, cstr, sizeof(cstr), "SELECT * FROM `tdm_maps` ORDER BY RAND() LIMIT 1");
  677. mysql_tquery(mysql, cstr, "LoadMaps", "i", 2);
  678. TDM_Map[time] = 400;
  679. }
  680. /*MDM Map time*/
  681. if(MDM_Map[time] != 0)
  682. {
  683. MDM_Map[time]--;
  684. format(str,sizeof(str),"%i",MDM_Map[time]);
  685. TextDrawSetString(Mode_Two[1],str);
  686. TextDrawShowForMode(3,Mode_Two[1]);
  687. }
  688. else
  689. {
  690. new cstr[115];
  691. mysql_format(mysql, cstr, sizeof(cstr), "SELECT * FROM `mdm_maps` ORDER BY RAND() LIMIT 1");
  692. mysql_tquery(mysql, cstr, "LoadMaps", "i", 3);
  693. MDM_Map[time] = 300;
  694. }
  695. }
  696.  
  697. public OnGameModeExit()
  698. {
  699. foreach(new i: Player)
  700. {
  701. SavePlayer(i);
  702. }
  703. KillTimer(MapTimer);
  704. return 1;
  705. }
  706.  
  707. public OnPlayerRequestClass(playerid, classid)
  708. {
  709. SetSpawnInfo(playerid, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0);
  710. TogglePlayerSpectating(playerid, true);
  711. return 1;
  712. }
  713.  
  714. public OnPlayerConnect(playerid)
  715. {
  716. new query[103];
  717. mysql_format(mysql, query, sizeof(query),"SELECT * FROM `bans` WHERE `b_name` = '%e' or `b_ip` ='%s' LIMIT 1", GetName(playerid),GetIp(playerid));
  718. mysql_tquery(mysql, query, "OnBanCheck", "i", playerid);
  719. mode[playerid] = 0,PlayerInfo[playerid][Logged] = 0;
  720. SelectTextDraw(playerid, 0xFF4040AA),UpdateOnlinePlayers();
  721. ShowLobby(playerid);
  722. SetSpawnInfo(playerid, NO_TEAM, 255, 1280.0, -1024.0, 20.0, 180.0, 0, 0, 0, 0, 0, 0);
  723. return 1;
  724. }
  725.  
  726. public OnPlayerDisconnect(playerid, reason)
  727. {
  728. new reasons[14],cstr[50];
  729. switch(reason)
  730. {
  731. case 0: reasons = "Timeout/Crash";
  732. case 1: reasons = "Quit";
  733. case 2: reasons = "Kick/Ban";
  734. }
  735. format(cstr, sizeof cstr, "%s has left the server (%s).", GetName(playerid), reasons);
  736. SendClientMessageToAll(0xC4C4C4FF, cstr);
  737. SavePlayer(playerid),UpdateOnlinePlayers(),ResetDraws();
  738. PlayerInfo[playerid][Kills] = PlayerInfo[playerid][Logged] = PlayerInfo[playerid][Deaths] = PlayerInfo[playerid][Level] = 0;
  739. return 1;
  740. }
  741.  
  742. public OnPlayerDeath(playerid, killerid, reason)
  743. {
  744. PlayerInfo[playerid][Deaths]++;
  745. if(killerid != INVALID_PLAYER_ID)
  746. {
  747. GivePlayerMoney(killerid,random(4000)),SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  748. PlayerInfo[killerid][Kills]++;
  749. SendClientMessage(playerid,-1,"{FF0000}[KILL]: You killed somebody. You received 1+ score and some cash.");
  750. if(mode[killerid] == 1)
  751. {
  752. new str[16];
  753. if(GetPlayerTeam(killerid) == SWAT)
  754. {
  755. swat++;
  756. format(str,sizeof(str),"SWAT Team: %d",swat);
  757. TextDrawSetString(Mode_Text[6],str);
  758. TextDrawShowForMode(2,Mode_Text[6]);
  759. }
  760. else
  761. {
  762. terrorist++;
  763. format(str,sizeof(str),"Terrorists: %d",terrorist);
  764. TextDrawSetString(Mode_Text[7],str);
  765. TextDrawShowForMode(2,Mode_Text[7]);
  766. }
  767. }
  768. }
  769. }
  770.  
  771. forward DelayedKick(playerid);
  772. public DelayedKick(playerid)
  773. {
  774. Kick(playerid);
  775. return 1;
  776. }
  777.  
  778. forward LoadMaps(modeid); //Loads the maps
  779. public LoadMaps(modeid)
  780. {
  781. new str[50];
  782. if(modeid == 2)
  783. {
  784. for(new i = 0; i < cache_get_row_count(); i++)
  785. {
  786. cache_get_field_content(i, "MapName", TDM_Map[MapName], mysql, 50);
  787. TDM_Map[interior] = cache_get_field_content_int(i, "interior");
  788.  
  789. TDM_Map[SwatSpawnX] = cache_get_field_content_float(i, "SwatSpawnX");
  790. TDM_Map[SwatSpawnY] = cache_get_field_content_float(i, "SwatSpawnY");
  791. TDM_Map[SwatSpawnZ] = cache_get_field_content_float(i, "SwatSpawnZ");
  792.  
  793. TDM_Map[TerrorSpawnX] = cache_get_field_content_float(i, "TerrorSpawnX");
  794. TDM_Map[TerrorSpawnY] = cache_get_field_content_float(i, "TerrorSpawnY");
  795. TDM_Map[TerrorSpawnZ] = cache_get_field_content_float(i, "TerrorSpawnZ");
  796. }
  797. format(str,sizeof(str),"%s",TDM_Map[MapName]);
  798. TextDrawSetString(Mode_Text[3],str);
  799. TextDrawShowForMode(2,Mode_Text[3]);
  800. foreach(new i: Player)
  801. {
  802. if(mode[i] == 2)
  803. {
  804. SpawnPlayer(i);
  805. }
  806. if(GetPlayerTeam(i) == SWAT && swat > terrorist)
  807. {
  808. SetPlayerScore(i,GetPlayerScore(i)+10);
  809. SendClientMessage(i,-1,"{FFFF00}[!] SWAT Team win! You got +10 scores.");
  810. GameTextForPlayer(i, "~b~SWAT WIN", 2000, 3);
  811. }
  812. else if(GetPlayerTeam(i) == TERRORIST && swat < terrorist)
  813. {
  814. SetPlayerScore(i,GetPlayerScore(i)+10);
  815. SendClientMessage(i,-1,"{FFFF00}[!] Terrorist Team win! You got +10 scores.");
  816. GameTextForPlayer(i, "~r~TERRORIST WIN", 2000, 3);
  817. }
  818. }
  819. }
  820. else
  821. {
  822. for(new i = 0; i < cache_get_row_count(); i++)
  823. {
  824. cache_get_field_content(i, "MapName", MDM_Map[MapName], mysql, 50);
  825. MDM_Map[interior] = cache_get_field_content_int(i, "interior");
  826.  
  827. MDM_Map[Spawn1X] = cache_get_field_content_float(i, "Spawn1X");
  828. MDM_Map[Spawn1Y] = cache_get_field_content_float(i, "Spawn1Y");
  829. MDM_Map[Spawn1Z] = cache_get_field_content_float(i, "Spawn1Z");
  830.  
  831. MDM_Map[Spawn2X] = cache_get_field_content_float(i, "Spawn2X");
  832. MDM_Map[Spawn2Y] = cache_get_field_content_float(i, "Spawn2Y");
  833. MDM_Map[Spawn2Z] = cache_get_field_content_float(i, "Spawn2Z");
  834.  
  835. MDM_Map[Spawn3X] = cache_get_field_content_float(i, "Spawn3X");
  836. MDM_Map[Spawn3Y] = cache_get_field_content_float(i, "Spawn3Y");
  837. MDM_Map[Spawn3Z] = cache_get_field_content_float(i, "Spawn3Z");
  838. }
  839. format(str,sizeof(str),"%s",MDM_Map[MapName]);
  840. TextDrawSetString(Mode_Two[0],str);
  841. TextDrawShowForMode(3,Mode_Two[0]);
  842. foreach(new i: Player)
  843. {
  844. if(mode[i] == 3)
  845. {
  846. SpawnPlayer(i);
  847. }
  848. }
  849. }
  850. ResetDraws();
  851. }
  852.  
  853. forward OnBanCheck(playerid);
  854. public OnBanCheck(playerid)
  855. {
  856. new rows,fields;
  857. cache_get_data(rows, fields, mysql);
  858. if(rows)
  859. {
  860. new adm[24],res[50],btime[50],origin[24],str[128];
  861. cache_get_field_content(0, "b_admin", adm, mysql, 24);
  862. cache_get_field_content(0, "b_reason", res, mysql,50);
  863. cache_get_field_content(0, "b_time", btime, mysql, 50);
  864. cache_get_field_content(0, "b_name", origin, mysql, 24);
  865.  
  866. TogglePlayerSpectating(playerid,true);
  867. SendClientMessage(playerid,0xFF0080FF,"----------------------------------------------------------------------------------------------------------");
  868. SendClientMessage(playerid,0xFF0080FF,"* You are banned from this server.");
  869. format(str,sizeof(str),"* Account: %s",origin);
  870. SendClientMessage(playerid,0xFF0080FF,str);
  871. format(str,sizeof(str),"* Admin: %s",adm);
  872. SendClientMessage(playerid,0xFF0080FF,str);
  873. format(str,sizeof(str),"* Time: %s",btime);
  874. SendClientMessage(playerid,0xFF0080FF,str);
  875. format(str,sizeof(str),"* Reason: %s",res);
  876. SendClientMessage(playerid,0xFF0080FF,str);
  877. SendClientMessage(playerid,0xFF0080FF,"----------------------------------------------------------------------------------------------------------");
  878. KickEx(playerid);
  879.  
  880. }
  881. else
  882. {
  883. new query[71];
  884. format(query,sizeof query,"%s has joined the server.",GetName(playerid));
  885. SendClientMessageToAll(0xFFFFFFAA,query);
  886. mysql_format(mysql, query, sizeof(query),"SELECT `pass` FROM `players` WHERE `name` = '%e'", GetName(playerid));
  887. mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);
  888. }
  889. }
  890.  
  891. forward OnAccountCheck(playerid);
  892. public OnAccountCheck(playerid)
  893. {
  894. new rows, fields,string[138];
  895. cache_get_data(rows, fields, mysql);
  896. if(rows)
  897. {
  898. format(string, sizeof(string),"{FFFF00}Welcome {0080FF}%s, {FFFF00}you are already registered\nPlease enter your password to log into your account", GetName(playerid));
  899. cache_get_field_content(0, "pass", PlayerInfo[playerid][Pass], mysql, 129);
  900. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login",string,"Login","");
  901.  
  902. }
  903. else
  904. {
  905. format(string, sizeof(string),"{FFFF00}Welcome {0080FF}%s, {FFFF00}you are not registered\nPlease enter a password to register your account", GetName(playerid));
  906. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register",string,"Register","");
  907.  
  908. }
  909. }
  910.  
  911. public OnPlayerClickTextDraw(playerid, Text:clickedid)
  912. {
  913. if(_:clickedid != INVALID_TEXT_DRAW)
  914. {
  915. if(PlayerInfo[playerid][Logged] == 0) return SendClientMessage(playerid,-1,"You must be logged in to select a mode!");
  916. if(clickedid == Lobby_TD[19])
  917. {
  918. new string[80];
  919. mode[playerid] = 1;
  920. TogglePlayerSpectating(playerid,0);
  921. format(string,sizeof(string),"WAR_GAME~n~~n~Players:_%i~n~map:_area_51~n~VERSION:_%s",GetModeCount(1),WAR_VERSION);
  922. TextDrawSetString(Lobby_TD[18],string);
  923. CancelSelectTextDraw(playerid);
  924. HideLobby(playerid);
  925. }
  926. if(clickedid == Lobby_TD[21])
  927. {
  928. new string[80];
  929. mode[playerid] = 2;
  930. TogglePlayerSpectating(playerid,0);
  931. format(string,sizeof(string),"tdm_game~n~~n~players:_%i~n~map:_lvpd~n~version:_%s",GetModeCount(2),TDM_VERSION);
  932. TextDrawSetString(Lobby_TD[20],string);
  933. CancelSelectTextDraw(playerid);
  934. HideLobby(playerid);
  935. ShowModeTextForPlayer(playerid,2);
  936. switch(random(2))
  937. {
  938. case 0: SetPlayerTeam(playerid,SWAT);
  939. case 1: SetPlayerTeam(playerid,TERRORIST);
  940. }
  941. }
  942. if(clickedid == Lobby_TD[23])
  943. {
  944. new string[84];
  945. mode[playerid] = 3;
  946. TogglePlayerSpectating(playerid,0);
  947. format(string,sizeof(string),"minigun_dm~n~~n~players:_%i~n~map:_stadium~n~version:_%s",GetModeCount(3),MDM_VERSION);
  948. TextDrawSetString(Lobby_TD[22],string);
  949. CancelSelectTextDraw(playerid);
  950. HideLobby(playerid);
  951. SetPlayerTeam(playerid,NO_TEAM);
  952. ShowModeTextForPlayer(playerid,3);
  953. }
  954. }
  955. return 1;
  956. }
  957.  
  958. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  959. {
  960. if(dialogid == DIALOG_REGISTER)
  961. {
  962. new string[176];
  963. if(!response)
  964. {
  965. format(string, sizeof(string),"{FFFF00}Welcome {0080FF}%s, {FFFF00}you are not registered\nPlease enter a password to register your account\n{FF0000}Please Register", GetName(playerid));
  966. return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register",string,"Register","");
  967. }
  968. if (strlen(inputtext) < 4 || strlen(inputtext) > 20)
  969. {
  970. format(string, sizeof(string),"{FFFF00}Welcome {0080FF}%s, {FFFF00}you are not registered\nPlease enter a password to register your account\n{FF0000}Password too short or either long", GetName(playerid));
  971. return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register",string,"Register","");
  972. }
  973. new query[600];
  974. WP_Hash(PlayerInfo[playerid][Pass], 129, inputtext);
  975. mysql_format(mysql, query, sizeof(query), "INSERT INTO `players` (`name`,`Level`, `pass`, `kills`, `deaths`, `cash`, `IP`) VALUES ('%e','0','%e', 0, 0, 0, '%e')", GetName(playerid),PlayerInfo[playerid][Pass],GetIp(playerid));
  976. mysql_tquery(mysql, query, "OnAccountRegister", "d", playerid);
  977. PlayerInfo[playerid][Logged] = 1;
  978. SendClientMessage(playerid, -1, "{FFFF00}[ACCOUNT]: {FFFFFF}Account succesfuly registered.");
  979. PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  980. }
  981. if(dialogid == DIALOG_LOGIN)
  982. {
  983. if(response)
  984. {
  985. new hpass[129],query[126];
  986. WP_Hash(hpass, 129, inputtext);
  987. if(!strcmp(hpass, PlayerInfo[playerid][Pass]))
  988. {
  989. mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `name` = '%e' LIMIT 1", GetName(playerid));
  990. mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
  991. }
  992. else
  993. {
  994. format(query, sizeof(query),"{FFFF00}Welcome {0080FF}%s, {FFFF00}you are already registered\nPlease enter your password to log into your account", GetName(playerid));
  995. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login",query,"Login","");
  996. }
  997. }
  998. else
  999. {
  1000. KickEx(playerid);
  1001. }
  1002. }
  1003. if(dialogid == DIALOG_BANLIST11)
  1004. {
  1005. if(response)
  1006. {
  1007. mysql_format(mysql,global,sizeof(global),"UPDATE `bans` SET `b_name`= '%e' WHERE `bid`= '%d'",inputtext,banrowid[playerid]);
  1008. mysql_tquery(mysql, global,"","");
  1009. format(banrowname[playerid],24,"%s",inputtext);
  1010. SendClientMessage(playerid,-1,"{FFFF00}[BANLIST]: {FFFFFF}Name successfuly changed.");
  1011. }
  1012. }
  1013. if(dialogid == DIALOG_BANLIST10)
  1014. {
  1015. if(response)
  1016. {
  1017. mysql_format(mysql,global,sizeof(global),"UPDATE `bans` SET `b_admin`= '%e' WHERE `bid`= '%d'",inputtext,banrowid[playerid]);
  1018. mysql_tquery(mysql, global,"","");
  1019. SendClientMessage(playerid,-1,"{FFFF00}[BANLIST]: {FFFFFF}Admin's name successfuly changed.");
  1020.  
  1021. }
  1022. }
  1023. if(dialogid == DIALOG_BANLIST9)
  1024. {
  1025. if(response)
  1026. {
  1027. mysql_format(mysql,global,sizeof(global),"UPDATE `bans` SET `b_reason`= '%e' WHERE `bid`= '%d'",inputtext,banrowid[playerid]);
  1028. mysql_tquery(mysql, global,"","");
  1029. SendClientMessage(playerid,-1,"{FFFF00}[BANLIST]: {FFFFFF}Reason successfuly changed.");
  1030. }
  1031. }
  1032. if(dialogid == DIALOG_BANLIST8)
  1033. {
  1034. if(response)
  1035. {
  1036. switch(listitem)
  1037. {
  1038. case 0: ShowPlayerDialog(playerid,DIALOG_BANLIST11, DIALOG_STYLE_INPUT, "Player's Name", "Enter a new name", "Change", "Cancel");
  1039. case 1:
  1040. {
  1041. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"Only level 3 admins can use that feature");
  1042. ShowPlayerDialog(playerid,DIALOG_BANLIST10, DIALOG_STYLE_INPUT, "Admin's Name", "Enter a new admin name", "Change", "Cancel");
  1043. }
  1044. case 2: ShowPlayerDialog(playerid,DIALOG_BANLIST9, DIALOG_STYLE_INPUT, "Reason", "Enter a new reason", "Change", "Cancel");
  1045. }
  1046. }
  1047. }
  1048. if(dialogid == DIALOG_BANLIST5)
  1049. {
  1050. if(response)
  1051. {
  1052. mysql_format(mysql,global, sizeof(global), "SELECT * FROM `bans` WHERE `b_name` = '%e' LIMIT 1",inputtext);
  1053. mysql_tquery(mysql,global, "EditBans", "ds",playerid,inputtext);
  1054. format(banrowname[playerid],24,"%s",inputtext);
  1055. }
  1056. }
  1057. if(dialogid == DIALOG_BANLIST7)
  1058. {
  1059. if(response)
  1060. {
  1061. format(global,sizeof(global),"%s %s",addbaname[playerid], inputtext);
  1062. cmd_offban(playerid,global);
  1063. }
  1064. }
  1065. if(dialogid == DIALOG_BANLIST6)
  1066. {
  1067. if(response)
  1068. {
  1069. format(addbaname[playerid],24,"%s",inputtext);
  1070. ShowPlayerDialog(playerid,DIALOG_BANLIST7, DIALOG_STYLE_INPUT, "Add Ban", "Enter a reason", "Confirm", "Cancel");
  1071. }
  1072. }
  1073. if(dialogid == DIALOG_BANLIST4)
  1074. {
  1075. if(response)
  1076. {
  1077. mysql_format(mysql,global, sizeof(global), "SELECT * FROM `bans` WHERE `b_name` LIKE '%%%s%%' OR `b_ip` LIKE '%%%s%%' ORDER BY `bid` DESC LIMIT 10",inputtext,inputtext);
  1078. mysql_tquery(mysql,global, "GetLastBans", "d",playerid);
  1079. }
  1080. }
  1081. if(dialogid == DIALOG_BANLIST3)
  1082. {
  1083. if(response)
  1084. {
  1085. if(PlayerInfo[playerid][Level] >= 2)
  1086. {
  1087. banrowid[playerid] = LBAN[playerid][listitem];
  1088. format(banrowname2[playerid],24,"%s",LBAN2[playerid][listitem]);
  1089. ShowPlayerDialog(playerid, DIALOG_BANLIST2, DIALOG_STYLE_MSGBOX, "Ban Info", "Would you like to unban that player?", "Unban", "Cancel");
  1090. }
  1091. }
  1092. }
  1093. if(dialogid == DIALOG_BANLIST2)
  1094. {
  1095. if(response)
  1096. {
  1097. mysql_format(mysql, global, sizeof(global),"DELETE FROM `bans` WHERE `bid` = '%d' LIMIT 1",banrowid[playerid]);
  1098. mysql_tquery(mysql, global,"","");
  1099. mysql_format(mysql, global, sizeof(global), "UPDATE `players` SET `Banned`= %d WHERE `b_name`='%e'",0,banrowname2[playerid]);
  1100. mysql_tquery(mysql, global, "QueryComplete", "");
  1101. format(global, sizeof(global),"{FF0000}[BANLIST]: {FFFFFF}You have successfully removed ban id %d",banrowid[playerid]);
  1102. SendClientMessage(playerid,-1,global);
  1103. }
  1104. }
  1105. if(dialogid == DIALOG_BANLIST)
  1106. {
  1107. if(response)
  1108. {
  1109. switch(listitem)
  1110. {
  1111. case 0:
  1112. {
  1113. mysql_format(mysql,global,sizeof(global),"SELECT * FROM `bans` ORDER BY `bid` DESC LIMIT 30");
  1114. mysql_tquery(mysql,global, "GetLastBans", "d",playerid);
  1115. }
  1116. case 1:
  1117. {
  1118. ShowPlayerDialog(playerid,DIALOG_BANLIST4, DIALOG_STYLE_INPUT, "Search Bans", "Enter a name and results will show up", "Search", "Cancel");
  1119. }
  1120. case 2:
  1121. {
  1122. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a level 3!");
  1123. ShowPlayerDialog(playerid,DIALOG_BANLIST5, DIALOG_STYLE_INPUT, "Edit Bans", "Enter a ban name to edit it", "Confirm", "Cancel");
  1124. }
  1125. case 3:
  1126. {
  1127. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a level 3!");
  1128. ShowPlayerDialog(playerid,DIALOG_BANLIST6, DIALOG_STYLE_INPUT, "Add Ban", "Enter a Player's name", "Confirm", "Cancel");
  1129. }
  1130. }
  1131. }
  1132. }
  1133. return 1;
  1134. }
  1135.  
  1136. forward OnAccountLoad(playerid);
  1137. public OnAccountLoad(playerid)
  1138. {
  1139. PlayerInfo[playerid][ID] = cache_get_field_content_int(0, "id");
  1140. PlayerInfo[playerid][Level] = cache_get_field_content_int(0, "Level");
  1141. PlayerInfo[playerid][Kills] = cache_get_field_content_int(0, "kills");
  1142. PlayerInfo[playerid][Deaths] = cache_get_field_content_int(0, "deaths");
  1143. PlayerInfo[playerid][Logged] = 1;
  1144. if(PlayerInfo[playerid][Level] >= 1)
  1145. {
  1146. UpdateAdminList(),UpdateOnlinePlayers();
  1147. TextDrawShowForPlayer(playerid,Lobby_TD[7]),TextDrawShowForPlayer(playerid,Lobby_TD[13]);
  1148. }
  1149. ResetPlayerMoney(playerid);
  1150. SetPlayerScore(playerid,PlayerInfo[playerid][Kills]);
  1151. GivePlayerMoney(playerid,cache_get_field_content_int(0, "cash"));
  1152. SendClientMessage(playerid, -1, "{FF0000}[ACCOUNT]: {FFFFFF}Successfully logged in.");
  1153. return 1;
  1154. }
  1155.  
  1156. public OnPlayerSpawn(playerid)
  1157. {
  1158. if(mode[playerid] == 1)
  1159. {
  1160. SetPlayerPos(playerid, 270.9977,1942.9789,17.6406);
  1161. SetPlayerVirtualWorld(playerid, 0);
  1162. SetPlayerInterior(playerid, 0);
  1163. SetPlayerFacingAngle(playerid,356.5239);
  1164. SetPlayerTeam(playerid,NO_TEAM);
  1165. switch(random(5))
  1166. {
  1167. case 0: SetPlayerSkin(playerid,287);
  1168. case 1: SetPlayerSkin(playerid,285);
  1169. case 2: SetPlayerSkin(playerid,90);
  1170. case 3: SetPlayerSkin(playerid,165);
  1171. case 4: SetPlayerSkin(playerid,166);
  1172. }
  1173. ClearAnimations(playerid);
  1174. }
  1175. else if(mode[playerid] == 2)
  1176. {
  1177. if(GetPlayerTeam(playerid) == SWAT)
  1178. {
  1179. GivePlayerWeapon(playerid,4,1);
  1180. GivePlayerWeapon(playerid,24,20);
  1181. GivePlayerWeapon(playerid,29,300);
  1182. GivePlayerWeapon(playerid,25,100);
  1183. SetPlayerColor(playerid,COLOR_BLUE);
  1184. SendClientMessage(playerid,COLOR_BLUE,"You can buy weapons using /shop");
  1185. switch(random(3))
  1186. {
  1187. case 0: { SetPlayerSkin(playerid,285); }
  1188. case 1: { SetPlayerSkin(playerid,280); }
  1189. case 2: { SetPlayerSkin(playerid,287); }
  1190. }
  1191. SetPlayerPos(playerid,TDM_Map[SwatSpawnX],TDM_Map[SwatSpawnY],TDM_Map[SwatSpawnZ]);
  1192. SetPlayerInterior(playerid,TDM_Map[interior]);
  1193. SetPlayerVirtualWorld(playerid, 1);
  1194. }
  1195. else if(GetPlayerTeam(playerid) == TERRORIST)
  1196. {
  1197. GivePlayerWeapon(playerid,4,1);
  1198. GivePlayerWeapon(playerid,24,60);
  1199. GivePlayerWeapon(playerid,30,250);
  1200. GivePlayerWeapon(playerid,25,110);
  1201. SetPlayerColor(playerid,COLOR_RED);
  1202. SendClientMessage(playerid,COLOR_RED,"You can buy weapons using /shop");
  1203. switch(random(3))
  1204. {
  1205. case 0: { SetPlayerSkin(playerid,126); }
  1206. case 1: { SetPlayerSkin(playerid,125); }
  1207. case 2: { SetPlayerSkin(playerid,108); }
  1208. }
  1209. SetPlayerPos(playerid,TDM_Map[TerrorSpawnX],TDM_Map[TerrorSpawnY],TDM_Map[TerrorSpawnZ]);
  1210. SetPlayerInterior(playerid,TDM_Map[interior]);
  1211. SetPlayerVirtualWorld(playerid, 1);
  1212. }
  1213. }
  1214. else if(mode[playerid] == 3)
  1215. {
  1216. SetPlayerSkin(playerid,287);
  1217. GivePlayerWeapon(playerid,38,99999);
  1218. SetPlayerColor(playerid,RandomColors[random(sizeof(RandomColors))]);
  1219. SetPlayerInterior(playerid,MDM_Map[interior]);
  1220. SetPlayerVirtualWorld(playerid, 2);
  1221. switch(random(3))
  1222. {
  1223. case 0: SetPlayerPos(playerid,MDM_Map[Spawn1X],MDM_Map[Spawn1Y],MDM_Map[Spawn1Z]);
  1224. case 1: SetPlayerPos(playerid,MDM_Map[Spawn2X],MDM_Map[Spawn2Y],MDM_Map[Spawn2Z]);
  1225. case 2: SetPlayerPos(playerid,MDM_Map[Spawn3X],MDM_Map[Spawn3Y],MDM_Map[Spawn3Z]);
  1226. }
  1227. }
  1228. return 1;
  1229. }
  1230.  
  1231. public OnTextMenuResponse(playerid,menuid,listitem)
  1232. {
  1233. if(menuid == MENU_SHOP)
  1234. {
  1235. switch(listitem)
  1236. {
  1237. case 1:
  1238. {
  1239. static Pistols[350],bool:form = true;
  1240. if(form)
  1241. {
  1242. strcat(Pistols," ~r~1-~w~ Desert Eagle (~g~$1500~w~)~n~");
  1243. strcat(Pistols," ~r~2-~w~ Silenced Pistol (~g~$800~w~)~n~");
  1244. strcat(Pistols," ~r~3-~w~ Colt-45 (~g~$500~w~)");
  1245. form = false;
  1246. }
  1247. TextMenuShowForPlayer(playerid,MENU_PISTOLS,"Pistols",Pistols,3);
  1248. }
  1249. case 2:
  1250. {
  1251. static sMachines[350],bool:form = true;
  1252. if(form)
  1253. {
  1254. strcat(sMachines," ~r~1-~w~ MP5 (~g~$3000~w~)~n~");
  1255. strcat(sMachines," ~r~2-~w~ Tec-9 (~g~$1500~w~)~n~");
  1256. strcat(sMachines," ~r~3-~w~ UZI (~g~$1500~w~)");
  1257. form = false;
  1258. }
  1259. TextMenuShowForPlayer(playerid,MENU_SMACHINE,"Sub-Machine Guns",sMachines,3);
  1260. }
  1261. case 3:
  1262. {
  1263. static Shotguns[350],bool:form = true;
  1264. if(form)
  1265. {
  1266. strcat(Shotguns," ~r~1-~w~ Combat Shotgun (~g~$5000~w~)~n~");
  1267. strcat(Shotguns," ~r~2-~w~ Sawn-Off (~g~$3500~w~)~n~");
  1268. strcat(Shotguns," ~r~3-~w~ Shotgun (~g~$2500~w~)");
  1269. form = false;
  1270. }
  1271. TextMenuShowForPlayer(playerid,MENU_SHOTGUNS,"Shotguns",Shotguns,3);
  1272. }
  1273. case 4:
  1274. {
  1275. static AssaultRifles[220],bool:form = true;
  1276. if(form)
  1277. {
  1278. strcat(AssaultRifles," ~r~1-~w~ M4 (~g~$4000~w~)~n~");
  1279. strcat(AssaultRifles," ~r~2-~w~ AK-47 (~g~$3500~w~)~n~");
  1280. form = false;
  1281. }
  1282. TextMenuShowForPlayer(playerid,MENU_ARIFLES,"Assault Rifles",AssaultRifles,2);
  1283. }
  1284. case 5:
  1285. {
  1286. static Rifles[220],bool:rif = true;
  1287. if(rif)
  1288. {
  1289. strcat(Rifles," ~r~1-~w~ Sniper Rifle (~g~$4500~w~)~n~");
  1290. strcat(Rifles," ~r~2-~w~ Country Rifle (~g~$2000~w~)~n~");
  1291. rif = false;
  1292. }
  1293. TextMenuShowForPlayer(playerid,MENU_RIFLES,"Rifles",Rifles,2);
  1294. }
  1295. }
  1296. }
  1297. if(menuid == MENU_PISTOLS)
  1298. {
  1299. switch(listitem)
  1300. {
  1301. case 1:
  1302. {
  1303. if(GetPlayerMoney(playerid) < 1500) return ERROR(playerid,"You need $1500 in order to buy this weapon.");
  1304. GivePlayerMoney(playerid,-1500);
  1305. GivePlayerWeapon(playerid,24,100);
  1306. }
  1307. case 2:
  1308. {
  1309. if(GetPlayerMoney(playerid) < 800) return ERROR(playerid,"You need $800 in order to buy this weapon.");
  1310. GivePlayerMoney(playerid,-800);
  1311. GivePlayerWeapon(playerid,23,100);
  1312. }
  1313. case 3:
  1314. {
  1315. if(GetPlayerMoney(playerid) < 500) return ERROR(playerid,"You need $500 in order to buy this weapon.");
  1316. GivePlayerMoney(playerid,-500);
  1317. GivePlayerWeapon(playerid,22,100);
  1318. }
  1319. }
  1320. }
  1321. if(menuid == MENU_SMACHINE)
  1322. {
  1323. switch(listitem)
  1324. {
  1325. case 1:
  1326. {
  1327. if(GetPlayerMoney(playerid) < 3000) return ERROR(playerid,"You need $3000 in order to buy this weapon.");
  1328. GivePlayerMoney(playerid,-3000);
  1329. GivePlayerWeapon(playerid,29,150);
  1330. }
  1331. case 2:
  1332. {
  1333. if(GetPlayerMoney(playerid) < 1500) return ERROR(playerid,"You need $1500 in order to buy this weapon.");
  1334. GivePlayerMoney(playerid,-1500);
  1335. GivePlayerWeapon(playerid,32,200);
  1336. }
  1337. case 3:
  1338. {
  1339. if(GetPlayerMoney(playerid) < 1500) return ERROR(playerid,"You need $1500 in order to buy this weapon.");
  1340. GivePlayerMoney(playerid,-1500);
  1341. GivePlayerWeapon(playerid,28,200);
  1342. }
  1343. }
  1344. }
  1345. if(menuid == MENU_SHOTGUNS)
  1346. {
  1347. switch(listitem)
  1348. {
  1349. case 1:
  1350. {
  1351. if(GetPlayerMoney(playerid) < 5000) return ERROR(playerid,"You need $5000 in order to buy this weapon.");
  1352. GivePlayerMoney(playerid,-5000);
  1353. GivePlayerWeapon(playerid,27,150);
  1354. }
  1355. case 2:
  1356. {
  1357. if(GetPlayerMoney(playerid) < 3500) return ERROR(playerid,"You need $3500 in order to buy this weapon.");
  1358. GivePlayerMoney(playerid,-3500);
  1359. GivePlayerWeapon(playerid,26,200);
  1360. }
  1361. case 3:
  1362. {
  1363. if(GetPlayerMoney(playerid) < 2500) return ERROR(playerid,"You need $2500 in order to buy this weapon.");
  1364. GivePlayerMoney(playerid,-2500);
  1365. GivePlayerWeapon(playerid,25,200);
  1366. }
  1367. }
  1368. }
  1369. if(menuid == MENU_ARIFLES)
  1370. {
  1371. switch(listitem)
  1372. {
  1373. case 1:
  1374. {
  1375. if(GetPlayerMoney(playerid) < 4000) return ERROR(playerid,"You need $4000 in order to buy this weapon.");
  1376. GivePlayerMoney(playerid,-4000);
  1377. GivePlayerWeapon(playerid,31,250);
  1378. }
  1379. case 2:
  1380. {
  1381. if(GetPlayerMoney(playerid) < 3500) return ERROR(playerid,"You need $3500 in order to buy this weapon.");
  1382. GivePlayerMoney(playerid,-3500);
  1383. GivePlayerWeapon(playerid,30,200);
  1384. }
  1385. }
  1386. }
  1387. if(menuid == MENU_RIFLES)
  1388. {
  1389. switch(listitem)
  1390. {
  1391. case 1:
  1392. {
  1393. if(GetPlayerMoney(playerid) < 4500) return ERROR(playerid,"You need $4500 in order to buy this weapon.");
  1394. GivePlayerMoney(playerid,-4500);
  1395. GivePlayerWeapon(playerid,34,90);
  1396. }
  1397. case 2:
  1398. {
  1399. if(GetPlayerMoney(playerid) < 2000) return ERROR(playerid,"You need $2000 in order to buy this weapon.");
  1400. GivePlayerMoney(playerid,-2000);
  1401. GivePlayerWeapon(playerid,33,70);
  1402. }
  1403. }
  1404. }
  1405. if(menuid == MENU_CMDS)
  1406. {
  1407. switch(listitem)
  1408. {
  1409. case 1:
  1410. {
  1411. static CS[350],bool:form = true;
  1412. if(form)
  1413. {
  1414. strcat(CS," /report~n~");
  1415. strcat(CS," /savestats~n~");
  1416. strcat(CS," /changemode~n~");
  1417. strcat(CS," /rules~n~");
  1418. strcat(CS," /admins~n~");
  1419. strcat(CS," /credits~n~");
  1420. strcat(CS," /stats~n~");
  1421. form = false;
  1422. }
  1423. TextMenuShowForPlayer(playerid,MENU_CMDS,"General Commands",CS);
  1424. }
  1425. case 2:
  1426. {
  1427. TextMenuShowForPlayer(playerid,MENU_CMDS,"War Mode"," /shop~n~ /kill");
  1428. }
  1429. case 3:
  1430. {
  1431. TextMenuShowForPlayer(playerid,MENU_CMDS,"TDM Mode"," /shop~n~ /kill");
  1432. }
  1433. case 4:
  1434. {
  1435. TextMenuShowForPlayer(playerid,MENU_CMDS,"Minigun DM Mode"," /kill");
  1436. }
  1437. }
  1438. }
  1439. return 1;
  1440. }
  1441.  
  1442. public OnPlayerText(playerid, text[])
  1443. {
  1444. switch(mode[playerid])
  1445. {
  1446. case 1:
  1447. {
  1448. format(global,sizeof(global),"{00FF00}[WAR]{%06x}%s{FFFFFF}(%d): %s",GetPlayerColor(playerid) >>> 8,GetName(playerid),playerid, text);
  1449. SendClientMessageToAll(GetPlayerColor(playerid),global);
  1450. }
  1451. case 2:
  1452. {
  1453. format(global,sizeof(global),"{FFFF00}[TDM]{%06x}%s{FFFFFF}(%d): %s",GetPlayerColor(playerid) >>> 8,GetName(playerid),playerid, text);
  1454. SendClientMessageToAll(GetPlayerColor(playerid),global);
  1455. }
  1456. case 3:
  1457. {
  1458. format(global,sizeof(global),"{E5E4E2}[MDM]{%06x}%s{FFFFFF}(%d): %s",GetPlayerColor(playerid) >>> 8,GetName(playerid),playerid, text);
  1459. SendClientMessageToAll(GetPlayerColor(playerid),global);
  1460. }
  1461. default:
  1462. {
  1463. format(global,sizeof(global),"{FFFFFF}[LOBBY]{%06x}%s{FFFFFF}(%d): %s",GetPlayerColor(playerid) >>> 8,GetName(playerid),playerid, text);
  1464. SendClientMessageToAll(GetPlayerColor(playerid),global);
  1465. }
  1466. }
  1467. return 0;
  1468. }
  1469.  
  1470. forward OnAccountUnban(playerid,tar[]);
  1471. public OnAccountUnban(playerid,tar[])
  1472. {
  1473. new rows, fields;
  1474. cache_get_data(rows, fields, mysql);
  1475. if(rows)
  1476. {
  1477. new Query[200];
  1478. mysql_format(mysql, Query, sizeof(Query),"DELETE FROM `bans` WHERE `b_name` = '%e' or `b_ip` ='%e' LIMIT 1",tar,tar);
  1479. mysql_tquery(mysql, Query,"","");
  1480. format(global, sizeof(global),"{00FF00}[UNBAN]: {FFFFFF}You have successfully unbanned account/ip %s",tar);
  1481. SendClientMessage(playerid,-1,global);
  1482. }
  1483. else
  1484. {
  1485. ERROR(playerid,"No such ban found.");
  1486. }
  1487. return 1;
  1488. }
  1489.  
  1490. forward OnAccountBan(playerid,target[],offreason[]);
  1491. public OnAccountBan(playerid,target[],offreason[])
  1492. {
  1493. new zcount=0,raw = cache_get_row_count(),ggwzd[20],Query[200];
  1494. for(new i=0; i < raw; i ++ )
  1495. {
  1496. zcount++;
  1497. cache_get_field_content(i,"IP",ggwzd,mysql,20);
  1498. }
  1499. if(zcount == 0) return ERROR(playerid,"No such account found.");
  1500. new tima[80];
  1501. new Year, Month, Day;
  1502. getdate(Year, Month, Day);
  1503. new Hour, Minute, Second;
  1504. gettime(Hour, Minute, Second);
  1505. format(tima,sizeof(tima),"%d/%d/%d | %d:%d",Day,Month,Year,Hour,Minute);
  1506. mysql_format(mysql, Query, sizeof(Query), "INSERT INTO `bans` (`b_name`,`b_ip`,`b_admin`,`b_reason`,`b_time`) VALUES ('%s','%s','%s','%s','%s')",target,ggwzd,GetName(playerid),offreason,tima);
  1507. mysql_tquery(mysql, Query,"","");
  1508. format(global,sizeof(global),"{FFFF00}[OFF-BAN]: {FFFFFF}You have offline-banned %s [Reason: %s]", target, offreason );
  1509. SendClientMessage(playerid,-1,global);
  1510. return 1;
  1511. }
  1512.  
  1513. forward GetLastBans(playerid);
  1514. public GetLastBans(playerid)
  1515. {
  1516. new count,raw = cache_get_row_count(),lastbans[1000],Gn[MAX_PLAYER_NAME],AdminB[MAX_PLAYER_NAME],bTime[30],bReason[50];
  1517. format(lastbans, sizeof(lastbans),"{FFFFFF}Name\t{FFFFFF}Admin\t{FFFFFF}Date\t{FFFFFF}Reason\n");
  1518. for(new i=0; i < raw; i ++ )
  1519. {
  1520. LBAN[playerid][count] = cache_get_field_content_int(i,"bid");
  1521. cache_get_field_content(i,"b_name",Gn,mysql,MAX_PLAYER_NAME);
  1522. format(LBAN2[playerid][count],24,"%s",Gn);
  1523. cache_get_field_content(i,"b_admin",AdminB,mysql,MAX_PLAYER_NAME);
  1524. cache_get_field_content(i,"b_time",bTime,mysql,30);
  1525. cache_get_field_content(i,"b_reason",bReason,mysql,50);
  1526. format(lastbans, sizeof(lastbans), "%s\n%s\t%s\t%s\t%s", lastbans, Gn, AdminB, bTime, bReason);
  1527. count++;
  1528. }
  1529. ShowPlayerDialog(playerid, DIALOG_BANLIST3, DIALOG_STYLE_TABLIST_HEADERS, "Ban List", lastbans, "Select", "Cancel");
  1530. }
  1531.  
  1532. forward EditBans(playerid,editname);
  1533. public EditBans(playerid,editname)
  1534. {
  1535. new zcount = 0,raw = cache_get_row_count(),LittleString[90],Gn[24];
  1536. format(LittleString,sizeof(LittleString),"You are editing %s's ban",editname);
  1537. for(new i=0; i < raw; i ++ )
  1538. {
  1539. zcount++;
  1540. cache_get_field_content(i,"b_admin",Gn,mysql,MAX_PLAYER_NAME);
  1541. banrowid[playerid] = cache_get_field_content_int(i,"bid");
  1542. format(banrowname2[playerid],24,"%s",Gn);
  1543. }
  1544. if(zcount == 0) return SendClientMessage(playerid,-1,"Error: there is no such ban!");
  1545. ShowPlayerDialog(playerid, DIALOG_BANLIST8, DIALOG_STYLE_LIST, LittleString,"Player's Name\nAdmin's Name\nReason", "Continue","Close");
  1546. return 1;
  1547. }
  1548.  
  1549. /*Functions*/
  1550. UpdateOnlinePlayers()
  1551. {
  1552. new count,acount,str[77];
  1553. foreach(new i: Player)
  1554. {
  1555. ++count;
  1556. if(PlayerInfo[i][Level] >= 1)
  1557. {
  1558. ++acount;
  1559. }
  1560. }
  1561. format(str,sizeof(str),"__%s~n~~n~-Players:_%i/%i~n~-Admins:_%i~n~-Modes:_3",YOUR_WEB,count,GetMaxPlayers(),acount);
  1562. TextDrawSetString(Lobby_TD[13],str);
  1563. }
  1564.  
  1565. SavePlayer(playerid)
  1566. {
  1567. if(PlayerInfo[playerid][Logged] == 1)
  1568. {
  1569. new query[256];
  1570. mysql_format(mysql, query, sizeof(query),"UPDATE `players` SET `kills`='%d', `deaths`='%d', `cash`='%d', `Level`='%d' WHERE `name` = '%e'",PlayerInfo[playerid][Kills],PlayerInfo[playerid][Deaths],GetPlayerMoney(playerid),PlayerInfo[playerid][Level],GetName(playerid));
  1571. mysql_tquery(mysql, query, "", "");
  1572. }
  1573. }
  1574.  
  1575. GetIp(playerid)
  1576. {
  1577. new ip[16];
  1578. GetPlayerIp(playerid, ip, 16);
  1579. return ip;
  1580. }
  1581.  
  1582. ERROR(playerid,msg[])
  1583. {
  1584. new somestring[128];
  1585. format(somestring,128,"{FF0000}[ERROR]:{FFFFFF} %s",msg);
  1586. return SendClientMessage(playerid,-1,somestring);
  1587. }
  1588.  
  1589. GetName(playerid)
  1590. {
  1591. new return_[MAX_PLAYER_NAME];
  1592. GetPlayerName(playerid,return_,sizeof(return_));
  1593. return return_;
  1594. }
  1595.  
  1596. UpdateAdminList()
  1597. {
  1598. new string[145];
  1599. foreach(new i: Player)
  1600. {
  1601. if(PlayerInfo[i][Level] >= 1)
  1602. {
  1603. format(string,sizeof(string),"%s-%s~n~",string,GetName(i));
  1604. }
  1605. }
  1606. TextDrawSetString(Lobby_TD[7],string);
  1607. }
  1608.  
  1609. ShowLobby(playerid)
  1610. {
  1611. for(new i = 0; i < sizeof(Lobby_TD); i++)
  1612. {
  1613. TextDrawShowForPlayer(playerid,Lobby_TD[i]);
  1614. }
  1615. }
  1616.  
  1617. ShowModeTextForPlayer(playerid,modeid)
  1618. {
  1619. switch(modeid)
  1620. {
  1621. case 2:
  1622. {
  1623. TextDrawShowForPlayer(playerid,Mode_Text[7]);
  1624. TextDrawShowForPlayer(playerid,Mode_Text[6]);
  1625. TextDrawShowForPlayer(playerid,Mode_Text[5]);
  1626. TextDrawShowForPlayer(playerid,Mode_Text[4]);
  1627. TextDrawShowForPlayer(playerid,Mode_Text[3]);
  1628. TextDrawShowForPlayer(playerid,Mode_Text[2]);
  1629. TextDrawShowForPlayer(playerid,Mode_Text[1]);
  1630. TextDrawShowForPlayer(playerid,Mode_Text[0]);
  1631. }
  1632. case 3:
  1633. {
  1634. TextDrawShowForPlayer(playerid,Mode_Two[1]);
  1635. TextDrawShowForPlayer(playerid,Mode_Two[0]);
  1636. TextDrawShowForPlayer(playerid,Mode_Text[5]);
  1637. TextDrawShowForPlayer(playerid,Mode_Text[2]);
  1638. TextDrawShowForPlayer(playerid,Mode_Text[1]);
  1639. TextDrawShowForPlayer(playerid,Mode_Text[0]);
  1640. }
  1641. }
  1642. }
  1643.  
  1644. HideModeTextForPlayer(playerid,modeid)
  1645. {
  1646. switch(modeid)
  1647. {
  1648. case 2:
  1649. {
  1650. TextDrawHideForPlayer(playerid,Mode_Text[7]);
  1651. TextDrawHideForPlayer(playerid,Mode_Text[6]);
  1652. TextDrawHideForPlayer(playerid,Mode_Text[5]);
  1653. TextDrawHideForPlayer(playerid,Mode_Text[4]);
  1654. TextDrawHideForPlayer(playerid,Mode_Text[3]);
  1655. TextDrawHideForPlayer(playerid,Mode_Text[2]);
  1656. TextDrawHideForPlayer(playerid,Mode_Text[1]);
  1657. TextDrawHideForPlayer(playerid,Mode_Text[0]);
  1658. }
  1659. case 3:
  1660. {
  1661. TextDrawHideForPlayer(playerid,Mode_Two[1]);
  1662. TextDrawHideForPlayer(playerid,Mode_Two[0]);
  1663. TextDrawHideForPlayer(playerid,Mode_Text[5]);
  1664. TextDrawHideForPlayer(playerid,Mode_Text[2]);
  1665. TextDrawHideForPlayer(playerid,Mode_Text[1]);
  1666. TextDrawHideForPlayer(playerid,Mode_Text[0]);
  1667. }
  1668. }
  1669. }
  1670.  
  1671. HideLobby(playerid)
  1672. {
  1673. for(new i = 0; i < sizeof(Lobby_TD); i++)
  1674. {
  1675. TextDrawHideForPlayer(playerid,Lobby_TD[i]);
  1676. }
  1677. }
  1678.  
  1679. TextDrawShowForMode(modeid,Text:drawid)
  1680. {
  1681. foreach(new i: Player)
  1682. {
  1683. if(mode[i] == modeid)
  1684. {
  1685. TextDrawShowForPlayer(i,drawid);
  1686. }
  1687. }
  1688. }
  1689.  
  1690. ResetDraws()
  1691. {
  1692. new string[83];
  1693. format(string,sizeof(string),"WAR_GAME~n~~n~Players:_%i~n~map:_AREA_51~n~VERSION:_%s",GetModeCount(1),WAR_VERSION);
  1694. TextDrawSetString(Lobby_TD[18],string);
  1695. format(string,sizeof(string),"tdm_game~n~~n~players:_%i~n~map:_%s~n~version:_%s",GetModeCount(2),TDM_Map[MapName],TDM_VERSION);
  1696. TextDrawSetString(Lobby_TD[20],string);
  1697. format(string,sizeof(string),"minigun_dm~n~~n~players:_%i~n~map:_%s~n~version:_%s",GetModeCount(3),MDM_Map[MapName],MDM_VERSION);
  1698. TextDrawSetString(Lobby_TD[22],string);
  1699. }
  1700.  
  1701. KickEx(playerid)
  1702. {
  1703. SetTimerEx("DelayedKick", 1000, false, "i", playerid);
  1704. }
  1705.  
  1706. GetModeCount(modeid)
  1707. {
  1708. new count;
  1709. foreach(new j: Player)
  1710. {
  1711. if(mode[j] == modeid)
  1712. {
  1713. ++count;
  1714. }
  1715. }
  1716. return count;
  1717. }
  1718.  
  1719. BanPlayer(admin[],id,resa[])
  1720. {
  1721. SetPlayerPos(id,197.6661,173.8179,1003.0234);
  1722. SetPlayerInterior(id,3);
  1723. SetCameraBehindPlayer(id);
  1724. new Year, Month, Day,tima[80],Query[600],Hour, Minute, Second;
  1725. getdate(Year, Month, Day);
  1726. gettime(Hour, Minute, Second);
  1727. format(tima,sizeof(tima),"%d/%d/%d | %02d:%02d",Day,Month,Year,Hour,Minute);
  1728. mysql_format(mysql, Query, sizeof(Query), "INSERT INTO `bans` (`b_name`,`b_ip`,`b_admin`,`b_reason`,`b_time`) VALUES ('%s','%s','%s','%s','%s')",GetName(id),GetIp(id),admin,resa,tima);
  1729. mysql_tquery(mysql, Query,"","");
  1730. KickEx(id);
  1731. return 1;
  1732. }
  1733.  
  1734. GetPlayerAdmin(playerid)
  1735. {
  1736. new rankname[17];
  1737. switch(PlayerInfo[playerid][Level])
  1738. {
  1739. case 1: rankname = "~b~Moderator";
  1740. case 2: rankname = "~g~Administrator";
  1741. case 3: rankname = "~p~Manager";
  1742. case 4: rankname = "~r~Owner";
  1743. }
  1744. return rankname;
  1745. }
  1746.  
  1747. /*Commands*/
  1748. CMD:changemode(playerid)
  1749. {
  1750. TogglePlayerSpectating(playerid,1);
  1751. SelectTextDraw(playerid, 0xFF4040AA);
  1752. HideModeTextForPlayer(playerid,mode[playerid]);
  1753. mode[playerid] = 0;
  1754. SetPlayerInterior(playerid,0);
  1755. ShowLobby(playerid);
  1756. return 1;
  1757. }
  1758.  
  1759. CMD:shop(playerid)
  1760. {
  1761. if(mode[playerid] == 3) return ERROR(playerid,"You can't use this command in the mode you are playing at.");
  1762. static Shop[350],bool:form = true;
  1763. if(form)
  1764. {
  1765. strcat(Shop," ~r~1-~w~ Pistols~n~");
  1766. strcat(Shop," ~r~2-~w~ Sub-Machine Guns~n~");
  1767. strcat(Shop," ~r~3-~w~ Shotguns~n~");
  1768. strcat(Shop," ~r~4-~w~ Assault Rifles~n~");
  1769. strcat(Shop," ~r~5-~w~ Rifles~n~");
  1770. form = false;
  1771. }
  1772. TextMenuShowForPlayer(playerid,MENU_SHOP,"Shop",Shop,5);
  1773. return 1;
  1774. }
  1775.  
  1776. CMD:commands(playerid)
  1777. {
  1778. static CS[132],bool:form = true;
  1779. if(form)
  1780. {
  1781. strcat(CS," ~y~1-~w~ General Commands~n~");
  1782. strcat(CS," ~y~2-~w~ War Mode~n~");
  1783. strcat(CS," ~y~3-~w~ TDM Mode~n~");
  1784. strcat(CS," ~y~4-~w~ Minigun DM Mode~n~");
  1785. form = false;
  1786. }
  1787. TextMenuShowForPlayer(playerid,MENU_CMDS,"Commands",CS,4);
  1788. return 1;
  1789. }
  1790.  
  1791. CMD:cmds(playerid) return cmd_commands(playerid);
  1792.  
  1793. CMD:credits(playerid)
  1794. {
  1795. TextMenuShowForPlayer(playerid,MENU_CMDS,"Credits","~y~ Developer: ~w~Jelly23");
  1796. return 1;
  1797. }
  1798.  
  1799. CMD:stats(playerid)
  1800. {
  1801. new Stats[210];
  1802. format(Stats,sizeof(Stats)," ~y~Name: ~w~%s~n~ ~y~Admin Level: ~w~%i~n~ ~y~Cash: ~g~$%i~n~ ~y~Kills: ~w~%i~n~ ~y~Deaths: ~w~%i~n~",
  1803. GetName(playerid),PlayerInfo[playerid][Level],GetPlayerMoney(playerid),PlayerInfo[playerid][Kills],PlayerInfo[playerid][Deaths]);
  1804. TextMenuShowForPlayer(playerid,MENU_CMDS,"Statistics",Stats);
  1805. return 1;
  1806. }
  1807.  
  1808. CMD:rules(playerid)
  1809. {
  1810. static Rules[350],bool:form = true;
  1811. if(form)
  1812. {
  1813. strcat(Rules," ~y~1-~w~ Respect admins/players~n~");
  1814. strcat(Rules," ~y~2-~w~ Cheating/Hacking will lead to a ban~n~");
  1815. strcat(Rules," ~y~3-~w~ You may not ask for score/cash/level~n~");
  1816. strcat(Rules," ~y~4-~w~ You may not abuse bugs, report them~n~");
  1817. strcat(Rules," ~y~5-~w~ C-Bug isn't allowed here~n~");
  1818. strcat(Rules," ~y~6-~w~ You may not disturb admins~n~");
  1819. strcat(Rules," ~y~7-~w~ Banned? Do not evade, appeal at forums~n~");
  1820. strcat(Rules," ~y~8-~w~ Racism isn't tolerated in here");
  1821. form = false;
  1822. }
  1823. TextMenuShowForPlayer(playerid,MENU_CMDS,"Rules",Rules);
  1824. return 1;
  1825. }
  1826.  
  1827. CMD:savestats(playerid)
  1828. {
  1829. SavePlayer(playerid);
  1830. SendClientMessage(playerid,-1,"{FFFF00}[STATS]: {FFFFFF}Stats saved!");
  1831. return 1;
  1832. }
  1833.  
  1834. CMD:kill(playerid)
  1835. {
  1836. SetPlayerHealth(playerid,0);
  1837. SendClientMessage(playerid,-1,"{FF0000}[SUICIDE]: {FFFFFF}You killed yourself");
  1838. return 1;
  1839. }
  1840.  
  1841. CMD:admins(playerid)
  1842. {
  1843. new admins[1500],count;
  1844. foreach(new i: Player)
  1845. {
  1846. if(PlayerInfo[i][Level] >= 1)
  1847. {
  1848. count++;
  1849. format(admins,sizeof(admins)," ~y~%s-_%s(%d)_-_%s~n~",admins,GetName(i),i,GetPlayerAdmin(i));
  1850. }
  1851. }
  1852. if(count == 0)
  1853. {
  1854. admins = " No ~r~admins ~w~online right now";
  1855. }
  1856. TextMenuShowForPlayer(playerid,MENU_CMDS,"Admins",admins);
  1857. return 1;
  1858. }
  1859.  
  1860. CMD:acmds(playerid)
  1861. {
  1862. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1863. static ACMDS[350],bool:form = true;
  1864. if(form)
  1865. {
  1866. strcat(ACMDS," ~b~Level 1:~w~ /warn /kick /spec /specoff /spawn /slap~n~");
  1867. strcat(ACMDS," ~g~Level 2:~w~ /banlist /ban /unban /weaps /disarm /giveallcash~n~");
  1868. strcat(ACMDS," ~p~Level 3:~w~ /offban /setlevel /setkills /setdeaths /resetcash~n~");
  1869. strcat(ACMDS," ~r~Level 4:~w~ /setweather /settime /gmx /setcash~n~");
  1870. form = false;
  1871. }
  1872. TextMenuShowForPlayer(playerid,MENU_CMDS,"Admin Commands",ACMDS);
  1873. return 1;
  1874. }
  1875.  
  1876. CMD:warn(playerid, params[])
  1877. {
  1878. new id, reason[24];
  1879. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1880. if(sscanf(params, "us[24]", id, reason)) return SendClientMessage(playerid, -1, "USAGE: /warn [playerid] [reason]");
  1881. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1882. format(global, sizeof(global), "{FF0000}[WARN]: %s has been warned by %s [Reason: %s]", GetName(id), GetName(playerid), reason);
  1883. SendClientMessageToAll(-1, global);
  1884. return 1;
  1885. }
  1886.  
  1887. CMD:kick(playerid, params[])
  1888. {
  1889. new id, reason[24];
  1890. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1891. if(sscanf(params, "us[24]", id, reason)) return SendClientMessage(playerid, -1, "USAGE: /kick [playerid] [reason]");
  1892. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1893. format(global, sizeof(global), "{FF0000}[KICK]: %s has been kicked by %s [Reason: %s]", GetName(id), GetName(playerid), reason);
  1894. SendClientMessageToAll(-1, global);
  1895. KickEx(id);
  1896. return 1;
  1897. }
  1898.  
  1899. CMD:spec(playerid, params[])
  1900. {
  1901. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1902. new id;
  1903. if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /spec [playerid]");
  1904. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1905. if(IsPlayerInAnyVehicle(id))
  1906. {
  1907. SetPlayerInterior(playerid, GetPlayerInterior(id));
  1908. TogglePlayerSpectating(playerid, 1);
  1909. PlayerSpectateVehicle(playerid, GetPlayerVehicleID(id));
  1910. }
  1911. else
  1912. {
  1913. SetPlayerInterior(playerid, GetPlayerInterior(id));
  1914. TogglePlayerSpectating(playerid, 1);
  1915. PlayerSpectatePlayer(playerid, id);
  1916. }
  1917. return 1;
  1918. }
  1919.  
  1920. CMD:specoff(playerid)
  1921. {
  1922. if(PlayerInfo[playerid][Level] == 0) return 0;
  1923. TogglePlayerSpectating(playerid, 0);
  1924. SpawnPlayer(playerid);
  1925. return 1;
  1926. }
  1927.  
  1928. CMD:spawn(playerid, params[])
  1929. {
  1930. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1931. new id;
  1932. if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /spawn [playerid]");
  1933. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1934. SpawnPlayer(id);
  1935. format(global,sizeof(global),"{FFFF00}[SPAWN]: {FFFFFF}You have spawned '%s'",GetName(id));
  1936. SendClientMessage(playerid,-1,global);
  1937. format(global,sizeof(global),"{FFFF00}[SPAWN]: {FFFFFF}You have been spawned by '%s'",GetName(playerid));
  1938. SendClientMessage(id,-1,global);
  1939. return 1;
  1940. }
  1941.  
  1942. CMD:slap(playerid, params[])
  1943. {
  1944. if(PlayerInfo[playerid][Level] < 1) return ERROR(playerid,"You must be a moderator to use this command.");
  1945. new Float:xPos[3],id;
  1946. if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /slap [playerid]");
  1947. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1948. GetPlayerPos(id,xPos[0],xPos[1],xPos[2]);
  1949. SetPlayerPos(id,xPos[0],xPos[1],xPos[2]+7);
  1950. format(global,sizeof(global),"{FFFF00}[SLAP]: {FFFFFF}You have slapped '%s'",GetName(id));
  1951. SendClientMessage(playerid,-1,global);
  1952. format(global,sizeof(global),"{FFFF00}[SLAP]: {FFFFFF}You have been slapped by '%s'",GetName(playerid));
  1953. SendClientMessage(id,-1,global);
  1954. return 1;
  1955. }
  1956.  
  1957. CMD:ban(playerid,params[])
  1958. {
  1959. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be an administrator to use this command.");
  1960. new id, reason[50];
  1961. if(sscanf(params, "us[50]", id, reason)) return SendClientMessage(playerid,-1,"USAGE: /ban [playerid] [reason]");
  1962. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  1963. if(PlayerInfo[playerid][Level] <= PlayerInfo[id][Level]) return ERROR(playerid,"You can't ban that player.");
  1964. format(global, sizeof(global), "{FF0000}[BAN]: {FFFFFF}%s has been banned by %s [Reason: %s]", GetName(id), GetName(playerid), reason);
  1965. SendClientMessageToAll(-1, global);
  1966. BanPlayer(GetName(playerid),id,reason);
  1967. return 1;
  1968. }
  1969.  
  1970. CMD:unban(playerid, params[])
  1971. {
  1972. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be an administrator to use this command.");
  1973. new target[50];
  1974. if(sscanf(params,"s[50]", target)) return SendClientMessage(playerid,-1,"USAGE: /unban [name]");
  1975. mysql_format(mysql, global, sizeof(global),"SELECT * FROM `bans` WHERE `b_name` ='%e' OR `b_ip` ='%e' LIMIT 1",target,target);
  1976. mysql_tquery(mysql, global,"OnAccountUnban","ds",playerid,target);
  1977. return 1;
  1978. }
  1979.  
  1980. CMD:weaps(playerid, params[])
  1981. {
  1982. if(PlayerInfo[playerid][Level] >= 2)
  1983. {
  1984. new count = 0;
  1985. new ammo, weaponid, weapon[30], string26[150], id;
  1986. if(!sscanf(params, "u", id))
  1987. {
  1988. for (new c = 0; c < 13; c++)
  1989. {
  1990. GetPlayerWeaponData(id, c, weaponid, ammo);
  1991. if (weaponid != 0 && ammo != 0)
  1992. {
  1993. count++;
  1994. }
  1995. }
  1996. SendClientMessage(playerid, -1, "||{FF8000}============={FFFF00} Weapons And Ammo {FF8000}===========||");
  1997. if(count > 0)
  1998. {
  1999. for (new c = 0; c < 13; c++)
  2000. {
  2001. GetPlayerWeaponData(id, c, weaponid, ammo);
  2002. if (weaponid != 0 && ammo != 0)
  2003. {
  2004. GetWeaponName(weaponid, weapon, 24);
  2005. format(string26, sizeof(string26), "{00FF00}Weapons: {A8FFA8}%s {FF0000}.:. {00FF00}Ammo: {A8FFA8}%d", weapon, ammo);
  2006. SendClientMessage(playerid, -1, string26);
  2007. }
  2008. }
  2009. }
  2010. else
  2011. {
  2012. ERROR(playerid,"This player has no weapons.");
  2013. }
  2014. return 1;
  2015. }
  2016. else return SendClientMessage(playerid, -1, "USAGE: /weaps [id]");
  2017. }
  2018. else return ERROR(playerid,"You must be an administrator to use this command.");
  2019. }
  2020.  
  2021. CMD:disarm(playerid, params[])
  2022. {
  2023. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be an administrator to use this command.");
  2024. new id;
  2025. if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /disarm [playerid]");
  2026. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  2027. ResetPlayerWeapons(id);
  2028. format(global,sizeof(global),"{FFFF00}[DISARM]: {FFFFFF}You have disarmed '%s'",GetName(id));
  2029. SendClientMessage(playerid,-1,global);
  2030. format(global,sizeof(global),"{FFFF00}[DISARM]: {FFFFFF}You have been disarmed by '%s'",GetName(playerid));
  2031. SendClientMessage(id,-1,global);
  2032. return 1;
  2033. }
  2034.  
  2035. CMD:giveallcash(playerid, params[])
  2036. {
  2037. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be an administrator to use this command.");
  2038. if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /giveallcash [cash]");
  2039. new strt[200];
  2040. foreach(new i: Player)
  2041. {
  2042. GivePlayerMoney(i,strval(params));
  2043. }
  2044. format(strt,127," %s ~w~%s has given everyone ~g~$%i",GetPlayerAdmin(playerid),GetName(playerid),strval(params));
  2045. TextMenuShowForPlayer(playerid,MENU_CMDS,"Cash",strt);
  2046. return 1;
  2047. }
  2048.  
  2049. CMD:offban(playerid, params[])
  2050. {
  2051. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  2052. new target[24],reason[50];
  2053. if(sscanf(params, "s[24]s[50]", target, reason)) return SendClientMessage(playerid,-1,"USAGE: /offban [account] [reason]");
  2054. mysql_format(mysql,global,sizeof(global),"SELECT * FROM `players` WHERE `name` = '%e' LIMIT 1",target);
  2055. mysql_tquery(mysql,global,"OnAccountBan","dss",playerid,target,reason);
  2056. return 1;
  2057. }
  2058.  
  2059. CMD:setlevel(playerid, params[])
  2060. {
  2061. new id,level;
  2062. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  2063. if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, -1, "USAGE: /setlevel [playerid] [level]");
  2064. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  2065. if(level < 0) return ERROR(playerid,"Levels are between 0-4 only");
  2066. if(level > 4) return ERROR(playerid,"Levels are between 0-4 only");
  2067. format(global, sizeof(global), "{00FF00}[LEVEL]: {FFFFFF}Your level was set to '%i' by %s.", level,GetName(playerid));
  2068. SendClientMessage(id,-1, global);
  2069. format(global, sizeof(global), "{00FF00}[LEVEL]: {FFFFFF}You have given level '%i' to %s.", level,GetName(id));
  2070. SendClientMessage(playerid,-1, global);
  2071. PlayerInfo[id][Level] = level;
  2072. return 1;
  2073. }
  2074.  
  2075. CMD:setkills(playerid, params[])
  2076. {
  2077. new id,kill;
  2078. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  2079. if(sscanf(params, "ud", id, kill)) return SendClientMessage(playerid, -1, "USAGE: /setkills [playerid] [kills]");
  2080. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  2081. format(global, sizeof(global), "{00FF00}[KILLS]: {FFFFFF}Your kills were set to '%i' by %s.", kill,GetName(playerid));
  2082. SendClientMessage(id,-1, global);
  2083. format(global, sizeof(global), "{00FF00}[KILLS]: {FFFFFF}You have set %s's kills to %i.",GetName(id),kill);
  2084. SendClientMessage(playerid,-1, global);
  2085. PlayerInfo[id][Kills] = kill;
  2086. return 1;
  2087. }
  2088.  
  2089. CMD:setdeaths(playerid, params[])
  2090. {
  2091. new id,kill;
  2092. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  2093. if(sscanf(params, "ud", id, kill)) return SendClientMessage(playerid, -1, "USAGE: /setdeaths [playerid] [deaths]");
  2094. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  2095. format(global, sizeof(global), "{00FF00}[DEATHS]: {FFFFFF}Your deaths were set to '%i' by %s.", kill,GetName(playerid));
  2096. SendClientMessage(id,-1, global);
  2097. format(global, sizeof(global), "{00FF00}[DEATHS]: {FFFFFF}You have set %s's deaths to %i.",GetName(id),kill);
  2098. SendClientMessage(playerid,-1, global);
  2099. PlayerInfo[id][Deaths] = kill;
  2100. return 1;
  2101. }
  2102.  
  2103. CMD:resetcash(playerid, params[])
  2104. {
  2105. if(PlayerInfo[playerid][Level] < 3) return ERROR(playerid,"You must be a manager to use this command.");
  2106. new id;
  2107. if(sscanf(params, "ud", id)) return SendClientMessage(playerid, -1, "USAGE: /resetcash [playerid]");
  2108. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  2109. ResetPlayerMoney(id);
  2110. format(global,sizeof(global),"{FFFF00}[RESET]: {FFFFFF}You have reset %s's cash",GetName(id));
  2111. SendClientMessage(playerid,-1,global);
  2112. format(global,sizeof(global),"{FFFF00}[RESET]: {FFFFFF}Your cash was reset by '%s'",GetName(playerid));
  2113. SendClientMessage(id,-1,global);
  2114. return 1;
  2115. }
  2116.  
  2117. CMD:settime(playerid,params[])
  2118. {
  2119. if(PlayerInfo[playerid][Level] < 4) return ERROR(playerid,"You must be an owner to use this command.");
  2120. if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /settime [time]");
  2121. SetWorldTime(strval(params));
  2122. return 1;
  2123. }
  2124.  
  2125. CMD:setweather(playerid,params[])
  2126. {
  2127. if(PlayerInfo[playerid][Level] < 4) return ERROR(playerid,"You must be an owner to use this command.");
  2128. if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE: /setweather [time]");
  2129. SetWeather(strval(params));
  2130. return 1;
  2131. }
  2132.  
  2133. CMD:setcash(playerid, params[])
  2134. {
  2135. new id,kill;
  2136. if(PlayerInfo[playerid][Level] < 4) return ERROR(playerid,"You must be an owner to use this command.");
  2137. if(sscanf(params, "ud", id, kill)) return SendClientMessage(playerid, -1, "USAGE: /setcash [playerid] [cash]");
  2138. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  2139. format(global, sizeof(global), "{00FF00}[DEATHS]: {FFFFFF}Your cash was set to $%i by %s.", kill,GetName(playerid));
  2140. SendClientMessage(id,-1, global);
  2141. format(global, sizeof(global), "{00FF00}[DEATHS]: {FFFFFF}You have set %s's cash to $%i.",GetName(id),kill);
  2142. SendClientMessage(playerid,-1, global);
  2143. ResetPlayerMoney(id);
  2144. GivePlayerMoney(id,kill);
  2145. return 1;
  2146. }
  2147.  
  2148. CMD:report(playerid, params[])
  2149. {
  2150. new id,reason[50];
  2151. if(sscanf(params, "us[50]", id, reason)) return SendClientMessage(playerid, -1, "USAGE: /report [playerid] [reason]");
  2152. if (id == INVALID_PLAYER_ID) return ERROR(playerid,"Player isn't online.");
  2153. format(global, sizeof(global), "{FF0000}[REPORT]: {FFFFFF}%s has reported %s(%i). [Reason: %s]", GetName(playerid),GetName(id),id,reason);
  2154. foreach(new I: Player)
  2155. {
  2156. if(PlayerInfo[I][Level] >= 1) SendClientMessage(I,-1, global);
  2157. }
  2158. SendClientMessage(playerid,-1,"{FFFF00}[REPORT]: {FFFFFF}Your report was sent to the staff, wait for a response!");
  2159. return 1;
  2160. }
  2161.  
  2162. CMD:banlist(playerid)
  2163. {
  2164. if(PlayerInfo[playerid][Level] < 2) return ERROR(playerid,"You must be a moderator to use this command.");
  2165. ShowPlayerDialog(playerid, DIALOG_BANLIST, DIALOG_STYLE_LIST, "{FFFF00}Ban List","Last Bans\nFind Bans\nEdit Bans\nAdd Ban", "Close","");
  2166. return 1;
  2167. }
Advertisement
Add Comment
Please, Sign In to add comment