Advertisement
Guest User

Untitled

a guest
Mar 25th, 2012
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.13 KB | None | 0 0
  1. #include <a_samp>
  2. #include <sscanf2_5>
  3. #include <zcmd>
  4. #include <YSI/y_ini>
  5.  
  6. #undef MAX_PLAYERS
  7. #define MAX_PLAYERS 20
  8.  
  9. #define YOUR_SERVER_NAME "Plant the Bomb"
  10.  
  11. #define YOUR_ACCOUNT_DIRECTORY "PTB/Accounts/%s.ini"
  12. //Leave .ini on the end - This is the extension and is vital!
  13.  
  14. #define M1_NAME "Warehouse Rumble"
  15. #define M2_NAME "Bridge Takedown"
  16.  
  17. #define BOMB_EXPLODE_TIME 30
  18. //This is in seconds.
  19.  
  20. #define GetPlayerNameEx(%0,%1,%2) GetPlayerName(%0, %1, %2); for(new i = 0; i != %2; i ++) if(%1[i] == '_') %1[i] = ' '
  21.  
  22. #define HOLDING(%0) \
  23. ((newkeys & (%0)) == (%0))
  24.  
  25. #define PRESSED(%0) \
  26. (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  27.  
  28. #define c_CMD 0x4CB809FF
  29. #define c_ERROR 0xED2D07FF
  30. #define c_GENERAL 0x07ED91FF
  31.  
  32. #define NOAUTH SendClientMessage(playerid, c_ERROR, "ERROR: You are not able to use that command!")
  33.  
  34. #define d_JOIN1 1
  35. #define d_JOIN2 2
  36. #define d_REGISTER 3
  37. #define d_LOGIN 4
  38. #define d_RADIO 5
  39.  
  40. enum pInfo
  41. {
  42. Passcode, //This is encoded as a number.
  43. Cash,
  44. Auth,
  45. Kills,
  46. Deaths,
  47. HighestKS
  48. }
  49. new p_Data[MAX_PLAYERS][pInfo];
  50.  
  51. new
  52. TeamSkin[ 6 ], //We have 5 skins, 5 + \o (NULL) = 6.
  53.  
  54. Text:TeamTD_0, // - 0 is the black box on class selection!
  55. Text:TeamTD_1, // - 1 is the Terrorist label!
  56. Text:TeamTD_2, // - 2 is the mission description!
  57.  
  58. Text:TeamTD_3, // - 3 is the Counter Terrorist label!
  59. Text:TeamTD_4, // - 4 is the mission description!
  60.  
  61. Text:BombOutline,
  62. Text:BombText,
  63. Text:BombS1,
  64. Text:BombS2,
  65. Text:BombS3
  66. ;
  67.  
  68. new
  69. p_State[MAX_PLAYERS] = -1,
  70. /* There are 4 different nodes that this variable can have, they are listed below:
  71. 0: Class Select - Called when the player is selecting their class.
  72. 1: Not spawned - Connecting, Disconnecting(?)
  73. 2: Spectating - Player is currently spectating the battlefield.
  74. 3: Spawned - Player is currently spawned, killable, and spectatable.
  75. 4: Dead - Has been killed within the last (RESPAWN_DELAY) seconds. (RESPAWN_DELAY is configurable up top!)
  76.  
  77. Using this method, we should be able to accurately detect what each players state is at any time.
  78. */
  79.  
  80. p_ClassSelected[MAX_PLAYERS char] = -1,
  81. /*
  82. This is where the team character they selected is saved to their username until it is changed, so we can detect EVERY
  83. thing a player does.
  84. */
  85.  
  86. p_ViewingDialog[MAX_PLAYERS] = -1,
  87. /*
  88. This stores the ID of the ID they are currently viewing, to give administrators an exact count on
  89. what a user is doing!
  90. */
  91.  
  92. p_SelectedTeam[MAX_PLAYERS] = -1,
  93. /*
  94. Stores the Team ID of the selected player!
  95. Values:
  96. -1: None (Class selection? Bug?)
  97. 1: Terrorist
  98. 2: Counter Terrorist
  99. */
  100.  
  101. bool: p_LoggedIn[MAX_PLAYERS char] = false,
  102. /* Values:
  103. 0: Not logged in
  104. 1: Logged in
  105. */
  106.  
  107. p_KillStreak[MAX_PLAYERS] = 0,
  108. /*
  109. This value goes up +1 every time you get a kill, in intervals of 5, it broadcasts killstreak messages to the
  110. server.
  111. */
  112.  
  113. p_LastKill[MAX_PLAYERS][MAX_PLAYER_NAME],
  114. /*
  115. Stores the name of your last killed player. When you join the server, this will reset to "None".
  116. */
  117.  
  118. p_SpawnedVehicle[MAX_PLAYERS] = -1,
  119. /*
  120. Stores the vehicle ID of your spawned vehicle.
  121. Any value other than -1 means their spawned vehicle is.. well, spawned.
  122. */
  123.  
  124. bool:p_FirstSpawn[MAX_PLAYERS] = true,
  125. /*
  126. Stores whether it's the users first spawn or not.
  127. If it is, we need to load the map's objects, and set them up;
  128. We could also send them a message!
  129. */
  130.  
  131. bool:p_AnimationsLoaded[MAX_PLAYERS] = false,
  132. /*
  133. Stores whether the user has preloaded their animations or not.
  134. */
  135.  
  136. bool:p_InsideBombZone[MAX_PLAYERS] = false,
  137. /*
  138. We use this to detect whether the user is inside of the bomb zone (also indicated by a checkpoint)
  139. Once they leave this checkpoint, their variable is set to false.
  140. */
  141.  
  142. Float:p_PosInBombZone[MAX_PLAYERS][3],
  143. /*
  144. This is how we will check if they're still in the zone after each second passes.
  145. */
  146.  
  147. g_SelectedMap = 1,
  148. /*
  149. Stores the ID of the map currently loaded.
  150. After server restart, this is automatically set to 1.
  151. */
  152.  
  153. bool:g_BombPlanted = false,
  154. /*
  155. Used to detect whether the bomb has been detected or not.
  156. */
  157.  
  158. bool:g_BombPlantSuccess = false,
  159. /*
  160. Used to detect whether they successfully planted the bomb!
  161. */
  162.  
  163. g_BombTimer,
  164.  
  165. g_BSeconds = 0
  166. ;
  167.  
  168. new
  169. /*
  170. These are our randomized spawns to prevent Spawn Killing!
  171.  
  172. X Y Z A
  173. */
  174. Float:M1_CT[][8] =
  175. {
  176. {-2141.2556, -268.6744, 40.7195, 90.9648},
  177. {-2145.7654, -257.3408, 40.7195, 178.1238},
  178. {-2189.1001, -268.6501, 40.7195, 269.7705},
  179. {-2187.5730, -257.4611, 40.7195, 269.1034},
  180. {-2187.3916, -256.4670, 40.7195, 266.0067},
  181. {-2184.8154, -264.8004, 36.5156, 269.6441},
  182. {-2184.6428, -262.3403, 36.5156, 268.2798}
  183. },
  184.  
  185. Float:M1_TER[][8] =
  186. {
  187. {-2183.4485, -206.3433, 36.5156, 179.0283},
  188. {-2187.9800, -206.7578, 36.5156, 180.1499},
  189. {-2181.7295, -213.1991, 36.5156, 87.6640},
  190. {-2182.0408, -222.1220, 36.5156, 89.4396},
  191. {-2184.2075, -224.5078, 36.5156, 359.4396},
  192. {-2188.7322, -215.4334, 36.5156, 267.4650},
  193. {-2188.5605, -212.7593, 36.5156, 269.6089}
  194. }
  195. ;
  196.  
  197. public OnGameModeInit()
  198. {
  199.  
  200. SendRconCommand("hostname "YOUR_SERVER_NAME);
  201.  
  202. new
  203. r_Map = random(2);
  204. //Allows for 2 maps.
  205.  
  206. switch(r_Map)
  207. {
  208. case 0:
  209. {
  210. SetGameModeText(M1_NAME);
  211. }
  212. case 1:
  213. {
  214. SetGameModeText(M2_NAME);
  215. }
  216. }
  217.  
  218. g_BombPlanted = false;
  219.  
  220.  
  221.  
  222. //Terrorists!
  223.  
  224. /*
  225.  
  226. First: Find "new TeamSkin", and increase the array by the number of skins you want.
  227. Example: You have 12 skins, you need to have "new TeamSkin[13]" due to the NULL character at the end.
  228.  
  229. TeamSkin[ # ] = AddPlayerClassEx ( TEAMID, SKINID, XPOS, YPOS, ZPOS, APOS, MELEEID, AMMO, SECONDARYID, AMMO, ASSAULTRIFLE, AMMO );
  230.  
  231. */
  232. TeamSkin[ 0 ] = AddPlayerClassEx( 1, 0, 0, 0, 0, 0, 4, 1, 24, 100, 34, 100 );
  233. TeamSkin[ 1 ] = AddPlayerClassEx( 1, 1, 0, 0, 0, 0, 4, 1, 24, 100, 34, 100 );
  234. TeamSkin[ 2 ] = AddPlayerClassEx( 1, 299, 0, 0, 0, 0, 4, 1, 24, 100, 34, 100 );
  235.  
  236. //Counter Terrorists!
  237.  
  238. TeamSkin[ 3 ] = AddPlayerClassEx( 2, 284, 0, 0, 0, 0, 4, 1, 24, 100, 34, 100 );
  239. TeamSkin[ 4 ] = AddPlayerClassEx( 2, 285, 0, 0, 0, 0, 4, 1, 24, 100, 34, 100 );
  240. TeamSkin[ 5 ] = AddPlayerClassEx( 2, 286, 0, 0, 0, 0, 4, 1, 24, 100, 34, 100 );
  241.  
  242. TeamTD_0 = TextDrawCreate(496.000000, 108.000000, "_~n~~n~~n~~n~~n~~n~~n~~n~");
  243. TextDrawBackgroundColor(TeamTD_0, 255);
  244. TextDrawFont(TeamTD_0, 1);
  245. TextDrawLetterSize(TeamTD_0, 0.500000, 1.000000);
  246. TextDrawColor(TeamTD_0, -1);
  247. TextDrawSetOutline(TeamTD_0, 0);
  248. TextDrawSetProportional(TeamTD_0, 1);
  249. TextDrawSetShadow(TeamTD_0, 1);
  250. TextDrawUseBox(TeamTD_0, 1);
  251. TextDrawBoxColor(TeamTD_0, 255);
  252. TextDrawTextSize(TeamTD_0, 630.000000, 0.000000);
  253.  
  254. TeamTD_1 = TextDrawCreate(508.000000, 112.000000, "~r~Terrorist");
  255. TextDrawBackgroundColor(TeamTD_1, -1);
  256. TextDrawFont(TeamTD_1, 0);
  257. TextDrawLetterSize(TeamTD_1, 0.500000, 2.000000);
  258. TextDrawColor(TeamTD_1, 255);
  259. TextDrawSetOutline(TeamTD_1, 1);
  260. TextDrawSetProportional(TeamTD_1, 1);
  261.  
  262. TeamTD_2 = TextDrawCreate(497.000000, 138.000000, "~y~Mission :~n~___~r~Destroy ~w~the ~y~target area!");
  263. TextDrawBackgroundColor(TeamTD_2, 255);
  264. TextDrawFont(TeamTD_2, 3);
  265. TextDrawLetterSize(TeamTD_2, 0.270000, 1.800000);
  266. TextDrawColor(TeamTD_2, -1);
  267. TextDrawSetOutline(TeamTD_2, 0);
  268. TextDrawSetProportional(TeamTD_2, 1);
  269. TextDrawSetShadow(TeamTD_2, 1);
  270.  
  271. TeamTD_3 = TextDrawCreate(508.000000, 112.000000, "~b~Counter Terrorist");
  272. TextDrawBackgroundColor(TeamTD_3, -1);
  273. TextDrawFont(TeamTD_3, 0);
  274. TextDrawLetterSize(TeamTD_3, 0.500000, 2.000000);
  275. TextDrawColor(TeamTD_3, 255);
  276. TextDrawSetOutline(TeamTD_3, 1);
  277. TextDrawSetProportional(TeamTD_3, 1);
  278.  
  279. TeamTD_4 = TextDrawCreate(497.000000, 138.000000, "~y~Mission :~n~___~b~Protect ~w~the ~y~target area!");
  280. TextDrawBackgroundColor(TeamTD_4, 255);
  281. TextDrawFont(TeamTD_4, 3);
  282. TextDrawLetterSize(TeamTD_4, 0.270000, 1.799999);
  283. TextDrawColor(TeamTD_4, -1);
  284. TextDrawSetOutline(TeamTD_4, 0);
  285. TextDrawSetProportional(TeamTD_4, 1);
  286. TextDrawSetShadow(TeamTD_4, 1);
  287.  
  288. BombOutline = TextDrawCreate(140.000000, 410.000000, "_~n~_~n~_");
  289. TextDrawBackgroundColor(BombOutline, 255);
  290. TextDrawFont(BombOutline, 1);
  291. TextDrawLetterSize(BombOutline, 0.500000, 1.000000);
  292. TextDrawColor(BombOutline, -1);
  293. TextDrawSetOutline(BombOutline, 1);
  294. TextDrawSetProportional(BombOutline, 1);
  295. TextDrawUseBox(BombOutline, 1);
  296. TextDrawBoxColor(BombOutline, -1);
  297. TextDrawTextSize(BombOutline, 490.000000, 0.000000);
  298.  
  299. BombText = TextDrawCreate(246.000000, 418.000000, "PLANTING BOMB...");
  300. TextDrawBackgroundColor(BombText, 255);
  301. TextDrawFont(BombText, 1);
  302. TextDrawLetterSize(BombText, 0.500000, 1.000000);
  303. TextDrawColor(BombText, -16776961);
  304. TextDrawSetProportional(BombText, 1);
  305.  
  306. BombS1 = TextDrawCreate(140.000000, 410.000000, "_~n~_~n~_");
  307. TextDrawBackgroundColor(BombS1, 255);
  308. TextDrawFont(BombS1, 1);
  309. TextDrawLetterSize(BombS1, 0.500000, 1.000000);
  310. TextDrawColor(BombS1, -1);
  311. TextDrawSetOutline(BombS1, 0);
  312. TextDrawSetProportional(BombS1, 1);
  313. TextDrawSetShadow(BombS1, 1);
  314. TextDrawUseBox(BombS1, 1);
  315. TextDrawBoxColor(BombS1, 16777215);
  316. TextDrawTextSize(BombS1, 270.000000, 0.000000);
  317.  
  318. BombS2 = TextDrawCreate(140.000000, 410.000000, "_~n~_~n~_");
  319. TextDrawBackgroundColor(BombS2, 255);
  320. TextDrawFont(BombS2, 1);
  321. TextDrawLetterSize(BombS2, 0.500000, 1.000000);
  322. TextDrawColor(BombS2, -1);
  323. TextDrawSetOutline(BombS2, 0);
  324. TextDrawSetProportional(BombS2, 1);
  325. TextDrawSetShadow(BombS2, 1);
  326. TextDrawUseBox(BombS2, 1);
  327. TextDrawBoxColor(BombS2, 16777215);
  328. TextDrawTextSize(BombS2, 380.000000, 0.000000);
  329.  
  330. BombS3 = TextDrawCreate(140.000000, 410.000000, "_~n~_~n~_");
  331. TextDrawBackgroundColor(BombS3, 255);
  332. TextDrawFont(BombS3, 1);
  333. TextDrawLetterSize(BombS3, 0.500000, 1.000000);
  334. TextDrawColor(BombS3, -1);
  335. TextDrawSetOutline(BombS3, 0);
  336. TextDrawSetProportional(BombS3, 1);
  337. TextDrawSetShadow(BombS3, 1);
  338. TextDrawUseBox(BombS3, 1);
  339. TextDrawBoxColor(BombS3, 16777215);
  340. TextDrawTextSize(BombS3, 490.000000, 0.000000);
  341. return true;
  342. }
  343.  
  344. main()
  345. {
  346. print("Created by 2KY for the SA:MP Community!");
  347. //Please leave these credits, even if it's only a print in your console window.
  348. }
  349.  
  350. public OnPlayerConnect(playerid)
  351. {
  352. if(fexist(FindAccountPath(playerid)))
  353. {
  354. ShowPlayerDialog(playerid, d_JOIN2, DIALOG_STYLE_LIST, "{68C20E}Processing Center", "Login\nHow to Play\nCredits", "Select", "Quit"),
  355. p_ViewingDialog[playerid] = d_JOIN2;
  356. }
  357. else
  358. {
  359. ShowPlayerDialog(playerid, d_JOIN1, DIALOG_STYLE_LIST, "{68C20E}Processing Center", "Register\nHow to Play\nCredits", "Select", "Quit"),
  360. p_ViewingDialog[playerid] = d_JOIN1;
  361. }
  362. p_LastKill[playerid] = "None";
  363. p_State{playerid} = 1;
  364. return true;
  365. }
  366.  
  367. public OnPlayerRequestClass(playerid, classid)
  368. {
  369. p_ClassSelected{playerid} = classid;
  370. p_State{playerid} = 0;
  371.  
  372. ClearClassSelectionTextDraws(playerid);
  373.  
  374. switch(p_ClassSelected{playerid}) {
  375.  
  376. //Are they selecting a Terrorist Team Member? If so - Show them this!
  377. case 0..2: {
  378.  
  379. TextDrawShowForPlayer(playerid, TeamTD_0);
  380. TextDrawShowForPlayer(playerid, TeamTD_1);
  381. TextDrawShowForPlayer(playerid, TeamTD_2);
  382. p_SelectedTeam[playerid] = 1;
  383.  
  384. }
  385.  
  386. //Are they selecting a Counter Terrorist Team Member? If so - Show them this!
  387. case 3..5: {
  388.  
  389. TextDrawShowForPlayer(playerid, TeamTD_0);
  390. TextDrawShowForPlayer(playerid, TeamTD_3);
  391. TextDrawShowForPlayer(playerid, TeamTD_4);
  392. p_SelectedTeam[playerid] = 2;
  393.  
  394. }
  395.  
  396. }
  397. return 1;
  398. }
  399.  
  400. public OnPlayerRequestSpawn(playerid)
  401. {
  402. if(p_LoggedIn{playerid} != true) { return 0; }
  403. return 1;
  404. }
  405.  
  406. public OnPlayerSpawn(playerid)
  407. {
  408. if(p_FirstSpawn[playerid] == true)
  409. {
  410. new
  411. p_Str[128];
  412.  
  413. switch(g_SelectedMap)
  414. {
  415. case 1: //if g_SelectedMap equals 1..
  416. {
  417. format(p_Str, sizeof(p_Str), "You are currently playing: {1B42E0}%s!", M1_NAME);
  418. }
  419. case 2: //if g_SelectedMap equals 2.. and so on...
  420. {
  421. format(p_Str, sizeof(p_Str), "You are currently playing: {1B42E0}%s!", M2_NAME);
  422. }
  423. }
  424.  
  425. SendClientMessage(playerid, -1, p_Str);
  426.  
  427. if(p_AnimationsLoaded[playerid] == false)
  428. {
  429. PreloadAnimLib(playerid,"BOMBER"), PreloadAnimLib(playerid,"RAPPING");
  430. PreloadAnimLib(playerid,"SHOP"), PreloadAnimLib(playerid,"BEACH");
  431. PreloadAnimLib(playerid,"SMOKING"), PreloadAnimLib(playerid,"FOOD");
  432. PreloadAnimLib(playerid,"ON_LOOKERS"), PreloadAnimLib(playerid,"DEALER");
  433. PreloadAnimLib(playerid,"CRACK"), PreloadAnimLib(playerid,"CARRY");
  434. PreloadAnimLib(playerid,"COP_AMBIENT"), PreloadAnimLib(playerid,"PARK");
  435. PreloadAnimLib(playerid,"INT_HOUSE"), PreloadAnimLib(playerid,"FOOD");
  436.  
  437. p_AnimationsLoaded[playerid] = true;
  438. }
  439. p_FirstSpawn[playerid] = false;
  440. }
  441.  
  442. if(p_SelectedTeam[playerid] == 1) //Terrorist
  443. {
  444. new
  445. r_Spawn = random(sizeof(M1_TER));
  446.  
  447. SetPlayerPos(playerid, M1_TER[r_Spawn][0], M1_TER[r_Spawn][1], M1_TER[r_Spawn][2]);
  448. SetPlayerFacingAngle(playerid, M1_TER[r_Spawn][3]);
  449.  
  450. if(g_BombPlanted == false) {
  451. SetPlayerCheckpoint(playerid, -2182.5017, -247.4970, 36.5156, 3.0);
  452. }
  453. }
  454. if(p_SelectedTeam[playerid] == 2) //Counter Terrorist
  455. {
  456. new
  457. r_Spawn = random(sizeof(M1_CT));
  458.  
  459. SetPlayerPos(playerid, M1_CT[r_Spawn][0], M1_CT[r_Spawn][1], M1_CT[r_Spawn][2]);
  460. SetPlayerFacingAngle(playerid, M1_CT[r_Spawn][3]);
  461. }
  462. ClearClassSelectionTextDraws(playerid);
  463. p_State{playerid} = 3;
  464. return true;
  465. }
  466.  
  467. public OnPlayerDeath(playerid, killerid, reason)
  468. {
  469. new
  470. p_Name[MAX_PLAYER_NAME],
  471. d_Str[128],
  472. d_Name[MAX_PLAYER_NAME]
  473. ;
  474.  
  475. GetPlayerNameEx(killerid, d_Name, 24);
  476.  
  477. GetPlayerName(playerid, p_Name, 24);
  478.  
  479. p_LastKill[killerid] = p_Name;
  480. p_KillStreak[killerid]++;
  481. p_KillStreak[playerid] = 0;
  482.  
  483. if(p_KillStreak[killerid] > p_Data[killerid][HighestKS])
  484. {
  485. p_Data[killerid][HighestKS] = p_KillStreak[killerid];
  486. }
  487.  
  488. switch(p_KillStreak[killerid])
  489. {
  490. case 5:
  491. {
  492. format(d_Str, sizeof(d_Str), "* %s has achieved a 5 killstreak!", d_Name);
  493. SendClientMessageToAll(c_GENERAL, d_Str);
  494. }
  495. case 10:
  496. {
  497. format(d_Str, sizeof(d_Str), "* %s has achieved a 10 killstreak!", d_Name);
  498. SendClientMessageToAll(c_GENERAL, d_Str);
  499. }
  500. case 15:
  501. {
  502. format(d_Str, sizeof(d_Str), "* %s has achieved a 15 killstreak!", d_Name);
  503. SendClientMessageToAll(c_GENERAL, d_Str);
  504. }
  505. case 20:
  506. {
  507. format(d_Str, sizeof(d_Str), "* %s has achieved a 20 killstreak!", d_Name);
  508. SendClientMessageToAll(c_GENERAL, d_Str);
  509. }
  510. case 25:
  511. {
  512. format(d_Str, sizeof(d_Str), "* %s has achieved a 25 killstreak!", d_Name);
  513. SendClientMessageToAll(c_GENERAL, d_Str);
  514. }
  515. case 30:
  516. {
  517. format(d_Str, sizeof(d_Str), "* %s has achieved a 30 killstreak!", d_Name);
  518. SendClientMessageToAll(c_GENERAL, d_Str);
  519. }
  520. case 35:
  521. {
  522. format(d_Str, sizeof(d_Str), "* %s has achieved a 35 killstreak!", d_Name);
  523. SendClientMessageToAll(c_GENERAL, d_Str);
  524. }
  525. case 40:
  526. {
  527. format(d_Str, sizeof(d_Str), "* %s has achieved a 40 killstreak!", d_Name);
  528. SendClientMessageToAll(c_GENERAL, d_Str);
  529. }
  530. case 45:
  531. {
  532. format(d_Str, sizeof(d_Str), "* %s has achieved a 45 killstreak!", d_Name);
  533. SendClientMessageToAll(c_GENERAL, d_Str);
  534. }
  535. case 50:
  536. {
  537. format(d_Str, sizeof(d_Str), "* %s has achieved a 50 killstreak!", d_Name);
  538. SendClientMessageToAll(c_GENERAL, d_Str);
  539. }
  540. }
  541.  
  542. p_State{playerid} = 4;
  543. return true;
  544. }
  545.  
  546. public OnPlayerDisconnect(playerid, reason)
  547. {
  548. if(p_LoggedIn{playerid} == true)
  549. {
  550. new
  551. INI:File = INI_Open(FindAccountPath(playerid));
  552.  
  553. INI_SetTag( File, "data");
  554.  
  555. INI_WriteInt( File, "Cash", GetPlayerMoney(playerid));
  556. INI_WriteInt( File, "Admin", p_Data[playerid][Auth]);
  557. INI_WriteInt( File, "Kills", p_Data[playerid][Kills]);
  558. INI_WriteInt( File, "Deaths", p_Data[playerid][Deaths]);
  559. INI_WriteInt( File, "HighestKS", p_Data[playerid][HighestKS]);
  560.  
  561. INI_Close(File);
  562.  
  563. if(p_SpawnedVehicle[playerid] != -1)
  564. {
  565. new
  566. p_Name[MAX_PLAYER_NAME];
  567.  
  568. GetPlayerNameEx(playerid, p_Name, 24);
  569.  
  570. printf("[p_SpawnedVehicle] %s (VID: %d) has been despawned. Reason: Disconnected.", p_Name, p_SpawnedVehicle[playerid]);
  571. DestroyVehicle(p_SpawnedVehicle[playerid]);
  572. p_SpawnedVehicle[playerid] = -1;
  573. }
  574. }
  575. p_LoggedIn{playerid} = false, p_State{playerid} = 1,
  576. p_SelectedTeam[playerid] = -1;
  577. return true;
  578. }
  579.  
  580. forward LoadUser_data(playerid,name[],value[]);
  581. public LoadUser_data(playerid,name[],value[])
  582. {
  583. INI_Int( "Passcode", p_Data[playerid][Passcode]);
  584. INI_Int( "Cash", p_Data[playerid][Cash]);
  585. INI_Int( "Admin", p_Data[playerid][Auth]);
  586. INI_Int( "Kills", p_Data[playerid][Kills]);
  587. INI_Int( "Deaths", p_Data[playerid][Deaths]);
  588. INI_Int( "HighestKS", p_Data[playerid][HighestKS]);
  589. return 1;
  590. }
  591.  
  592. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  593. {
  594. switch( dialogid )
  595. {
  596. case d_JOIN1: //They're new to the server and click 'register'
  597. {
  598.  
  599. switch(listitem)
  600. {
  601.  
  602. case 0: //They're new to the server and click 'register'
  603. {
  604.  
  605. ShowPlayerDialog(playerid, d_REGISTER, DIALOG_STYLE_PASSWORD, "{68C20E}Processing Center: Register", "{FFFFFF}Welcome to " YOUR_SERVER_NAME"!\nYou do not have an account on this server.\nPlease enter your password below to play!", "Register", ""),
  606. p_ViewingDialog[playerid] = d_REGISTER;
  607.  
  608. }
  609.  
  610. }
  611.  
  612. }
  613.  
  614. case d_JOIN2:
  615. {
  616.  
  617. switch(listitem)
  618. {
  619.  
  620. case 0: //They're returning users, and clicked 'login'
  621. {
  622. INI_ParseFile(FindAccountPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  623.  
  624. ShowPlayerDialog(playerid, d_LOGIN, DIALOG_STYLE_PASSWORD, "{68C20E}Processing Center: Authorize", "{FFFFFF}Welcome back to the server!\nIt appears as if you have been here before.\nPlease enter your password to continue!", "Login", ""),
  625. p_ViewingDialog[playerid] = d_LOGIN;
  626. }
  627.  
  628. }
  629. }
  630.  
  631. case d_REGISTER:
  632. {
  633.  
  634. if( response ) //They clicked 'Select'
  635. {
  636.  
  637. if(! strlen(inputtext)) //They just hit ENTER (RETURN) without entering a password.
  638. return ShowPlayerDialog(playerid, d_JOIN1, DIALOG_STYLE_LIST, "{68C20E}Processing Center", "Register\nHow to Play\nCredits", "Select", "Quit");
  639.  
  640. new
  641. INI:p_Acc = INI_Open(FindAccountPath(playerid));
  642.  
  643. INI_SetTag( p_Acc, "data");
  644. INI_WriteInt( p_Acc, "Passcode", udb_hash(inputtext));
  645. INI_WriteInt( p_Acc, "Cash", GetPlayerMoney(playerid));
  646. INI_WriteInt( p_Acc, "Admin", p_Data[playerid][Auth]);
  647. INI_WriteInt( p_Acc, "Kills", p_Data[playerid][Kills]);
  648. INI_WriteInt( p_Acc, "Deaths", p_Data[playerid][Deaths]);
  649. INI_WriteInt( p_Acc, "HighestKS", 0);
  650.  
  651. INI_Close( p_Acc );
  652.  
  653. SetPlayerPos(playerid, 150.2975, -64.9889, 1.5781);
  654. SetPlayerFacingAngle(playerid, 178.2798);
  655.  
  656. SetPlayerCameraPos(playerid, 150.4190, -68.7553, 1.4297);
  657. SetPlayerCameraLookAt(playerid, 150.2975, -64.9889, 1.5781);
  658.  
  659. TextDrawShowForPlayer(playerid, TeamTD_0);
  660. TextDrawShowForPlayer(playerid, TeamTD_1);
  661. TextDrawShowForPlayer(playerid, TeamTD_2);
  662.  
  663. p_LoggedIn{playerid} = true;
  664. p_ViewingDialog[playerid] = -1;
  665. }
  666. else return p_ViewingDialog[playerid] = -1, Kick(playerid);
  667. }
  668.  
  669. case d_LOGIN:
  670. {
  671.  
  672. if( response )
  673. {
  674.  
  675. if(udb_hash(inputtext) == p_Data[playerid][Passcode])
  676. {
  677.  
  678. INI_ParseFile(FindAccountPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  679. GivePlayerMoney(playerid, p_Data[playerid][Cash]);
  680.  
  681. p_LoggedIn{playerid} = true;
  682. p_ViewingDialog[playerid] = -1;
  683.  
  684. SetPlayerPos(playerid, 150.2975, -64.9889, 1.5781);
  685. SetPlayerFacingAngle(playerid, 178.2798);
  686.  
  687. SetPlayerCameraPos(playerid, 150.4190, -68.7553, 1.4297);
  688. SetPlayerCameraLookAt(playerid, 150.2975, -64.9889, 1.5781);
  689.  
  690. TextDrawShowForPlayer(playerid, TeamTD_0);
  691. TextDrawShowForPlayer(playerid, TeamTD_1);
  692. TextDrawShowForPlayer(playerid, TeamTD_2);
  693.  
  694. }
  695. else return ShowPlayerDialog(playerid, d_LOGIN, DIALOG_STYLE_PASSWORD, "{68C20E}Processing Center: Authorize", "{FFFFFF}Incorrect password!\nPlease enter your password to continue!", "Login", ""), p_ViewingDialog[playerid] = d_LOGIN;
  696. }
  697. else return p_ViewingDialog[playerid] = -1, Kick(playerid);
  698.  
  699. }
  700.  
  701. case d_RADIO:
  702. {
  703. if(response)
  704. {
  705. switch(listitem)
  706. {
  707. case 0: //Alternative Rock
  708. {
  709. PlayAudioStreamForPlayer(playerid, "http://stream.radioactivity.fm:8002/");
  710. SendClientMessage(playerid, c_GENERAL, "> You are now listening to 99.1 FM - WIKD Eagles!");
  711. }
  712. case 1: //Best of the 80s
  713. {
  714. PlayAudioStreamForPlayer(playerid, "http://scfire-mtc-aa05.stream.aol.com:80/stream/1013/");
  715. SendClientMessage(playerid, c_GENERAL, "> You are now listening to SKY.FM - Best of the 80s!");
  716. }
  717. }
  718. SendClientMessage(playerid, c_ERROR, "NOTE: In order to even START the stream - Your GTA radio volume has to be on!");
  719. }
  720. else return StopAudioStreamForPlayer(playerid);
  721. }
  722. }
  723. return 1;
  724. }
  725.  
  726. public OnPlayerEnterCheckpoint(playerid)
  727. {
  728. if(g_BSeconds == 0) {
  729. p_InsideBombZone[playerid] = true;
  730. SendClientMessage(playerid, -1, "true");
  731. }
  732. return 1;
  733. }
  734.  
  735. public OnPlayerLeaveCheckpoint(playerid)
  736. {
  737. p_InsideBombZone[playerid] = false;
  738. SendClientMessage(playerid, -1, "false");
  739. return 1;
  740. }
  741.  
  742. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  743. {
  744. if(PRESSED(KEY_SECONDARY_ATTACK))
  745. {
  746. if(p_InsideBombZone[playerid] == true && g_BombPlanted == false) //Checks if their inside of the bomb zone, and it's not planted already!
  747. {
  748. if(p_SelectedTeam[playerid] == 1) { //Probably shouldn't let the counter terrorists plant the bomb..
  749.  
  750. new
  751. Float:Pos[3];
  752.  
  753. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  754. p_PosInBombZone[playerid][0] = Pos[0], p_PosInBombZone[playerid][1] = Pos[1], p_PosInBombZone[playerid][2] = Pos[2];
  755.  
  756. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
  757. g_BombTimer = SetTimerEx("PlantBomb", 1000, true, "i", playerid);
  758. }
  759. else return 0;
  760. }
  761. }
  762. return 1;
  763. }
  764.  
  765. forward PlantBomb(playerid);
  766. public PlantBomb(playerid)
  767. {
  768. new
  769. Float:Pos[3]
  770. ;
  771.  
  772. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  773.  
  774. //if(p_PosInBombZone[playerid][0] == Pos[0] && p_PosInBombZone[playerid][1] == Pos[1] && p_PosInBombZone[playerid][2] == Pos[2])
  775. //{
  776. if(p_InsideBombZone[playerid] == true)
  777. {
  778. //SendClientMessage(playerid, c_ERROR, "u inside bomb zone jes");
  779. switch(g_BSeconds)
  780. {
  781. case 0:
  782. {
  783. TextDrawShowForPlayer(playerid, BombOutline),
  784. TextDrawShowForPlayer(playerid, BombText);
  785.  
  786. g_BSeconds++;
  787. }
  788. case 1:
  789. {
  790. TextDrawShowForPlayer(playerid, BombS1);
  791. g_BSeconds++;
  792. }
  793. case 2:
  794. {
  795. TextDrawShowForPlayer(playerid, BombS2);
  796. g_BSeconds++;
  797. }
  798. case 3:
  799. {
  800. new
  801. p_Name[24],
  802. p_Str[128]
  803. ;
  804.  
  805. TextDrawShowForPlayer(playerid, BombS3);
  806.  
  807. ClearAnimations(playerid);
  808.  
  809. g_BSeconds = 0;
  810.  
  811. g_BombPlantSuccess = true;
  812. g_BombPlanted = true;
  813.  
  814. TextDrawHideForPlayer(playerid, BombOutline), TextDrawHideForPlayer(playerid, BombText);
  815. TextDrawHideForPlayer(playerid, BombS1), TextDrawHideForPlayer(playerid, BombS2);
  816. TextDrawHideForPlayer(playerid, BombS3);
  817.  
  818. GameTextForAll("~r~Bomb Planted!", 3000, 1);
  819.  
  820. GetPlayerNameEx(playerid, p_Name, 24);
  821.  
  822. format(p_Str, sizeof(p_Str), "< %s has planted the bomb!", p_Name);
  823. SendClientMessageToAll(c_GENERAL, p_Str);
  824.  
  825. ClearAnimations(playerid);
  826.  
  827. KillTimer(g_BombTimer);
  828.  
  829. SetTimer("g_BombExplode", BOMB_EXPLODE_TIME*1000, false);
  830.  
  831. for(new i; i < MAX_PLAYERS; i++)
  832. {
  833. switch(p_SelectedTeam[i])
  834. {
  835. case 1:
  836. {
  837. DisablePlayerCheckpoint(i);
  838. SendClientMessage(i, c_GENERAL, "MISSION: {FFFFFF}Defend the bomb!");
  839. }
  840. case 2:
  841. {
  842. SetPlayerCheckpoint(playerid, -2182.5017, -247.4970, 36.5156, 3.0);
  843. SendClientMessage(i, c_GENERAL, "MISSION: {FFFFFF}Defuse the bomb!");
  844. }
  845. }
  846. }
  847. }
  848. }
  849.  
  850. }
  851. else //They moved!
  852. {
  853. KillTimer(g_BombTimer), g_BSeconds = 0;
  854. TextDrawHideForPlayer(playerid, BombOutline), TextDrawHideForPlayer(playerid, BombText);
  855. TextDrawHideForPlayer(playerid, BombS1);
  856. TextDrawHideForPlayer(playerid, BombS2);
  857. TextDrawHideForPlayer(playerid, BombS3);
  858. g_BombPlanted = false;
  859. g_BombPlantSuccess = false;
  860. return 1;
  861. }
  862. return 1;
  863. }
  864.  
  865. forward g_BombExplode();
  866. public g_BombExplode()
  867. {
  868. if(g_BombPlantSuccess == true)
  869. {
  870. CreateExplosion(-2182.5017, -247.4970, 36.5156, 0, 50.0);
  871. for(new i; i < MAX_PLAYERS; i++)
  872. {
  873. switch(p_SelectedTeam[i])
  874. {
  875. case 1:
  876. {
  877. SendClientMessage(i, c_GENERAL, "MISSION SUCCESSFUL! +$1000");
  878. GameTextForPlayer(i, "~w~Mission ~b~successful!", 3000, 3);
  879. GivePlayerMoney(i, 1000);
  880. }
  881. case 2:
  882. {
  883. SendClientMessage(i, c_ERROR, "MISSION FAIL! -$100");
  884. GameTextForPlayer(i, "~w~Mission ~r~failure!", 3000, 3);
  885. GivePlayerMoney(i, -100);
  886. }
  887. }
  888. }
  889. g_BombPlanted = false;
  890. SetTimer("MapSwitch", 3000, false);
  891. }
  892. return 1;
  893. }
  894.  
  895. forward MapSwitch();
  896. public MapSwitch()
  897. {
  898. for(new i; i < MAX_PLAYERS; i++)
  899. {
  900. SetPlayerHealth(i, 0.0);
  901. }
  902. return 1;
  903. }
  904.  
  905. stock ClearClassSelectionTextDraws(playerid)
  906. {
  907. TextDrawHideForPlayer(playerid, TeamTD_0);
  908. TextDrawHideForPlayer(playerid, TeamTD_1);
  909. TextDrawHideForPlayer(playerid, TeamTD_2);
  910. TextDrawHideForPlayer(playerid, TeamTD_3);
  911. TextDrawHideForPlayer(playerid, TeamTD_4);
  912. return 1;
  913. }
  914.  
  915. stock GetPlayerScriptState(playerid)
  916. {
  917. new
  918. p_StateName[32];
  919.  
  920. switch(p_State{playerid})
  921. {
  922. case 0: { p_StateName = "Class Selection"; }
  923. case 1: { p_StateName = "Not Spawned"; }
  924. case 2: { p_StateName = "Spectating"; }
  925. case 3: { p_StateName = "Spawned"; }
  926. case 4: { p_StateName = "Dead"; }
  927. }
  928. return p_StateName;
  929. }
  930.  
  931. stock FindAccountPath(playerid)
  932. {
  933. new
  934. string[128],
  935. p_Name[MAX_PLAYER_NAME]
  936. ;
  937.  
  938. GetPlayerName(playerid, p_Name, sizeof(p_Name));
  939. format(string, sizeof(string), YOUR_ACCOUNT_DIRECTORY, p_Name);
  940.  
  941. return string;
  942. }
  943.  
  944. stock udb_hash(buf[]) { //Credits to Dracoblue
  945. new length=strlen(buf);
  946. new s1 = 1;
  947. new s2 = 0;
  948. new n;
  949. for (n=0; n<length; n++)
  950. {
  951. s1 = (s1 + buf[n]) % 65521;
  952. s2 = (s2 + s1) % 65521;
  953. }
  954. return (s2 << 16) + s1;
  955. }
  956.  
  957. stock GetPlayerTitle(playerid)
  958. {
  959. new
  960. a_Title[64];
  961.  
  962. switch(p_Data[playerid][Auth])
  963. {
  964. case 0: {
  965. a_Title = "Player";
  966. }
  967.  
  968. case 1: {
  969. a_Title = "Moderator";
  970. }
  971.  
  972. case 2: {
  973. a_Title = "Administrator";
  974. }
  975. }
  976.  
  977. return a_Title;
  978. }
  979.  
  980. PreloadAnimLib(playerid, animlib[]) { ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0); }
  981.  
  982. /* NORMAL PLAYER COMMANDS */
  983.  
  984. CMD:stats(playerid, params[])
  985. {
  986. new
  987. p_StatStr[128],
  988. u_ID,
  989. u_Name[MAX_PLAYER_NAME]
  990. ;
  991.  
  992. if(sscanf(params, "u", u_ID)) //They JUST typed '/stats'
  993. {
  994.  
  995. SendClientMessage(playerid, c_GENERAL, "[ - YOUR STATISTICS - ]");
  996.  
  997. if(p_Data[playerid][Kills] > 0) {
  998. format(p_StatStr, sizeof(p_StatStr), "{FFFFFF}* Kills: %d, Deaths: %d, K/D Ratio: %0.2f", p_Data[playerid][Kills], p_Data[playerid][Deaths], floatdiv(p_Data[playerid][Kills], p_Data[playerid][Deaths]));
  999. }
  1000. else if(p_Data[playerid][Kills] == 0) {
  1001. format(p_StatStr, sizeof(p_StatStr), "{FFFFFF}* Kills: %d, Deaths: %d, K/D Ratio: 0.00", p_Data[playerid][Kills], p_Data[playerid][Deaths]);
  1002. }
  1003. SendClientMessage(playerid, -1, p_StatStr);
  1004.  
  1005. format(p_StatStr, sizeof(p_StatStr), "{FFFFFF}* Current Killstreak: %d, Highest Killstreak: %d, Last Kill: %s", p_KillStreak[playerid], p_Data[playerid][HighestKS], p_LastKill[playerid]);
  1006. return SendClientMessage(playerid, -1, p_StatStr);
  1007. }
  1008. //They typed in a User ID after the command, EG: '/stats 0' would retrieve ID 0's stats.
  1009.  
  1010. GetPlayerNameEx(u_ID, u_Name, 24);
  1011.  
  1012. format(p_StatStr, sizeof(p_StatStr), "[ - %s STATISTICS - ]", u_Name);
  1013. SendClientMessage(playerid, c_GENERAL, p_StatStr);
  1014.  
  1015. if(p_Data[u_ID][Kills] > 0) {
  1016. format(p_StatStr, sizeof(p_StatStr), "{FFFFFF}* Kills: %d, Deaths: %d, K/D Ratio: %0.2f", p_Data[u_ID][Kills], p_Data[u_ID][Deaths], floatdiv(p_Data[u_ID][Kills], p_Data[u_ID][Deaths]));
  1017. }
  1018. else if(p_Data[playerid][Kills] == 0) {
  1019. format(p_StatStr, sizeof(p_StatStr), "{FFFFFF}* Kills: %d, Deaths: %d, K/D Ratio: 0.00", p_Data[u_ID][Kills], p_Data[u_ID][Deaths]);
  1020. }
  1021. SendClientMessage(playerid, -1, p_StatStr);
  1022.  
  1023. format(p_StatStr, sizeof(p_StatStr), "{FFFFFF}* Current Killstreak: %d, Highest Killstreak: %d, Last Kill: %s", p_KillStreak[u_ID], p_Data[u_ID][HighestKS], p_LastKill[u_ID]);
  1024. return SendClientMessage(playerid, -1, p_StatStr);
  1025. }
  1026.  
  1027. CMD:music(playerid, params[])
  1028. {
  1029. return ShowPlayerDialog(playerid, d_RADIO, DIALOG_STYLE_LIST, "Please select a Radio Station!", "Alternative Rock\nBest of the 80s", "Select", "Stop");
  1030. }
  1031.  
  1032. /* MODERATOR COMMANDS */
  1033.  
  1034. CMD:check(playerid, params[])
  1035. {
  1036. new
  1037. p_ID;
  1038.  
  1039. if(sscanf(params, "u", p_ID))
  1040. return SendClientMessage(playerid, c_CMD, "< /check <Player ID>");
  1041.  
  1042. if(!IsPlayerConnected(p_ID))
  1043. return SendClientMessage(playerid, c_ERROR, "< /check - Player is not connected!");
  1044.  
  1045. if(p_Data[playerid][Auth] >= 1)
  1046. {
  1047.  
  1048. new
  1049. p_Str[128],
  1050. p_Name[MAX_PLAYER_NAME]
  1051. ;
  1052.  
  1053. GetPlayerNameEx(p_ID, p_Name, sizeof(p_Name));
  1054.  
  1055. format(p_Str, sizeof(p_Str), "-- [ Player %s : Check ] --", p_Name);
  1056. SendClientMessage(playerid, c_GENERAL, p_Str);
  1057.  
  1058. new
  1059. d_Name[32],
  1060. p_Weapons[13][2],
  1061. p_WeaponName[32]
  1062. ;
  1063.  
  1064. if(p_ViewingDialog[p_ID] == -1) { d_Name = "None"; }
  1065. else if(p_ViewingDialog[p_ID] == d_JOIN1) { d_Name = "Join (REGISTER)"; }
  1066. else if(p_ViewingDialog[p_ID] == d_JOIN2) { d_Name = "Join (LOGIN)"; }
  1067. else if(p_ViewingDialog[p_ID] == d_REGISTER) { d_Name = "Registration"; }
  1068. else if(p_ViewingDialog[p_ID] == d_LOGIN) { d_Name = "Authorization"; }
  1069. else if(p_ViewingDialog[p_ID] == d_RADIO) { d_Name = "Radio Selection"; }
  1070.  
  1071. for (new i = 0; i < 13; i++)
  1072. {
  1073. GetPlayerWeaponData(p_ID, i, p_Weapons[i][0], p_Weapons[i][1]);
  1074. }
  1075.  
  1076.  
  1077. SendClientMessage(playerid, c_GENERAL, "- Weapons:");
  1078.  
  1079. if(p_Weapons[1][0] != 0) { //Melee weapons
  1080. GetWeaponName(p_Weapons[1][0], p_WeaponName, 32);
  1081. format(p_Str, sizeof(p_Str), " * Melee: %s", p_WeaponName), SendClientMessage(playerid, -1, p_Str);
  1082. }
  1083. if(p_Weapons[2][0] != 0) { //Pistols
  1084. GetWeaponName(p_Weapons[2][0], p_WeaponName, 32);
  1085. format(p_Str, sizeof(p_Str), " * Pistol: %s [Ammo: %d]", p_WeaponName, p_Weapons[2][1]), SendClientMessage(playerid, -1, p_Str);
  1086. }
  1087. if(p_Weapons[3][0] != 0) { //Shotguns
  1088. GetWeaponName(p_Weapons[3][0], p_WeaponName, 32);
  1089. format(p_Str, sizeof(p_Str), " * Shotgun: %s [Ammo: %d]", p_WeaponName, p_Weapons[3][1]), SendClientMessage(playerid, -1, p_Str);
  1090. }
  1091. if(p_Weapons[4][0] != 0) { //SMGs
  1092. GetWeaponName(p_Weapons[4][0], p_WeaponName, 32);
  1093. format(p_Str, sizeof(p_Str), " * SMG: %s [Ammo: %d]", p_WeaponName, p_Weapons[4][1]), SendClientMessage(playerid, -1, p_Str);
  1094. }
  1095. if(p_Weapons[5][0] != 0) { //Assault Rifles
  1096. GetWeaponName(p_Weapons[5][0], p_WeaponName, 32);
  1097. format(p_Str, sizeof(p_Str), " * Assault Rifle: %s [Ammo: %d]", p_WeaponName, p_Weapons[5][1]), SendClientMessage(playerid, -1, p_Str);
  1098. }
  1099. if(p_Weapons[6][0] != 0) {
  1100. GetWeaponName(p_Weapons[6][0], p_WeaponName, 32);
  1101. format(p_Str, sizeof(p_Str), " * Rifle: %s [Ammo: %d]", p_WeaponName, p_Weapons[6][1]), SendClientMessage(playerid, -1, p_Str);
  1102. }
  1103. if(p_Weapons[7][0] != 0) {
  1104. GetWeaponName(p_Weapons[7][0], p_WeaponName, 32);
  1105. format(p_Str, sizeof(p_Str), " * {ED2D07}Forbidden Weapon: %s [Ammo: %d]", p_WeaponName, p_Weapons[7][1]), SendClientMessage(playerid, -1, p_Str);
  1106.  
  1107. format(p_Str, sizeof(p_Str), "[ANTI2K] Forbidden weapon detected on %s, banning player...", p_Name);
  1108. SendClientMessageToAll(c_ERROR, p_Str);
  1109.  
  1110. BanEx(p_ID, "Weapon Hacks");
  1111. }
  1112.  
  1113. format(p_Str, sizeof(p_Str), "- Opened dialog: {FFFFFF}%s", d_Name), SendClientMessage(playerid, c_GENERAL, p_Str);
  1114. return format(p_Str, sizeof(p_Str), "- Detected state: {FFFFFF}%s", GetPlayerScriptState(p_ID)), SendClientMessage(playerid, c_GENERAL, p_Str);
  1115. }
  1116. else return NOAUTH;
  1117. }
  1118.  
  1119. CMD:kick(playerid, params[])
  1120. {
  1121. if(p_Data[playerid][Auth] >= 1)
  1122. {
  1123. new
  1124. p_ID,
  1125. a_Reason[64],
  1126. p_Str[128],
  1127. a_Name[MAX_PLAYER_NAME],
  1128. p_Name[MAX_PLAYER_NAME]
  1129. ;
  1130.  
  1131. if(sscanf(params, "iS()[64]", p_ID, a_Reason))
  1132. return SendClientMessage(playerid, c_CMD, "< /kick <Player ID> <Reason[Optional]>");
  1133.  
  1134. GetPlayerNameEx(playerid, a_Name, 24);
  1135. GetPlayerNameEx(p_ID, p_Name, 24);
  1136.  
  1137. if(!a_Reason[0]) { //They didn't enter a reason..
  1138. format(p_Str, sizeof(p_Str), "{1B42E0}KICK: {FFFFFF}%s %s has booted %s from the server.", GetPlayerTitle(playerid), a_Name, p_Name);
  1139. printf("[Kick] %s has been booted from the server by %s %s", p_Name, GetPlayerTitle(playerid), a_Name);
  1140. }
  1141. else { //They entered a reason..
  1142. if(strlen(a_Reason) > 64) return SendClientMessage(playerid, c_ERROR, "< /kick - Please shorten the 'reason' parameter.");
  1143.  
  1144. format(p_Str, sizeof(p_Str), "{1B42E0}KICK: {FFFFFF}%s %s has booted %s from the server, Reason: {1B42E0}%s", GetPlayerTitle(playerid), a_Name, p_Name, a_Reason);
  1145. printf("[Kick] %s has been booted from the server by %s %s,", p_Name, GetPlayerTitle(playerid), a_Name);
  1146. printf("\tReason: %s", a_Reason);
  1147. }
  1148. SendClientMessageToAll(-1, p_Str);
  1149.  
  1150. return Kick(p_ID);
  1151. }
  1152. else return NOAUTH;
  1153. }
  1154.  
  1155. /* ADMINISTRATOR COMMANDS */
  1156.  
  1157. CMD:spawnvehicle(playerid, params[])
  1158. {
  1159. new
  1160. v_ID,
  1161. v_COL1,
  1162. v_COL2
  1163. ;
  1164.  
  1165. if(sscanf(params, "iI(0)I(0)", v_ID, v_COL1, v_COL2))
  1166. return SendClientMessage(playerid, c_CMD, "< /spawnvehicle <Vehicle ID> <Col. 1[Optional]> <Col. 2[Optional]>");
  1167.  
  1168. if(p_Data[playerid][Auth] == 2)
  1169. {
  1170.  
  1171. if(p_SpawnedVehicle[playerid] != -1) {
  1172.  
  1173. SendClientMessage(playerid, c_CMD, "< Your previously spawned vehicle has been despawned.");
  1174. DestroyVehicle(p_SpawnedVehicle[playerid]);
  1175. p_SpawnedVehicle[playerid] = -1;
  1176.  
  1177. }
  1178.  
  1179. new
  1180. v_Str[128],
  1181. Float:p_Pos[4]
  1182. ;
  1183.  
  1184. GetPlayerPos(playerid, p_Pos[0], p_Pos[1], p_Pos[2]);
  1185. GetPlayerFacingAngle(playerid, p_Pos[3]);
  1186.  
  1187. p_SpawnedVehicle[playerid] = CreateVehicle(v_ID, p_Pos[0], p_Pos[1], p_Pos[2], p_Pos[3], v_COL1, v_COL2, 60000);
  1188. PutPlayerInVehicle(playerid, p_SpawnedVehicle[playerid], 0);
  1189.  
  1190. format(v_Str, sizeof(v_Str), "< You have spawned a vehicle. (INFO) Model: %d | Vehicle ID: %d | COLOR 1: %d | COLOR 2: %d", v_ID, GetPlayerVehicleID(playerid), v_COL1, v_COL2);
  1191. return SendClientMessage(playerid, c_GENERAL, v_Str);
  1192. }
  1193. else return NOAUTH;
  1194. }
  1195.  
  1196. CMD:ban(playerid, params[])
  1197. {
  1198. if(p_Data[playerid][Auth] == 2)
  1199. {
  1200. new
  1201. p_ID,
  1202. p_Str[128],
  1203. p_Name[MAX_PLAYER_NAME],
  1204. a_Reason[64],
  1205. a_Name[MAX_PLAYER_NAME]
  1206. ;
  1207.  
  1208. if(sscanf(params, "uS()[64]", p_ID, a_Reason))
  1209. return SendClientMessage(playerid, c_CMD, "< /ban <Player ID> <Reason>");
  1210.  
  1211. GetPlayerNameEx(playerid, a_Name, 24);
  1212. GetPlayerNameEx(p_ID, p_Name, 24);
  1213.  
  1214. if(strlen(a_Reason) > 64) return SendClientMessage(playerid, c_ERROR, "< /ban - Please shorten the 'reason' parameter.");
  1215.  
  1216. format(p_Str, sizeof(p_Str), "{1B42E0}BAN: {FFFFFF}%s %s has banished %s from the server, Reason: {1B42E0}%s", GetPlayerTitle(playerid), a_Name, p_Name, a_Reason);
  1217. printf("[Ban] %s has been banished from the server by %s %s,", p_Name, GetPlayerTitle(playerid), a_Name);
  1218. printf("\t Reason: %s", a_Reason);
  1219.  
  1220. return BanEx(p_ID, a_Reason);
  1221. }
  1222. else return NOAUTH;
  1223. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement