Advertisement
v0VExxx

Blockmaker

Dec 4th, 2012
544
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 213.24 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <cstrike>
  4. #include <engine>
  5. #include <fakemeta>
  6. #include <hamsandwich>
  7. #include <fun>
  8. #include <colorchat>
  9.  
  10. #define PLUGIN_NAME "JumpGround Course maker"
  11. #define PLUGIN_VERSION "4.0"
  12. #define PLUGIN_AUTHOR "anderseN"
  13. #define PLUGIN_PREFIX "JCM"
  14. new const prefix[] = "^4[JumpGround]^3";
  15.  
  16. new const szMenuCmd[][] =
  17. {
  18. "/jcm",
  19. "/scm",
  20. "/ccm",
  21. "/bcm",
  22. "/bm",
  23. "/lcm",
  24. "/gcm",
  25. "/ecm",
  26. "/build",
  27. "/blocks"
  28. };
  29.  
  30. new const g_blank[] = "";
  31. new const g_a[] = "a";
  32. new const g_b[] = "b";
  33.  
  34. new const g_block_classname[] = "JCM_Block";
  35. new const g_start_classname[] = "JCM_TeleportStart";
  36. new const g_destination_classname[] = "JCM_TeleportDestination";
  37. new const g_light_classname[] = "JCM_Light";
  38. new const g_box_classname[] = "JCM_Box";
  39.  
  40. new const g_model_platform[] = "models/JumpGround/Blocks/Normal/Platform.mdl";
  41. new const g_model_bunnyhop[] = "models/JumpGround/Blocks/Normal/Bunnyhop.mdl";
  42. new const g_model_damage[] = "models/JumpGround/Blocks/Normal/Damage.mdl";
  43. new const g_model_healer[] = "models/JumpGround/Blocks/Normal/Healer.mdl";
  44. new const g_model_no_fall_damage[] = "models/JumpGround/Blocks/Normal/NoFallDamage.mdl";
  45. new const g_model_ice[] = "models/JumpGround/Blocks/Normal/Ice.mdl";
  46. new const g_model_trampoline[] = "models/JumpGround/Blocks/Normal/Trampoline.mdl";
  47. new const g_model_speed_boost[] = "models/JumpGround/Blocks/Normal/SpeedBoost.mdl";
  48. new const g_model_death[] = "models/JumpGround/Blocks/Normal/Death.mdl";
  49. new const g_model_low_gravity[] = "models/JumpGround/Blocks/Normal/LowGravity.mdl";
  50. new const g_model_slap[] = "models/JumpGround/Blocks/Normal/Slap.mdl";
  51. new const g_model_honey[] = "models/JumpGround/Blocks/Normal/Honey1.mdl";
  52. new const g_model_ct_barrier[] = "models/JumpGround/Blocks/Normal/CT_Barrier.mdl";
  53. new const g_model_t_barrier[] = "models/JumpGround/Blocks/Normal/T_Barrier.mdl";
  54. new const g_model_glass[] = "models/JumpGround/Blocks/Normal/Platform.mdl";
  55. new const g_model_no_slow_down_bunnyhop[] = "models/JumpGround/Blocks/Normal/NoSlowDown_Bunnyhop.mdl";
  56. new const g_model_delayed_bunnyhop[] = "models/JumpGround/Blocks/Normal/Delayed_Bunnyhop.mdl";
  57. new const g_model_invincibility[] = "models/JumpGround/Blocks/Normal/Invincibility.mdl";
  58. new const g_model_stealth[] = "models/JumpGround/Blocks/Normal/Stealth.mdl";
  59. new const g_model_boots_of_speed[] = "models/JumpGround/Blocks/Normal/BootsOfSpeed.mdl";
  60. new const g_model_superman[] = "models/JumpGround/Blocks/Normal/Superman.mdl";
  61. new const g_model_nades[] = "models/JumpGround/Blocks/Normal/Nades.mdl";
  62. new const g_model_magic[] = "models/JumpGround/Blocks/Normal/Carpet.mdl";
  63. new const g_model_deagle[] = "models/JumpGround/Blocks/Normal/Deagle.mdl";
  64. new const g_model_awp[] = "models/JumpGround/Blocks/Normal/Awp.mdl";
  65.  
  66. new const g_sprite_light[] = "sprites/JG/light.spr";
  67. new const g_model_box[] = "models/Box/Box.mdl";
  68.  
  69. new const g_sprite_teleport_start[] = "sprites/JG/teleport_start.spr";
  70. new const g_sprite_teleport_destination[] = "sprites/JG/teleport_end.spr";
  71.  
  72. new const g_sound_invincibility[] = "BrutalCS/invincibility.wav";
  73. new const g_sound_stealth[] = "BrutalCS/stealth.wav";
  74. new const g_sound_boots_of_speed[] = "BrutalCS/bootsofspeed.wav";
  75. new const g_sound_superman[] = "BrutalCS/superman.wav";
  76.  
  77. new g_sprite_beam;
  78. new bool:g_deagle_used [33];
  79. new bool:g_awp_used [33];
  80.  
  81. enum ( <<= 1 )
  82. {
  83. B1 = 1,
  84. B2,
  85. B3,
  86. B4,
  87. B5,
  88. B6,
  89. B7,
  90. B8,
  91. B9,
  92. B0
  93. };
  94.  
  95. enum
  96. {
  97. K1,
  98. K2,
  99. K3,
  100. K4,
  101. K5,
  102. K6,
  103. K7,
  104. K8,
  105. K9,
  106. K0
  107. };
  108.  
  109. enum
  110. {
  111. CHOICE_DELETE,
  112. CHOICE_LOAD
  113. };
  114.  
  115. enum
  116. {
  117. X,
  118. Y,
  119. Z
  120. };
  121.  
  122. enum ( += 1000 )
  123. {
  124. TASK_SPRITE = 1000,
  125. TASK_SOLID,
  126. TASK_SOLIDNOT,
  127. TASK_ICE,
  128. TASK_HONEY,
  129. TASK_NOSLOWDOWN,
  130. TASK_INVINCIBLE,
  131. TASK_STEALTH,
  132. TASK_BOOTSOFSPEED,
  133. TASK_SUPERMAN
  134. };
  135.  
  136. new g_file[64];
  137.  
  138. new g_keys_main_menu;
  139. new g_keys_block_menu;
  140. new g_keys_block_selection_menu;
  141. new g_keys_properties_menu;
  142. new g_keys_move_menu;
  143. new g_keys_teleport_menu;
  144. new g_keys_light_menu;
  145. new g_keys_light_properties_menu;
  146. new g_keys_options_menu;
  147. new g_keys_choice_menu;
  148. new g_keys_commands_menu;
  149. new g_keys_box_menu;
  150.  
  151. new g_main_menu[256];
  152. new g_block_menu[256];
  153. new g_move_menu[256];
  154. new g_teleport_menu[256];
  155. new g_light_menu[128];
  156. new g_light_properties_menu[256];
  157. new g_options_menu[256];
  158. new g_choice_menu[128];
  159. new g_commands_menu[256];
  160. new g_box_menu[128];
  161.  
  162. new g_viewmodel[33][32];
  163.  
  164. new bool:g_connected[33];
  165. new bool:g_alive[33];
  166. new bool:g_admin[33];
  167. new bool:g_gived_access[33];
  168. new bool:g_snapping[33];
  169. new bool:g_viewing_properties_menu[33];
  170. new bool:g_viewing_light_properties_menu[33];
  171. new bool:g_viewing_commands_menu[33];
  172. new bool:g_no_fall_damage[33];
  173. new bool:g_ice[33];
  174. new bool:g_low_gravity[33];
  175. new bool:g_no_slow_down[33];
  176. new bool:g_has_hud_text[33];
  177. new bool:g_block_status[33];
  178. new bool:g_noclip[33];
  179. new bool:g_godmode[33];
  180. new bool:g_all_godmode;
  181. new bool:g_has_checkpoint[33];
  182. new bool:g_checkpoint_duck[33];
  183. new bool:g_reseted[33];
  184.  
  185. new g_selected_block_size[33];
  186. new g_choice_option[33];
  187. new g_block_selection_page[33];
  188. new g_teleport_start[33];
  189. new g_grabbed[33];
  190. new g_grouped_blocks[33][256];
  191. new g_group_count[33];
  192. new g_property_info[33][2];
  193. new g_light_property_info[33][2];
  194. new g_slap_times[33];
  195. new g_honey[33];
  196. new g_boots_of_speed[33];
  197.  
  198.  
  199. new Float:g_grid_size[33];
  200. new Float:g_snapping_gap[33];
  201. new Float:g_grab_offset[33][3];
  202. new Float:g_grab_length[33];
  203. new Float:g_next_damage_time[33];
  204. new Float:g_next_heal_time[33];
  205. new Float:g_invincibility_time_out[33];
  206. new Float:g_invincibility_next_use[33];
  207. new Float:g_stealth_time_out[33];
  208. new Float:g_stealth_next_use[33];
  209. new Float:g_boots_of_speed_time_out[33];
  210. new Float:g_boots_of_speed_next_use[33];
  211. new Float:g_set_velocity[33][3];
  212. new Float:g_checkpoint_position[33][3];
  213.  
  214. new Float:g_superman_time_out[33];
  215. new Float:g_superman_next_use[33];
  216. new Float:g_nades_next_use[33];
  217.  
  218. new g_cvar_textures;
  219.  
  220. new g_max_players;
  221.  
  222. enum
  223. {
  224. PLATFORM,
  225. BUNNYHOP,
  226. DAMAGE,
  227. HEALER,
  228. NO_FALL_DAMAGE,
  229. ICE,
  230. TRAMPOLINE,
  231. SPEED_BOOST,
  232. DEATH,
  233. LOW_GRAVITY,
  234. SLAP,
  235. HONEY,
  236. CT_BARRIER,
  237. T_BARRIER,
  238. GLASS,
  239. NO_SLOW_DOWN_BUNNYHOP,
  240. DELAYED_BUNNYHOP,
  241. INVINCIBILITY,
  242. STEALTH,
  243. BOOTS_OF_SPEED,
  244. SUPERMAN,
  245. NADES,
  246. MAGIC,
  247. DEAGLE,
  248. AWP,
  249.  
  250. TOTAL_BLOCKS
  251. };
  252.  
  253. enum
  254. {
  255. TELEPORT_START,
  256. TELEPORT_DESTINATION
  257. };
  258.  
  259. enum
  260. {
  261. NORMAL,
  262. TINY,
  263. LARGE,
  264. POLE
  265. };
  266.  
  267.  
  268. enum
  269. {
  270. NORMAL,
  271. GLOWSHELL,
  272. TRANSCOLOR,
  273. TRANSALPHA,
  274. TRANSWHITE
  275. };
  276.  
  277. new g_selected_block_type[TOTAL_BLOCKS];
  278. new g_render[TOTAL_BLOCKS];
  279. new g_red[TOTAL_BLOCKS];
  280. new g_green[TOTAL_BLOCKS];
  281. new g_blue[TOTAL_BLOCKS];
  282. new g_alpha[TOTAL_BLOCKS];
  283.  
  284. new const g_block_names[TOTAL_BLOCKS][] =
  285. {
  286. "Platform",
  287. "Bunnyhop",
  288. "Damage",
  289. "Healer",
  290. "No Fall Damage",
  291. "Ice",
  292. "Trampoline",
  293. "Speed Boost",
  294. "Death",
  295. "Low Gravity",
  296. "Slap",
  297. "Honey",
  298. "CT Barrier",
  299. "T Barrier",
  300. "Glass",
  301. "No Slow Down Bunnyhop",
  302. "Delayed Bunnyhop",
  303. "Invincibility",
  304. "Stealth",
  305. "Boots Of Speed",
  306. "Superman",
  307. "Nade Selection",
  308. "Magic Carpet",
  309. "Deagle",
  310. "Awp"
  311. };
  312.  
  313. new const g_property1_name[TOTAL_BLOCKS][] =
  314. {
  315. "",
  316. "No Fall Damage",
  317. "Damage Per Interval",
  318. "Health Per Interval",
  319. "",
  320. "",
  321. "Upward Speed",
  322. "Forward Speed",
  323. "",
  324. "Gravity",
  325. "Hardness",
  326. "Speed In Honey",
  327. "",
  328. "",
  329. "",
  330. "No Fall Damage",
  331. "Delay Before Dissapear",
  332. "Invincibility Time",
  333. "Stealth Time",
  334. "Boots Of Speed Time",
  335. "Superman Time",
  336. "",
  337. "Team",
  338. "",
  339. ""
  340. };
  341.  
  342. new const g_property1_default_value[TOTAL_BLOCKS][] =
  343. {
  344. "",
  345. "0",
  346. "5",
  347. "1",
  348. "",
  349. "",
  350. "500",
  351. "800",
  352. "",
  353. "200",
  354. "2",
  355. "75",
  356. "",
  357. "",
  358. "",
  359. "0",
  360. "1",
  361. "10",
  362. "10",
  363. "10",
  364. "10",
  365. "",
  366. "1",
  367. "",
  368. ""
  369. };
  370.  
  371. new const g_property2_name[TOTAL_BLOCKS][] =
  372. {
  373. "",
  374. "",
  375. "Interval Between Damage",
  376. "Interval Between Heals",
  377. "",
  378. "",
  379. "",
  380. "Upward Speed",
  381. "",
  382. "",
  383. "",
  384. "",
  385. "",
  386. "",
  387. "",
  388. "",
  389. "",
  390. "Delay After Usage",
  391. "Delay After Usage",
  392. "Delay After Usage",
  393. "Delay After Usage",
  394. "Delay After Usage",
  395. "",
  396. "",
  397. ""
  398. };
  399.  
  400. new const g_property2_default_value[TOTAL_BLOCKS][] =
  401. {
  402. "",
  403. "",
  404. "0.5",
  405. "0.5",
  406. "",
  407. "",
  408. "",
  409. "260",
  410. "",
  411. "",
  412. "",
  413. "",
  414. "",
  415. "",
  416. "",
  417. "",
  418. "",
  419. "60",
  420. "60",
  421. "60",
  422. "60",
  423. "180",
  424. "",
  425. "",
  426. ""
  427. };
  428.  
  429. new const g_property3_name[TOTAL_BLOCKS][] =
  430. {
  431. "Transparency",
  432. "Transparency",
  433. "Transparency",
  434. "Transparency",
  435. "Transparency",
  436. "Transparency",
  437. "Transparency",
  438. "Transparency",
  439. "Transparency",
  440. "Transparency",
  441. "Transparency",
  442. "Transparency",
  443. "Transparency",
  444. "Transparency",
  445. "",
  446. "Transparency",
  447. "Transparency",
  448. "",
  449. "",
  450. "Speed",
  451. "Transparency",
  452. "Transparency",
  453. "Transparency",
  454. "Transparency",
  455. "Transparency"
  456. };
  457.  
  458. new const g_property3_default_value[TOTAL_BLOCKS][] =
  459. {
  460. "255",
  461. "255",
  462. "255",
  463. "255",
  464. "255",
  465. "255",
  466. "255",
  467. "255",
  468. "255",
  469. "255",
  470. "255",
  471. "255",
  472. "255",
  473. "255",
  474. "",
  475. "255",
  476. "255",
  477. "",
  478. "",
  479. "400",
  480. "255",
  481. "255",
  482. "255",
  483. "255",
  484. "255"
  485. };
  486.  
  487. new const g_property4_name[TOTAL_BLOCKS][] =
  488. {
  489. "",
  490. "On Top Only",
  491. "On Top Only",
  492. "On Top Only",
  493. "",
  494. "",
  495. "On Top Only",
  496. "On Top Only",
  497. "On Top Only",
  498. "On Top Only",
  499. "On Top Only",
  500. "On Top Only",
  501. "On Top Only",
  502. "On Top Only",
  503. "",
  504. "On Top Only",
  505. "On Top Only",
  506. "On Top Only",
  507. "On Top Only",
  508. "On Top Only",
  509. "On Top Only",
  510. "On Top Only",
  511. "On Top Only",
  512. "On Top Only",
  513. "On Top Only"
  514. };
  515.  
  516. new const g_property4_default_value[TOTAL_BLOCKS][] =
  517. {
  518. "",
  519. "0",
  520. "1",
  521. "1",
  522. "",
  523. "",
  524. "1",
  525. "1",
  526. "1",
  527. "0",
  528. "1",
  529. "0",
  530. "0",
  531. "0",
  532. "",
  533. "0",
  534. "0",
  535. "1",
  536. "1",
  537. "1",
  538. "1",
  539. "1",
  540. "1",
  541. "1",
  542. "1"
  543. };
  544.  
  545. new const g_block_save_ids[TOTAL_BLOCKS] =
  546. {
  547. 'A',
  548. 'B',
  549. 'C',
  550. 'D',
  551. 'E',
  552. 'F',
  553. 'G',
  554. 'H',
  555. 'I',
  556. 'J',
  557. 'K',
  558. 'L',
  559. 'M',
  560. 'N',
  561. 'O',
  562. 'P',
  563. 'Q',
  564. 'R',
  565. 'S',
  566. 'T',
  567. '1',
  568. '2',
  569. '3',
  570. '4',
  571. '5'
  572. };
  573.  
  574. new g_block_models[TOTAL_BLOCKS][256];
  575.  
  576. new g_block_selection_pages_max;
  577.  
  578. public plugin_precache()
  579. {
  580. g_block_models[PLATFORM] = g_model_platform;
  581. g_block_models[BUNNYHOP] = g_model_bunnyhop;
  582. g_block_models[DAMAGE] = g_model_damage;
  583. g_block_models[HEALER] = g_model_healer;
  584. g_block_models[NO_FALL_DAMAGE] = g_model_no_fall_damage;
  585. g_block_models[ICE] = g_model_ice;
  586. g_block_models[TRAMPOLINE] = g_model_trampoline;
  587. g_block_models[SPEED_BOOST] = g_model_speed_boost;
  588. g_block_models[DEATH] = g_model_death;
  589. g_block_models[LOW_GRAVITY] = g_model_low_gravity;
  590. g_block_models[SLAP] = g_model_slap;
  591. g_block_models[HONEY] = g_model_honey;
  592. g_block_models[CT_BARRIER] = g_model_ct_barrier;
  593. g_block_models[T_BARRIER] = g_model_t_barrier;
  594. g_block_models[GLASS] = g_model_glass;
  595. g_block_models[NO_SLOW_DOWN_BUNNYHOP] = g_model_no_slow_down_bunnyhop;
  596. g_block_models[DELAYED_BUNNYHOP] = g_model_delayed_bunnyhop;
  597. g_block_models[INVINCIBILITY] = g_model_invincibility;
  598. g_block_models[STEALTH] = g_model_stealth;
  599. g_block_models[BOOTS_OF_SPEED] = g_model_boots_of_speed;
  600. g_block_models[SUPERMAN] = g_model_superman;
  601. g_block_models[NADES] = g_model_nades;
  602. g_block_models[MAGIC] = g_model_magic;
  603. g_block_models[DEAGLE] = g_model_deagle;
  604. g_block_models[AWP] = g_model_awp;
  605.  
  606. SetupBlockRendering(GLASS, TRANSWHITE, 255, 255, 255, 100);
  607. SetupBlockRendering(INVINCIBILITY, GLOWSHELL, 255, 255, 255, 5);
  608. SetupBlockRendering(NADES, GLOWSHELL, 255, 255, 255, 7);
  609.  
  610.  
  611. new block_model[256];
  612. for ( new i = 0; i < TOTAL_BLOCKS; ++i )
  613. {
  614. precache_model(g_block_models[i]);
  615.  
  616. SetBlockModelName(block_model, g_block_models[i], "Tiny");
  617. precache_model(block_model);
  618.  
  619. SetBlockModelName(block_model, g_block_models[i], "Large");
  620. precache_model(block_model);
  621.  
  622. SetBlockModelName(block_model, g_block_models[i], "Pole");
  623. precache_model(block_model);
  624. }
  625.  
  626. precache_model(g_sprite_light);
  627. precache_model(g_model_box);
  628.  
  629. precache_model(g_sprite_teleport_start);
  630. precache_model(g_sprite_teleport_destination);
  631. g_sprite_beam = precache_model("sprites/zbeam4.spr");
  632.  
  633. precache_sound(g_sound_invincibility);
  634. precache_sound(g_sound_stealth);
  635. precache_sound(g_sound_boots_of_speed);
  636. precache_sound(g_sound_superman);
  637. }
  638.  
  639. public plugin_init()
  640. {
  641. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
  642.  
  643. for( new iCmd = 0; iCmd < sizeof(szMenuCmd); iCmd++ )
  644. {
  645. new iCommand[15];
  646. formatex(iCommand, charsmax(iCommand), "say %s", szMenuCmd[iCmd]);
  647. RegisterSayCmd(iCommand, "CmdMainMenu");
  648. }
  649.  
  650. new command[32] = "CmdShowInfo";
  651. RegisterSayCmd("BM", command);
  652. RegisterSayCmd("Info", command);
  653. RegisterSayCmd("Help", command);
  654.  
  655. command = "CmdSaveCheckpoint";
  656. RegisterSayCmd("cp", command);
  657. RegisterSayCmd("savecp", command);
  658. RegisterSayCmd("checkpoint", command);
  659. RegisterSayCmd("savecheckpoint", command);
  660.  
  661. command = "CmdLoadCheckpoint";
  662. RegisterSayCmd("tp", command);
  663. RegisterSayCmd("gocheck", command);
  664. RegisterSayCmd("teleport", command);
  665. RegisterSayCmd("loadcheck", command);
  666. RegisterSayCmd("teleportcp", command);
  667. RegisterSayCmd("gocheckpoint", command);
  668. RegisterSayCmd("loadcheckpoint", command);
  669.  
  670. command = "CmdReviveYourself";
  671. RegisterSayCmd("rs", command);
  672. RegisterSayCmd("spawn", command);
  673. RegisterSayCmd("revive", command);
  674. RegisterSayCmd("respawn", command);
  675. RegisterSayCmd("restart", command);
  676.  
  677. register_clcmd("JCM_SetProperty", "SetPropertyBlock", -1);
  678. register_clcmd("JCM_SetLightProperty", "SetPropertyLight", -1);
  679. register_clcmd("JCM_Revive", "RevivePlayer", -1);
  680. register_clcmd("JCM_GiveAccess", "GiveAccess", -1);
  681.  
  682. command = "CmdGrab";
  683. register_clcmd("+jcmGrab", command, -1, g_blank);
  684. register_clcmd("+jcmGrab", command, -1, g_blank);
  685.  
  686. command = "CmdRelease";
  687. register_clcmd("-jcmGrab", command, -1, g_blank);
  688. register_clcmd("-jcmGrab", command, -1, g_blank);
  689.  
  690. CreateMenus();
  691.  
  692. register_menucmd(register_menuid("JcmMainMenu"), g_keys_main_menu, "HandleMainMenu");
  693. register_menucmd(register_menuid("JcmBlockMenu"), g_keys_block_menu, "HandleBlockMenu");
  694. register_menucmd(register_menuid("JcmBlockSelectionMenu"), g_keys_block_selection_menu, "HandleBlockSelectionMenu");
  695. register_menucmd(register_menuid("JcmPropertiesMenu"), g_keys_properties_menu, "HandlePropertiesMenu");
  696. register_menucmd(register_menuid("JcmMoveMenu"), g_keys_move_menu, "HandleMoveMenu");
  697. register_menucmd(register_menuid("JcmTeleportMenu"), g_keys_teleport_menu, "HandleTeleportMenu");
  698. register_menucmd(register_menuid("JcmLightMenu"), g_keys_light_menu, "HandleLightMenu");
  699. register_menucmd(register_menuid("JcmLightPropertiesMenu"), g_keys_light_properties_menu, "HandleLightPropertiesMenu");
  700. register_menucmd(register_menuid("JcmOptionsMenu"), g_keys_options_menu, "HandleOptionsMenu");
  701. register_menucmd(register_menuid("JcmChoiceMenu"), g_keys_choice_menu, "HandleChoiceMenu");
  702. register_menucmd(register_menuid("JcmCommandsMenu"), g_keys_commands_menu, "HandleCommandsMenu");
  703. register_menucmd(register_menuid("JcmBoxMenu"), g_keys_box_menu, "HandleBoxMenu");
  704.  
  705. RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawn", 1);
  706. RegisterHam(Ham_Killed, "player", "FwdPlayerKilled", 1);
  707.  
  708. register_forward(FM_CmdStart, "FwdCmdStart");
  709.  
  710. register_think(g_light_classname, "LightThink");
  711. register_think(g_box_classname, "BoxThink");
  712.  
  713. register_event("CurWeapon", "EventCurWeapon", "be");
  714. register_event("HLTV", "eventNewRound", "a", "1=0", "2=0");
  715.  
  716. register_message(get_user_msgid("StatusValue"), "MsgStatusValue");
  717.  
  718. g_cvar_textures = register_cvar("JCM_Textures", "anderseN", 0, 0.0);
  719.  
  720. g_max_players = get_maxplayers();
  721.  
  722. new dir[64];
  723. get_datadir(dir, charsmax(dir));
  724.  
  725. new folder[64];
  726. formatex(folder, charsmax(folder), "/%s", PLUGIN_PREFIX);
  727.  
  728. add(dir, charsmax(dir), folder);
  729. if ( !dir_exists(dir) ) mkdir(dir);
  730.  
  731. new map[32];
  732. get_mapname(map, charsmax(map));
  733.  
  734. formatex(g_file, charsmax(g_file), "%s/%s.%s", dir, map, PLUGIN_PREFIX);
  735. }
  736.  
  737. public plugin_cfg()
  738. {
  739. LoadBlocks(0);
  740. }
  741.  
  742. public client_putinserver(id)
  743. {
  744. g_connected[id] = bool:!is_user_hltv(id);
  745. g_alive[id] = false;
  746.  
  747. g_admin[id] = bool:access(id, ADMIN_RCON);
  748. g_gived_access[id] = false;
  749.  
  750. g_viewing_properties_menu[id] = false;
  751. g_viewing_light_properties_menu[id] = false;
  752. g_viewing_commands_menu[id] = false;
  753.  
  754. g_snapping[id] = true;
  755.  
  756. g_grid_size[id] = 1.0;
  757. g_snapping_gap[id] = 0.0;
  758.  
  759. g_group_count[id] = 0;
  760.  
  761. g_noclip[id] = false;
  762. g_godmode[id] = false;
  763.  
  764. g_has_checkpoint[id] = false;
  765. g_checkpoint_duck[id] = false;
  766.  
  767. g_reseted[id] = false;
  768.  
  769. ResetPlayer(id);
  770. }
  771.  
  772. public client_disconnect(id)
  773. {
  774. g_connected[id] = false;
  775. g_alive[id] = false;
  776.  
  777. ClearGroup(id);
  778.  
  779. if ( g_grabbed[id] )
  780. {
  781. if ( is_valid_ent(g_grabbed[id]) )
  782. {
  783. entity_set_int(g_grabbed[id], EV_INT_iuser2, 0);
  784. }
  785.  
  786. g_grabbed[id] = 0;
  787. }
  788. }
  789.  
  790. RegisterSayCmd(const command[], const handle[])
  791. {
  792. static temp[64];
  793.  
  794. register_clcmd(command, handle, -1, g_blank);
  795.  
  796. formatex(temp, charsmax(temp), "say /jcm", command);
  797. register_clcmd(temp, handle, -1, g_blank);
  798.  
  799. formatex(temp, charsmax(temp), "say_team /jcm", command);
  800. register_clcmd(temp, handle, -1, g_blank);
  801. }
  802.  
  803. CreateMenus()
  804. {
  805. g_block_selection_pages_max = floatround((float(TOTAL_BLOCKS) / 8.0), floatround_ceil);
  806.  
  807. new size = charsmax(g_main_menu);
  808. add(g_main_menu, size, "\yJumpGround Coursemaker \rV5.0^n^n");
  809. add(g_main_menu, size, "\r1. \wBlock Menu^n");
  810. add(g_main_menu, size, "\r2. \wTeleport Menu^n");
  811. add(g_main_menu, size, "\r3. \wLight Menu^n");
  812. add(g_main_menu, size, "\r4. \wBox Menu^n^n");
  813. add(g_main_menu, size, "\r5. \wJoin Spectator^n^n");
  814. add(g_main_menu, size, "\r6. \wNoclip: %s^n");
  815. add(g_main_menu, size, "\r7. \wGodmode: %s^n^n");
  816. add(g_main_menu, size, "\r8. \wCommands menu^n");
  817. add(g_main_menu, size, "\r9. \wOptions^n^n");
  818. add(g_main_menu, size, "\r0. \wClose");
  819. g_keys_main_menu = B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B0;
  820.  
  821. size = charsmax(g_block_menu);
  822. add(g_block_menu, size, "\r[%s] \yBlocks^n\yBlocks in map: \r%i^n^n");
  823. add(g_block_menu, size, "\r1. \wType: \y%s^n");
  824. add(g_block_menu, size, "\r2. \wSize: \y%s^n^n");
  825. add(g_block_menu, size, "%s3. %sCreate^n");
  826. add(g_block_menu, size, "%s4. %sConvert^n");
  827. add(g_block_menu, size, "%s5. %sDelete^n");
  828. add(g_block_menu, size, "%s6. %sRotate^n");
  829. add(g_block_menu, size, "%s7. %sSet Properties^n");
  830. add(g_block_menu, size, "%s8. %sMove^n^n");
  831. add(g_block_menu, size, "\r0. \wBack");
  832. g_keys_block_menu = B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B0;
  833. g_keys_block_selection_menu = B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B9 | B0;
  834. g_keys_properties_menu = B1 | B2 | B3 | B4 | B0;
  835.  
  836. size = charsmax(g_move_menu);
  837. add(g_move_menu, size, "\r[%s] \yMove Block^n^n");
  838. add(g_move_menu, size, "\r1. \wGrid Size: \y%.1f^n^n");
  839. add(g_move_menu, size, "\r2. \wZ\y+^n");
  840. add(g_move_menu, size, "\r3. \wZ\r-^n");
  841. add(g_move_menu, size, "\r4. \wX\y+^n");
  842. add(g_move_menu, size, "\r5. \wX\r-^n");
  843. add(g_move_menu, size, "\r6. \wY\y+^n");
  844. add(g_move_menu, size, "\r7. \wY\r-^n^n^n");
  845. add(g_move_menu, size, "\r0. \wBack");
  846. g_keys_move_menu = B1 | B2 | B3 | B4 | B5 | B6 | B7 | B0;
  847.  
  848. size = charsmax(g_teleport_menu);
  849. add(g_teleport_menu, size, "\r[%s] \yTeleports^n\yTeles in map: \r%i^n^n");
  850. add(g_teleport_menu, size, "%s1. %sCreate Start^n");
  851. add(g_teleport_menu, size, "%s2. %sCreate Destination^n^n");
  852. add(g_teleport_menu, size, "%s3. %sDelete Teleport^n^n");
  853. add(g_teleport_menu, size, "%s4. %sSwap Start/Destination^n^n");
  854. add(g_teleport_menu, size, "%s5. %sShow Path^n^n^n");
  855. add(g_teleport_menu, size, "\r0. \wBack");
  856. g_keys_teleport_menu = B1 | B2 | B3 | B4 | B5 | B0;
  857.  
  858. size = charsmax(g_light_menu);
  859. add(g_light_menu, size, "\r[%s] \yLights^n\yLights in map: \r%i^n^n");
  860. add(g_light_menu, size, "%s1. %sCreate Light^n");
  861. add(g_light_menu, size, "%s2. %sDelete Light^n^n");
  862. add(g_light_menu, size, "%s3. %sSet Properties^n^n^n^n^n^n^n");
  863. add(g_light_menu, size, "\r0. \wBack");
  864. g_keys_light_menu = B1 | B2 | B3 | B0;
  865.  
  866. size = charsmax(g_box_menu);
  867. add(g_box_menu, size, "\r[%s] \yBoxes^n\yBoxes in map: \r%i^n^n");
  868. add(g_box_menu, size, "%s1. %sCreate Box^n");
  869. add(g_box_menu, size, "%s2. %sDelete Box^n^n");
  870. add(g_box_menu, size, "\r0. \wBack");
  871. g_keys_box_menu = B1 | B2 | B3 | B0;
  872.  
  873. size = charsmax(g_light_properties_menu);
  874. add(g_light_properties_menu, size, "\r[%s] \ySet Properties^n^n");
  875. add(g_light_properties_menu, size, "\r1. \wRadius: \y%s^n");
  876. add(g_light_properties_menu, size, "\r2. \wColor Red: \y%s^n");
  877. add(g_light_properties_menu, size, "\r3. \wColor Green: \y%s^n");
  878. add(g_light_properties_menu, size, "\r4. \wColor Blue: \y%s^n^n^n^n^n^n^n");
  879. add(g_light_properties_menu, size, "\r0. \wBack");
  880. g_keys_light_properties_menu = B1 | B2 | B3 | B4 | B0;
  881.  
  882. size = charsmax(g_options_menu);
  883. add(g_options_menu, size, "\r[%s] \yOptions^n^n");
  884. add(g_options_menu, size, "%s1. %sSnapping: %s^n");
  885. add(g_options_menu, size, "%s2. %sSnapping Gap: \y%.1f^n^n");
  886. add(g_options_menu, size, "%s3. %sAdd to Group^n");
  887. add(g_options_menu, size, "%s4. %sClear Group^n^n");
  888. add(g_options_menu, size, "%s5. %sDelete All^n");
  889. add(g_options_menu, size, "%s6. %sSave^n");
  890. add(g_options_menu, size, "%s7. %sLoad^n^n");
  891. add(g_options_menu, size, "\r0. \wBack");
  892. g_keys_options_menu = B1 | B2 | B3 | B4 | B5 | B6 | B7 | B0;
  893.  
  894. size = charsmax(g_choice_menu);
  895. add(g_choice_menu, size, "\y%s^n^n");
  896. add(g_choice_menu, size, "\r1. \wYes^n");
  897. add(g_choice_menu, size, "\r2. \wNo^n^n^n^n^n^n^n^n^n");
  898. g_keys_choice_menu = B1 | B2;
  899.  
  900. size = charsmax(g_commands_menu);
  901. add(g_commands_menu, size, "\r[%s] \yCommands Menu^n^n");
  902. add(g_commands_menu, size, "%s1. %sSave Checkpoint^n");
  903. add(g_commands_menu, size, "%s2. %sLoad Checkpoint^n^n");
  904. add(g_commands_menu, size, "%s3. %sRevive Yourself^n");
  905. add(g_commands_menu, size, "%s4. %sRevive Player^n");
  906. add(g_commands_menu, size, "%s5. %sRevive Everyone^n^n");
  907. add(g_commands_menu, size, "%s6. %s%s Godmode %s Everyone^n");
  908. add(g_commands_menu, size, "%s7. %sGive Access to %s^n^n");
  909. add(g_commands_menu, size, "%s8. %sJoin Spectator^n^n");
  910. add(g_commands_menu, size, "\r0. \wBack");
  911. g_keys_commands_menu = B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 | B0;
  912. }
  913.  
  914. SetupBlockRendering(block_type, render_type, red, green, blue, alpha)
  915. {
  916. g_render[block_type] = render_type;
  917. g_red[block_type] = red;
  918. g_green[block_type] = green;
  919. g_blue[block_type] = blue;
  920. g_alpha[block_type] = alpha;
  921. }
  922.  
  923. SetBlockModelName(model_target[256], model_source[256], const new_name[])
  924. {
  925. model_target = model_source;
  926. replace(model_target, charsmax(model_target), "Normal", new_name);
  927. }
  928.  
  929. public FwdPlayerSpawn(id)
  930. {
  931. if ( !is_user_alive(id) ) return HAM_IGNORED;
  932.  
  933. g_alive[id] = true;
  934.  
  935. if ( g_noclip[id] ) set_user_noclip(id, 1);
  936. if ( g_godmode[id] ) set_user_godmode(id, 1);
  937.  
  938. if ( g_all_godmode )
  939. {
  940. for ( new i = 1; i <= g_max_players; i++ )
  941. {
  942. if ( !g_alive[i]
  943. || g_admin[i]
  944. || g_gived_access[i] ) continue;
  945.  
  946. entity_set_float(i, EV_FL_takedamage, DAMAGE_NO);
  947. }
  948. }
  949.  
  950. if ( g_viewing_commands_menu[id] ) ShowCommandsMenu(id);
  951.  
  952. if ( !g_reseted[id] )
  953. {
  954. ResetPlayer(id);
  955. }
  956.  
  957. g_reseted[id] = false;
  958.  
  959. return HAM_IGNORED;
  960. }
  961.  
  962. public FwdPlayerKilled(id)
  963. {
  964. g_alive[id] = bool:is_user_alive(id);
  965.  
  966. ResetPlayer(id);
  967.  
  968. if ( g_viewing_commands_menu[id] ) ShowCommandsMenu(id);
  969. }
  970.  
  971. public FwdCmdStart(id, handle)
  972. {
  973. if ( !g_connected[id] ) return FMRES_IGNORED;
  974.  
  975. static buttons, oldbuttons;
  976. buttons = get_uc(handle, UC_Buttons);
  977. oldbuttons = entity_get_int(id, EV_INT_oldbuttons);
  978.  
  979. if ( g_alive[id]
  980. && ( buttons & IN_USE )
  981. && !( oldbuttons & IN_USE )
  982. && !g_has_hud_text[id] )
  983. {
  984. static ent, body;
  985. get_user_aiming(id, ent, body, 9999);
  986.  
  987. if ( IsBlock(ent) )
  988. {
  989. static block_type;
  990. block_type = entity_get_int(ent, EV_INT_body);
  991.  
  992. static property[5];
  993.  
  994. static message[512], len;
  995. len = format(message, charsmax(message), "%s", g_block_names[block_type]);
  996.  
  997. if ( g_property1_name[block_type][0] )
  998. {
  999. if ( ( block_type == BUNNYHOP
  1000. || block_type == NO_SLOW_DOWN_BUNNYHOP )
  1001. && property[0] == '1' )
  1002. {
  1003. len += format(message[len], charsmax(message) - len, "%s", g_property1_name[block_type]);
  1004. }
  1005. else if ( block_type == SLAP )
  1006. {
  1007. len += format(message[len], charsmax(message) - len, "^n%s: %s", g_property1_name[block_type], property[0] == '3' ? "High" : property[0] == '2' ? "Medium" : "Low");
  1008. }
  1009. else if( block_type == MAGIC )
  1010. {
  1011. len += format(message[len], charsmax(message) - len, "^n%s: %s", g_property1_name[block_type], property[0] == '3' ? "Everyone" : property[0] == '2' ? "Counter-Terrorists" : "Terrorists");
  1012. }
  1013. else if ( block_type != BUNNYHOP
  1014. && block_type != NO_SLOW_DOWN_BUNNYHOP )
  1015. {
  1016. len += format(message[len], charsmax(message) - len, "^n%s: %s", g_property1_name[block_type], property);
  1017. }
  1018. }
  1019. if ( g_property2_name[block_type][0] )
  1020. {
  1021. GetProperty(ent, 2, property);
  1022.  
  1023. len += format(message[len], charsmax(message) - len, "^n%s: %s", g_property2_name[block_type], property);
  1024. }
  1025. if ( g_property3_name[block_type][0] )
  1026. {
  1027. GetProperty(ent, 3, property);
  1028.  
  1029. if ( block_type == BOOTS_OF_SPEED
  1030. || property[0] != '0'
  1031. && !( property[0] == '2' && property[1] == '5' && property[2] == '5' ) )
  1032. {
  1033. len += format(message[len], charsmax(message) - len, "^n%s: %s", g_property3_name[block_type], property);
  1034. }
  1035. }
  1036. if ( g_property4_name[block_type][0] )
  1037. {
  1038. GetProperty(ent, 4, property);
  1039.  
  1040. len += format(message[len], charsmax(message) - len, "^n%s: %s", g_property4_name[block_type], property[0] == '1' ? "Yes" : "No");
  1041. }
  1042.  
  1043. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1044. show_hudmessage(id, message);
  1045. }
  1046. else if ( IsLight(ent) )
  1047. {
  1048. static property1[20], property2[20], property3[20], property4[20];
  1049.  
  1050. GetProperty(ent, 1, property1);
  1051. GetProperty(ent, 2, property2);
  1052. GetProperty(ent, 3, property3);
  1053. GetProperty(ent, 4, property4);
  1054.  
  1055. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1056. show_hudmessage(id, "%s %s^nType: Light^nRadius: %s^nColor Red: %s^nColor Green: %s^nColor Blue: %s", PLUGIN_PREFIX, PLUGIN_VERSION, property1, property2, property3, property4);
  1057. }
  1058. else if ( IsBox(ent) )
  1059. {
  1060. static property1[20], property2[20], property3[20], property4[20];
  1061.  
  1062. GetProperty(ent, 1, property1);
  1063. GetProperty(ent, 2, property2);
  1064. GetProperty(ent, 3, property3);
  1065. GetProperty(ent, 4, property4);
  1066.  
  1067. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1068. show_hudmessage(id, "%s %s^nType: Box^nColor Red: %s^nColor Green: %s^nColor Blue: %s", PLUGIN_PREFIX, PLUGIN_VERSION, property1, property2, property3);
  1069. }
  1070. }
  1071.  
  1072. if ( !g_grabbed[id] ) return FMRES_IGNORED;
  1073.  
  1074. if ( ( buttons & IN_JUMP )
  1075. && !( oldbuttons & IN_JUMP ) ) if ( g_grab_length[id] > 72.0 ) g_grab_length[id] -= 16.0;
  1076.  
  1077. if ( ( buttons & IN_DUCK )
  1078. && !( oldbuttons & IN_DUCK ) ) g_grab_length[id] += 16.0;
  1079.  
  1080. if ( ( buttons & IN_ATTACK )
  1081. && !( oldbuttons & IN_ATTACK ) ) CmdAttack(id);
  1082.  
  1083. if ( ( buttons & IN_ATTACK2 )
  1084. && !( oldbuttons & IN_ATTACK2 ) ) CmdAttack2(id);
  1085.  
  1086. if ( ( buttons & IN_RELOAD )
  1087. && !( oldbuttons & IN_RELOAD ) )
  1088. {
  1089. CmdRotate(id);
  1090. set_uc(handle, UC_Buttons, buttons & ~IN_RELOAD);
  1091. }
  1092.  
  1093. if ( !is_valid_ent(g_grabbed[id]) )
  1094. {
  1095. CmdRelease(id);
  1096. return FMRES_IGNORED;
  1097. }
  1098.  
  1099. if ( !IsBlockInGroup(id, g_grabbed[id])
  1100. || g_group_count[id] < 1 )
  1101. {
  1102. MoveGrabbedEntity(id);
  1103. return FMRES_IGNORED;
  1104. }
  1105.  
  1106. static block;
  1107. static Float:move_to[3];
  1108. static Float:offset[3];
  1109. static Float:origin[3];
  1110.  
  1111. MoveGrabbedEntity(id, move_to);
  1112.  
  1113. for ( new i = 0; i <= g_group_count[id]; ++i )
  1114. {
  1115. block = g_grouped_blocks[id][i];
  1116.  
  1117. if ( !IsBlockInGroup(id, block) ) continue;
  1118.  
  1119. entity_get_vector(block, EV_VEC_vuser1, offset);
  1120.  
  1121. origin[0] = move_to[0] - offset[0];
  1122. origin[1] = move_to[1] - offset[1];
  1123. origin[2] = move_to[2] - offset[2];
  1124.  
  1125. MoveEntity(id, block, origin, false);
  1126. }
  1127.  
  1128. return FMRES_IGNORED;
  1129. }
  1130.  
  1131. public eventNewRound()
  1132. {
  1133. new iEnt, Float:fOrigin[3];
  1134. while( (iEnt = find_ent_by_class(iEnt, g_block_classname)) )
  1135. {
  1136. new blockType = pev(iEnt, pev_body);
  1137.  
  1138. if( blockType == MAGIC )
  1139. {
  1140. pev(iEnt, pev_v_angle, fOrigin);
  1141. set_pev(iEnt, pev_velocity, Float:{0.0, 0.0, 0.0});
  1142.  
  1143. engfunc(EngFunc_SetOrigin, iEnt, fOrigin);
  1144. }
  1145. }
  1146. }
  1147.  
  1148. public EventCurWeapon(id)
  1149. {
  1150. static block, property[20];
  1151.  
  1152. if ( g_boots_of_speed[id] )
  1153. {
  1154. block = g_boots_of_speed[id];
  1155. GetProperty(block, 3, property);
  1156.  
  1157. entity_set_float(id, EV_FL_maxspeed, str_to_float(property));
  1158. }
  1159. else if ( g_ice[id] )
  1160. {
  1161. entity_set_float(id, EV_FL_maxspeed, 400.0);
  1162. }
  1163. else if ( g_honey[id] )
  1164. {
  1165. block = g_honey[id];
  1166. GetProperty(block, 1, property);
  1167.  
  1168. entity_set_float(id, EV_FL_maxspeed, str_to_float(property));
  1169. }
  1170. }
  1171.  
  1172. public pfn_touch(ent, id)
  1173. {
  1174. if ( !( 1 <= id <= g_max_players )
  1175. || !g_alive[id]
  1176. || !IsBlock(ent) ) return PLUGIN_CONTINUE;
  1177.  
  1178. new block_type = entity_get_int(ent, EV_INT_body);
  1179. if ( block_type == PLATFORM
  1180. || block_type == GLASS ) return PLUGIN_CONTINUE;
  1181.  
  1182. new flags = entity_get_int(id, EV_INT_flags);
  1183. new groundentity = entity_get_edict(id, EV_ENT_groundentity);
  1184.  
  1185. static property[20];
  1186. GetProperty(ent, 4, property);
  1187.  
  1188. if ( property[0] == '0'
  1189. || ( ( !property[0]
  1190. || property[0] == '1'
  1191. || property[0] == '/' )
  1192. && ( flags & FL_ONGROUND )
  1193. && groundentity == ent ) )
  1194. {
  1195. switch ( block_type )
  1196. {
  1197. case BUNNYHOP, NO_SLOW_DOWN_BUNNYHOP: ActionBhop(ent);
  1198. case DAMAGE: ActionDamage(id, ent);
  1199. case HEALER: ActionHeal(id, ent);
  1200. case TRAMPOLINE: ActionTrampoline(id, ent);
  1201. case SPEED_BOOST: ActionSpeedBoost(id, ent);
  1202. case DEATH:
  1203. {
  1204. if ( !get_user_godmode(id) )
  1205. {
  1206. fakedamage(id, "The Block of Death", 10000.0, DMG_GENERIC);
  1207.  
  1208. new name[32];
  1209. get_user_name(id, name, 32);
  1210. ColorChat ( 0, GREY, "%s ^1%s^3 died from touching the^1 block of death^3!", prefix, name );
  1211. }
  1212. }
  1213. case SLAP:
  1214. {
  1215. GetProperty(ent, 1, property);
  1216. g_slap_times[id] = str_to_num(property) * 2;
  1217. }
  1218. case LOW_GRAVITY: ActionLowGravity(id, ent);
  1219. case HONEY: ActionHoney(id, ent);
  1220. case CT_BARRIER: ActionBarrier(id, ent, true);
  1221. case T_BARRIER: ActionBarrier(id, ent, false);
  1222. case DELAYED_BUNNYHOP: ActionDelayedBhop(ent);
  1223. case STEALTH: ActionStealth(id, ent);
  1224. case INVINCIBILITY: ActionInvincibility(id, ent);
  1225. case BOOTS_OF_SPEED: ActionBootsOfSpeed(id, ent);
  1226. case SUPERMAN: ActionSuperman(id, ent);
  1227. case NADES: ActionNades(id, ent);
  1228. case MAGIC: ActionMagic(id, ent);
  1229. case DEAGLE: ActionDeagle(id);
  1230. case AWP: ActionAwp(id);
  1231. }
  1232. }
  1233.  
  1234. if ( ( flags & FL_ONGROUND )
  1235. && groundentity == ent )
  1236. {
  1237. switch ( block_type )
  1238. {
  1239. case BUNNYHOP:
  1240. {
  1241. GetProperty(ent, 1, property);
  1242. if ( property[0] == '1' )
  1243. {
  1244. g_no_fall_damage[id] = true;
  1245. }
  1246. }
  1247. case NO_FALL_DAMAGE: g_no_fall_damage[id] = true;
  1248. case ICE: ActionIce(id);
  1249. case NO_SLOW_DOWN_BUNNYHOP:
  1250. {
  1251. ActionNoSlowDown(id);
  1252.  
  1253. GetProperty(ent, 1, property);
  1254. if ( property[0] == '1' )
  1255. {
  1256. g_no_fall_damage[id] = true;
  1257. }
  1258. }
  1259. }
  1260. }
  1261.  
  1262. return PLUGIN_CONTINUE;
  1263. }
  1264.  
  1265. public server_frame()
  1266. {
  1267. for ( new id = 1; id <= g_max_players; ++id )
  1268. {
  1269. if ( !g_alive[id] ) continue;
  1270.  
  1271. if ( g_ice[id] || g_no_slow_down[id] )
  1272. {
  1273. entity_set_float(id, EV_FL_fuser2, 0.0);
  1274. }
  1275.  
  1276. if ( g_set_velocity[id][0] != 0.0
  1277. || g_set_velocity[id][1] != 0.0
  1278. || g_set_velocity[id][2] != 0.0 )
  1279. {
  1280. entity_set_vector(id, EV_VEC_velocity, g_set_velocity[id]);
  1281.  
  1282. g_set_velocity[id][0] = 0.0;
  1283. g_set_velocity[id][1] = 0.0;
  1284. g_set_velocity[id][2] = 0.0;
  1285. }
  1286.  
  1287. if ( g_low_gravity[id] )
  1288. {
  1289. if ( entity_get_int(id, EV_INT_flags) & FL_ONGROUND )
  1290. {
  1291. entity_set_float(id, EV_FL_gravity, 1.0);
  1292. g_low_gravity[id] = false;
  1293. }
  1294. }
  1295.  
  1296. while ( g_slap_times[id] )
  1297. {
  1298. user_slap(id, 0);
  1299. g_slap_times[id]--;
  1300. }
  1301. }
  1302.  
  1303. static ent;
  1304. static entinsphere;
  1305. static Float:origin[3];
  1306.  
  1307. while ( ( ent = find_ent_by_class(ent, g_start_classname) ) )
  1308. {
  1309. entity_get_vector(ent, EV_VEC_origin, origin);
  1310.  
  1311. entinsphere = -1;
  1312. while ( ( entinsphere = find_ent_in_sphere(entinsphere, origin, 40.0) ) )
  1313. {
  1314. static classname[32];
  1315. entity_get_string(entinsphere, EV_SZ_classname, classname, charsmax(classname));
  1316.  
  1317. if ( 1 <= entinsphere <= g_max_players && g_alive[entinsphere] )
  1318. {
  1319. ActionTeleport(entinsphere, ent);
  1320. }
  1321. else if ( equal(classname, "grenade") )
  1322. {
  1323. entity_set_int(ent, EV_INT_solid, SOLID_NOT);
  1324. entity_set_float(ent, EV_FL_ltime, get_gametime() + 2.0);
  1325. }
  1326. else if ( get_gametime() >= entity_get_float(ent, EV_FL_ltime) )
  1327. {
  1328. entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
  1329. }
  1330. }
  1331. }
  1332.  
  1333. static bool:ent_near;
  1334.  
  1335. ent_near = false;
  1336. while ( ( ent = find_ent_by_class(ent, g_destination_classname) ) )
  1337. {
  1338. entity_get_vector(ent, EV_VEC_origin, origin);
  1339.  
  1340. entinsphere = -1;
  1341. while ( ( entinsphere = find_ent_in_sphere(entinsphere, origin, 64.0) ) )
  1342. {
  1343. static classname[32];
  1344. entity_get_string(entinsphere, EV_SZ_classname, classname, charsmax(classname));
  1345.  
  1346. if ( 1 <= entinsphere <= g_max_players && g_alive[entinsphere]
  1347. || equal(classname, "grenade") )
  1348. {
  1349. ent_near = true;
  1350. break;
  1351. }
  1352. }
  1353.  
  1354. if ( ent_near )
  1355. {
  1356. if ( !entity_get_int(ent, EV_INT_iuser2) )
  1357. {
  1358. entity_set_int(ent, EV_INT_solid, SOLID_NOT);
  1359. }
  1360. }
  1361. else
  1362. {
  1363. entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
  1364. }
  1365. }
  1366. }
  1367.  
  1368. public client_PreThink(id)
  1369. {
  1370. if ( !g_alive[id] ) return PLUGIN_CONTINUE;
  1371.  
  1372. new Float:gametime = get_gametime();
  1373. new Float:timeleft_invincibility = g_invincibility_time_out[id] - gametime;
  1374. new Float:timeleft_stealth = g_stealth_time_out[id] - gametime;
  1375. new Float:timeleft_boots_of_speed = g_boots_of_speed_time_out[id] - gametime;
  1376. new Float:timeleft_superman = g_superman_time_out[id] - gametime;
  1377.  
  1378. if ( timeleft_invincibility >= 0.0
  1379. || timeleft_stealth >= 0.0
  1380. || timeleft_boots_of_speed >= 0.0
  1381. || timeleft_superman >= 0.0 )
  1382. {
  1383. new text[48], text_to_show[256];
  1384.  
  1385. format(text, charsmax(text), "%s %s", PLUGIN_PREFIX, PLUGIN_VERSION);
  1386. add(text_to_show, charsmax(text_to_show), text);
  1387.  
  1388. if ( timeleft_invincibility >= 0.0 )
  1389. {
  1390. format(text, charsmax(text), "^nInvincible %.1f", timeleft_invincibility);
  1391. add(text_to_show, charsmax(text_to_show), text);
  1392. }
  1393.  
  1394. if ( timeleft_stealth >= 0.0 )
  1395. {
  1396. format(text, charsmax(text), "^nStealth %.1f", timeleft_stealth);
  1397. add(text_to_show, charsmax(text_to_show), text);
  1398. }
  1399.  
  1400. if ( timeleft_boots_of_speed >= 0.0 )
  1401. {
  1402. format(text, charsmax(text), "^nBoots Of Speed %.1f", timeleft_boots_of_speed);
  1403. add(text_to_show, charsmax(text_to_show), text);
  1404. }
  1405.  
  1406. if ( timeleft_superman >= 0.0 )
  1407. {
  1408. format(text, charsmax(text), "^nSuperman %.1f", timeleft_superman);
  1409. add(text_to_show, charsmax(text_to_show), text);
  1410. }
  1411.  
  1412. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1413. show_hudmessage(id, text_to_show);
  1414.  
  1415. g_has_hud_text[id] = true;
  1416. }
  1417. else
  1418. {
  1419. g_has_hud_text[id] = false;
  1420. }
  1421.  
  1422. return PLUGIN_CONTINUE;
  1423. }
  1424.  
  1425. ActionAwp(id)
  1426. {
  1427. if ( !g_awp_used[id] )
  1428. {
  1429. if( cs_get_user_team(id) == CS_TEAM_T )
  1430. {
  1431. if ( is_user_alive(id) )
  1432. {
  1433. if(user_has_weapon(id, CSW_AWP))
  1434. {
  1435. if ( !g_has_hud_text[id] )
  1436. {
  1437. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1438. show_hudmessage(id, "%s %s^nYou already have a awp", PLUGIN_PREFIX, PLUGIN_VERSION );
  1439. }
  1440.  
  1441. return PLUGIN_HANDLED;
  1442. }
  1443. else
  1444. {
  1445. cs_set_weapon_ammo( give_item( id, "weapon_awp" ), 1 );
  1446. cs_set_user_bpammo( id, CSW_AWP, 0 );
  1447.  
  1448. new name[32];
  1449. get_user_name(id, name, 32);
  1450. ColorChat ( 0, GREY, "%s ^1%s^3 were given a^1 awp^3 with^1 1^3 bullet!", prefix, name );
  1451. g_awp_used[id] = true
  1452.  
  1453. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1454. show_hudmessage(id, "%s %s^nYou can only use this block once per round", PLUGIN_PREFIX, PLUGIN_VERSION );
  1455.  
  1456. }
  1457. return PLUGIN_HANDLED;
  1458. }
  1459. }
  1460. else
  1461. {
  1462. if ( !g_has_hud_text[id] )
  1463. {
  1464. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1465. show_hudmessage(id, "%s %s^nThis block can only be used by Terrorists", PLUGIN_PREFIX, PLUGIN_VERSION );
  1466. }
  1467. return PLUGIN_HANDLED;
  1468. }
  1469. }
  1470.  
  1471. return PLUGIN_HANDLED
  1472.  
  1473. }
  1474.  
  1475. ActionDeagle(id)
  1476. {
  1477. if ( !g_deagle_used[id] )
  1478. {
  1479. if( cs_get_user_team(id) == CS_TEAM_T )
  1480. {
  1481. if ( is_user_alive(id) )
  1482. {
  1483. if(user_has_weapon(id, CSW_DEAGLE))
  1484. {
  1485. if ( !g_has_hud_text[id] )
  1486. {
  1487. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1488. show_hudmessage(id, "%s %s^nYou already have a deagle", PLUGIN_PREFIX, PLUGIN_VERSION );
  1489. }
  1490.  
  1491. return PLUGIN_HANDLED;
  1492. }
  1493. else
  1494. {
  1495. cs_set_weapon_ammo( give_item( id, "weapon_deagle" ), 1 );
  1496. cs_set_user_bpammo( id, CSW_DEAGLE, 0 );
  1497.  
  1498. new name[32];
  1499. get_user_name(id, name, 32);
  1500. ColorChat ( 0, GREY, "%s ^1%s^3 were given a^1 deagle^3 with^1 1^3 bullet!", prefix, name );
  1501. g_deagle_used[id] = true
  1502.  
  1503. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1504. show_hudmessage(id, "%s %s^nYou can only use this block once per round", PLUGIN_PREFIX, PLUGIN_VERSION );
  1505. }
  1506. return PLUGIN_HANDLED;
  1507. }
  1508. }
  1509. else
  1510. {
  1511. if ( !g_has_hud_text[id] )
  1512. {
  1513. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1514. show_hudmessage(id, "%s %s^nThis block can only be used by Terrorists", PLUGIN_PREFIX, PLUGIN_VERSION );
  1515. }
  1516. return PLUGIN_HANDLED;
  1517. }
  1518. }
  1519.  
  1520. return PLUGIN_HANDLED
  1521.  
  1522. }
  1523.  
  1524. ActionMagic(id, iEnt)
  1525. {
  1526. new szProperty[5], Float:vVelocity[3];
  1527. GetProperty(iEnt, 1, szProperty);
  1528. new iValue = str_to_num(szProperty);
  1529.  
  1530. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1531.  
  1532. switch( iValue )
  1533. {
  1534. case 1:
  1535. {
  1536. if( cs_get_user_team(id) == CS_TEAM_T )
  1537. {
  1538. pev(id, pev_velocity, vVelocity);
  1539. vVelocity[2] = 0.0;
  1540. set_pev(iEnt, pev_velocity, vVelocity);
  1541. }
  1542. else
  1543. {
  1544. show_hudmessage(id, "Team: Terrorists Only!");
  1545. }
  1546. }
  1547. case 2:
  1548. {
  1549. if( cs_get_user_team(id) == CS_TEAM_CT )
  1550. {
  1551. pev(id, pev_velocity, vVelocity);
  1552. vVelocity[2] = 0.0;
  1553. set_pev(iEnt, pev_velocity, vVelocity);
  1554. }
  1555. else
  1556. {
  1557. show_hudmessage(id, "Team: Counter-Terrorists Only!");
  1558. }
  1559. }
  1560. default:
  1561. {
  1562. pev(id, pev_velocity, vVelocity);
  1563. vVelocity[2] = 0.0;
  1564. set_pev(iEnt, pev_velocity, vVelocity);
  1565. }
  1566. }
  1567. }
  1568.  
  1569. public ActionNades(id, ent)
  1570. {
  1571. new Float:gametime = get_gametime();
  1572. if ( !( gametime >= g_nades_next_use[id] ) && get_user_team(id) == 1 && is_user_alive(id) )
  1573. {
  1574. if ( !g_has_hud_text[id] )
  1575. {
  1576. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1577. show_hudmessage(id, "%s^nGrenade Block^nNext Use: 1 round", PLUGIN_PREFIX );
  1578. }
  1579.  
  1580. return PLUGIN_HANDLED;
  1581. }
  1582.  
  1583. switch( get_user_team(id) )
  1584. {
  1585. case 2:
  1586. {
  1587. if ( !g_has_hud_text[id] )
  1588. {
  1589. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1590. show_hudmessage(id, "%s^nGrenade Block^nOnly Terrorists Can Use This Block", PLUGIN_PREFIX );
  1591. }
  1592.  
  1593. return PLUGIN_HANDLED;
  1594. }
  1595. case 1:
  1596. {
  1597. new iMenu = menu_create("Pick a grenade:", "handleNadeMenu", 0);
  1598. menu_additem(iMenu, "HE Grenade", "1", 0);
  1599. menu_additem(iMenu, "Flashbang", "2", 0);
  1600. menu_additem(iMenu, "Smokegrenade", "3", 0);
  1601. menu_display(id, iMenu, 0);
  1602.  
  1603. static property[20];
  1604. GetProperty(ent, 2, property);
  1605.  
  1606. g_block_status[id] = true;
  1607. g_nades_next_use[id] = gametime + str_to_float(property);
  1608.  
  1609. return PLUGIN_HANDLED;
  1610. }
  1611. }
  1612.  
  1613. return PLUGIN_HANDLED;
  1614. }
  1615.  
  1616. public handleNadeMenu(id, iMenu, iItem)
  1617. {
  1618. if( iItem == MENU_EXIT )
  1619. {
  1620. menu_destroy(iMenu);
  1621. return PLUGIN_HANDLED;
  1622. }
  1623.  
  1624. new iData[6], iName[64], iAccess, iCallback;
  1625. menu_item_getinfo(iMenu, iItem, iAccess, iData, charsmax(iData), iName, charsmax(iName), iCallback);
  1626. switch( str_to_num(iData) )
  1627. {
  1628. case 1:
  1629. {
  1630. if( is_user_alive(id) )
  1631. {
  1632. if( user_has_weapon(id, CSW_HEGRENADE) )
  1633. {
  1634. cs_set_user_bpammo(id, CSW_HEGRENADE, (cs_get_user_bpammo(id, CSW_HEGRENADE) + 1));
  1635. }
  1636. else
  1637. {
  1638. give_item(id, "weapon_hegrenade");
  1639. }
  1640. }
  1641. }
  1642. case 2:
  1643. {
  1644. if( is_user_alive(id) )
  1645. {
  1646. if( user_has_weapon(id, CSW_FLASHBANG) )
  1647. {
  1648. cs_set_user_bpammo(id, CSW_FLASHBANG, (cs_get_user_bpammo(id, CSW_FLASHBANG) + 1));
  1649. }
  1650. else
  1651. {
  1652. give_item(id, "weapon_flashbang");
  1653. }
  1654. }
  1655. }
  1656. case 3:
  1657. {
  1658. if( is_user_alive(id) )
  1659. {
  1660. if( user_has_weapon(id, CSW_SMOKEGRENADE))
  1661. {
  1662. cs_set_user_bpammo(id, CSW_SMOKEGRENADE, (cs_get_user_bpammo(id, CSW_SMOKEGRENADE) + 1));
  1663. }
  1664. else
  1665. {
  1666. give_item(id, "weapon_smokegrenade");
  1667. }
  1668. }
  1669. }
  1670. }
  1671.  
  1672. return PLUGIN_HANDLED;
  1673. }
  1674.  
  1675. ActionSuperman(id, ent)
  1676. {
  1677. new Float:gametime = get_gametime();
  1678. if ( !( gametime >= g_superman_next_use[id] ) )
  1679. {
  1680. if ( !g_has_hud_text[id] )
  1681. {
  1682. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1683. show_hudmessage(id, "%s^nSuperman^nNext Use %.1f", PLUGIN_PREFIX, g_superman_next_use[id] - gametime);
  1684. }
  1685.  
  1686. return PLUGIN_HANDLED;
  1687. }
  1688.  
  1689. static property[20];
  1690.  
  1691. set_user_gravity(id, 0.35);
  1692.  
  1693. emit_sound(id, CHAN_STATIC, g_sound_superman, 1.0, ATTN_NORM, 0, PITCH_NORM);
  1694.  
  1695. g_block_status[id] = true;
  1696.  
  1697. static Float:time_out;
  1698. GetProperty(ent, 1, property);
  1699. time_out = str_to_float(property);
  1700. set_task(time_out, "TaskRemoveSuperman", TASK_SUPERMAN + id, g_blank, 0, g_a, 1);
  1701.  
  1702. GetProperty(ent, 2, property);
  1703.  
  1704. g_superman_time_out[id] = gametime + time_out;
  1705. g_superman_next_use[id] = gametime + time_out + str_to_float(property);
  1706.  
  1707. return PLUGIN_HANDLED;
  1708. }
  1709.  
  1710. public client_PostThink(id)
  1711. {
  1712. if ( !g_alive[id] ) return PLUGIN_CONTINUE;
  1713.  
  1714. if ( g_no_fall_damage[id] )
  1715. {
  1716. entity_set_int(id, EV_INT_watertype, -3);
  1717. g_no_fall_damage[id] = false;
  1718. }
  1719.  
  1720. return PLUGIN_CONTINUE;
  1721. }
  1722.  
  1723. ActionBhop(ent)
  1724. {
  1725. if ( task_exists(TASK_SOLIDNOT + ent)
  1726. || task_exists(TASK_SOLID + ent) ) return PLUGIN_HANDLED;
  1727.  
  1728. set_task(0.1, "TaskSolidNot", TASK_SOLIDNOT + ent);
  1729.  
  1730. return PLUGIN_HANDLED;
  1731. }
  1732.  
  1733. ActionDamage(id, ent)
  1734. {
  1735. new Float:gametime = get_gametime();
  1736. if ( !( gametime >= g_next_damage_time[id] )
  1737. || get_user_health(id) <= 0
  1738. || get_user_godmode(id) ) return PLUGIN_HANDLED;
  1739.  
  1740. static property[20];
  1741.  
  1742. GetProperty(ent, 1, property);
  1743. fakedamage(id, "Damage Block", str_to_float(property), DMG_CRUSH);
  1744.  
  1745. GetProperty(ent, 2, property);
  1746. g_next_damage_time[id] = gametime + str_to_float(property);
  1747.  
  1748. return PLUGIN_HANDLED;
  1749. }
  1750.  
  1751. ActionHeal(id, ent)
  1752. {
  1753. new Float:gametime = get_gametime();
  1754. if ( !( gametime >= g_next_heal_time[id] ) ) return PLUGIN_HANDLED;
  1755.  
  1756. new health = get_user_health(id);
  1757. if ( health >= 100 ) return PLUGIN_HANDLED;
  1758.  
  1759. static property[20];
  1760.  
  1761. GetProperty(ent, 1, property);
  1762. health += str_to_num(property);
  1763. set_user_health(id, min(100, health));
  1764.  
  1765. GetProperty(ent, 2, property);
  1766. g_next_heal_time[id] = gametime + str_to_float(property);
  1767.  
  1768. return PLUGIN_HANDLED;
  1769. }
  1770.  
  1771. ActionIce(id)
  1772. {
  1773. if ( !g_ice[id] )
  1774. {
  1775. entity_set_float(id, EV_FL_friction, 0.15);
  1776. entity_set_float(id, EV_FL_maxspeed, 400.0);
  1777.  
  1778. g_ice[id] = true;
  1779. }
  1780.  
  1781. new task_id = TASK_ICE + id;
  1782. if ( task_exists(task_id) ) remove_task(task_id);
  1783.  
  1784. set_task(0.1, "TaskNotOnIce", task_id);
  1785. }
  1786.  
  1787. ActionTrampoline(id, ent)
  1788. {
  1789. static property1[20];
  1790. GetProperty(ent, 1, property1);
  1791.  
  1792. entity_get_vector(id, EV_VEC_velocity, g_set_velocity[id]);
  1793.  
  1794. g_set_velocity[id][2] = str_to_float(property1);
  1795.  
  1796. entity_set_int(id, EV_INT_gaitsequence, 6);
  1797.  
  1798. g_no_fall_damage[id] = true;
  1799. }
  1800.  
  1801. ActionSpeedBoost(id, ent)
  1802. {
  1803. static property[20];
  1804.  
  1805. GetProperty(ent, 1, property);
  1806. velocity_by_aim(id, str_to_num(property), g_set_velocity[id]);
  1807.  
  1808. GetProperty(ent, 2, property);
  1809. g_set_velocity[id][2] = str_to_float(property);
  1810.  
  1811. entity_set_int(id, EV_INT_gaitsequence, 6);
  1812. }
  1813.  
  1814. ActionLowGravity(id, ent)
  1815. {
  1816. if ( g_low_gravity[id] ) return PLUGIN_HANDLED;
  1817.  
  1818. static property1[20];
  1819. GetProperty(ent, 1, property1);
  1820.  
  1821. entity_set_float(id, EV_FL_gravity, str_to_float(property1) / 800);
  1822.  
  1823. g_low_gravity[id] = true;
  1824.  
  1825. return PLUGIN_HANDLED;
  1826. }
  1827.  
  1828. ActionHoney(id, ent)
  1829. {
  1830. if ( g_honey[id] != ent )
  1831. {
  1832. static property1[20];
  1833. GetProperty(ent, 1, property1);
  1834.  
  1835. new Float:speed = str_to_float(property1);
  1836. entity_set_float(id, EV_FL_maxspeed, speed == 0 ? -1.0 : speed);
  1837.  
  1838. g_honey[id] = ent;
  1839. }
  1840.  
  1841. new task_id = TASK_HONEY + id;
  1842. if ( task_exists(task_id) )
  1843. {
  1844. remove_task(task_id);
  1845. }
  1846. else
  1847. {
  1848. static Float:velocity[3];
  1849. entity_get_vector(id, EV_VEC_velocity, velocity);
  1850.  
  1851. velocity[0] /= 2.0;
  1852. velocity[1] /= 2.0;
  1853.  
  1854. entity_set_vector(id, EV_VEC_velocity, velocity);
  1855. }
  1856.  
  1857. set_task(0.1, "TaskNotInHoney", task_id);
  1858. }
  1859.  
  1860. ActionBarrier(id, ent, bool:block_terrorists)
  1861. {
  1862. if ( task_exists(TASK_SOLIDNOT + ent)
  1863. || task_exists(TASK_SOLID + ent) ) return PLUGIN_HANDLED;
  1864.  
  1865. new CsTeams:team = block_terrorists ? CS_TEAM_T : CS_TEAM_CT;
  1866. if ( cs_get_user_team(id) == team ) TaskSolidNot(TASK_SOLIDNOT + ent);
  1867.  
  1868. return PLUGIN_HANDLED;
  1869. }
  1870.  
  1871. ActionNoSlowDown(id)
  1872. {
  1873. g_no_slow_down[id] = true;
  1874.  
  1875. new task_id = TASK_NOSLOWDOWN + id;
  1876. if ( task_exists(task_id) ) remove_task(task_id);
  1877.  
  1878. set_task(0.1, "TaskSlowDown", task_id);
  1879. }
  1880.  
  1881. ActionDelayedBhop(ent)
  1882. {
  1883. if ( task_exists(TASK_SOLIDNOT + ent)
  1884. || task_exists(TASK_SOLID + ent) ) return PLUGIN_HANDLED;
  1885.  
  1886. static property1[20];
  1887. GetProperty(ent, 1, property1);
  1888.  
  1889. set_task(str_to_float(property1), "TaskSolidNot", TASK_SOLIDNOT + ent);
  1890.  
  1891. return PLUGIN_HANDLED;
  1892. }
  1893.  
  1894. ActionInvincibility(id, ent)
  1895. {
  1896. new Float:gametime = get_gametime();
  1897. if ( !( gametime >= g_invincibility_next_use[id] ) )
  1898. {
  1899. if ( !g_has_hud_text[id] )
  1900. {
  1901. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1902. show_hudmessage(id, "%s^nInvincibility^nNext Use %.1f", PLUGIN_PREFIX, g_invincibility_next_use[id] - gametime);
  1903. }
  1904.  
  1905. return PLUGIN_HANDLED;
  1906. }
  1907.  
  1908. static property[20];
  1909.  
  1910. entity_set_float(id, EV_FL_takedamage, DAMAGE_NO);
  1911.  
  1912. if ( gametime >= g_stealth_time_out[id] )
  1913. {
  1914. set_user_rendering(id, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 16);
  1915. }
  1916.  
  1917. emit_sound(id, CHAN_STATIC, g_sound_invincibility, 1.0, ATTN_NORM, 0, PITCH_NORM);
  1918.  
  1919. static Float:time_out;
  1920. GetProperty(ent, 1, property);
  1921. time_out = str_to_float(property);
  1922. set_task(time_out, "TaskRemoveInvincibility", TASK_INVINCIBLE + id, g_blank, 0, g_a, 1);
  1923.  
  1924. GetProperty(ent, 2, property);
  1925.  
  1926. g_invincibility_time_out[id] = gametime + time_out;
  1927. g_invincibility_next_use[id] = gametime + time_out + str_to_float(property);
  1928.  
  1929. return PLUGIN_HANDLED;
  1930. }
  1931.  
  1932. ActionStealth(id, ent)
  1933. {
  1934. new Float:gametime = get_gametime();
  1935. if ( !( gametime >= g_stealth_next_use[id] ) )
  1936. {
  1937. if ( !g_has_hud_text[id] )
  1938. {
  1939. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1940. show_hudmessage(id, "%s^nStealth^nNext Use %.1f", PLUGIN_PREFIX, g_stealth_next_use[id] - gametime);
  1941. }
  1942.  
  1943. return PLUGIN_HANDLED;
  1944. }
  1945.  
  1946. static property[20];
  1947.  
  1948. set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransColor, 0);
  1949.  
  1950. emit_sound(id, CHAN_STATIC, g_sound_stealth, 1.0, ATTN_NORM, 0, PITCH_NORM);
  1951.  
  1952. g_block_status[id] = true;
  1953.  
  1954. static Float:time_out;
  1955. GetProperty(ent, 1, property);
  1956. time_out = str_to_float(property);
  1957. set_task(time_out, "TaskRemoveStealth", TASK_STEALTH + id, g_blank, 0, g_a, 1);
  1958.  
  1959. GetProperty(ent, 2, property);
  1960.  
  1961. g_stealth_time_out[id] = gametime + time_out;
  1962. g_stealth_next_use[id] = gametime + time_out + str_to_float(property);
  1963.  
  1964. return PLUGIN_HANDLED;
  1965. }
  1966.  
  1967. ActionBootsOfSpeed(id, ent)
  1968. {
  1969. new Float:gametime = get_gametime();
  1970. if ( !( gametime >= g_boots_of_speed_next_use[id] ) )
  1971. {
  1972. if ( !g_has_hud_text[id] )
  1973. {
  1974. set_hudmessage(50, 50, 200, -1.0, -0.10, 0, 0.0, 1.5, 0.25, 0.25, -1);
  1975. show_hudmessage(id, "%s^nBoots Of Speed^nNext Use %.1f", PLUGIN_PREFIX, g_boots_of_speed_next_use[id] - gametime);
  1976. }
  1977.  
  1978. return PLUGIN_HANDLED;
  1979. }
  1980.  
  1981. static property[20];
  1982.  
  1983. GetProperty(ent, 3, property);
  1984. entity_set_float(id, EV_FL_maxspeed, str_to_float(property));
  1985.  
  1986. g_boots_of_speed[id] = ent;
  1987.  
  1988. emit_sound(id, CHAN_STATIC, g_sound_boots_of_speed, 1.0, ATTN_NORM, 0, PITCH_NORM);
  1989.  
  1990. static Float:time_out;
  1991. GetProperty(ent, 1, property);
  1992. time_out = str_to_float(property);
  1993. set_task(time_out, "TaskRemoveBootsOfSpeed", TASK_BOOTSOFSPEED + id, g_blank, 0, g_a, 1);
  1994.  
  1995. GetProperty(ent, 2, property);
  1996.  
  1997. g_boots_of_speed_time_out[id] = gametime + time_out;
  1998. g_boots_of_speed_next_use[id] = gametime + time_out + str_to_float(property);
  1999.  
  2000. return PLUGIN_HANDLED;
  2001. }
  2002.  
  2003. ActionTeleport(id, ent)
  2004. {
  2005. new tele = entity_get_int(ent, EV_INT_iuser1);
  2006. if ( !tele ) return PLUGIN_HANDLED;
  2007.  
  2008. static Float:tele_origin[3];
  2009. entity_get_vector(tele, EV_VEC_origin, tele_origin);
  2010.  
  2011. new player = -1;
  2012. do
  2013. {
  2014. player = find_ent_in_sphere(player, tele_origin, 16.0);
  2015.  
  2016. if ( !is_user_alive(player)
  2017. || player == id
  2018. || cs_get_user_team(id) == cs_get_user_team(player) ) continue;
  2019.  
  2020. user_kill(player, 1);
  2021. }
  2022. while ( player );
  2023.  
  2024. entity_set_vector(id, EV_VEC_origin, tele_origin);
  2025.  
  2026. static Float:velocity[3];
  2027. entity_get_vector(id, EV_VEC_velocity, velocity);
  2028. velocity[2] = floatabs(velocity[2]);
  2029. entity_set_vector(id, EV_VEC_velocity, velocity);
  2030.  
  2031. return PLUGIN_HANDLED;
  2032. }
  2033.  
  2034. public TaskSolidNot(ent)
  2035. {
  2036. ent -= TASK_SOLIDNOT;
  2037.  
  2038. if ( !is_valid_ent(ent)
  2039. || entity_get_int(ent, EV_INT_iuser2) ) return PLUGIN_HANDLED;
  2040.  
  2041. entity_set_int(ent, EV_INT_solid, SOLID_NOT);
  2042. set_rendering(ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 25);
  2043. set_task(1.0, "TaskSolid", TASK_SOLID + ent);
  2044.  
  2045. return PLUGIN_HANDLED;
  2046. }
  2047.  
  2048. public TaskSolid(ent)
  2049. {
  2050. ent -= TASK_SOLID;
  2051.  
  2052. if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
  2053.  
  2054. entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
  2055.  
  2056. if ( entity_get_int(ent, EV_INT_iuser1) > 0 )
  2057. {
  2058. GroupBlock(0, ent);
  2059. }
  2060. else
  2061. {
  2062. static property3[20];
  2063. GetProperty(ent, 3, property3);
  2064.  
  2065. new transparency = str_to_num(property3);
  2066. if ( !transparency
  2067. || transparency == 255 )
  2068. {
  2069. new block_type = entity_get_int(ent, EV_INT_body);
  2070. SetBlockRendering(ent, g_render[block_type], g_red[block_type], g_green[block_type], g_blue[block_type], g_alpha[block_type]);
  2071. }
  2072. else
  2073. {
  2074. SetBlockRendering(ent, TRANSALPHA, 255, 255, 255, transparency);
  2075. }
  2076. }
  2077.  
  2078. return PLUGIN_HANDLED;
  2079. }
  2080.  
  2081. public TaskNotOnIce(id)
  2082. {
  2083. id -= TASK_ICE;
  2084.  
  2085. g_ice[id] = false;
  2086.  
  2087. if ( !g_alive[id] ) return PLUGIN_HANDLED;
  2088.  
  2089. if ( g_boots_of_speed[id] )
  2090. {
  2091. static block, property3[20];
  2092. block = g_boots_of_speed[id];
  2093. GetProperty(block, 3, property3);
  2094.  
  2095. entity_set_float(id, EV_FL_maxspeed, str_to_float(property3));
  2096. }
  2097. else
  2098. {
  2099. ResetMaxspeed(id);
  2100. }
  2101.  
  2102. entity_set_float(id, EV_FL_friction, 1.0);
  2103.  
  2104. return PLUGIN_HANDLED;
  2105. }
  2106.  
  2107. public TaskNotInHoney(id)
  2108. {
  2109. id -= TASK_HONEY;
  2110.  
  2111. g_honey[id] = 0;
  2112.  
  2113. if ( !g_alive[id] ) return PLUGIN_HANDLED;
  2114.  
  2115. if ( g_boots_of_speed[id] )
  2116. {
  2117. static block, property3[20];
  2118. block = g_boots_of_speed[id];
  2119. GetProperty(block, 3, property3);
  2120.  
  2121. entity_set_float(id, EV_FL_maxspeed, str_to_float(property3));
  2122. }
  2123. else
  2124. {
  2125. ResetMaxspeed(id);
  2126. }
  2127.  
  2128. return PLUGIN_HANDLED;
  2129. }
  2130.  
  2131. public TaskSlowDown(id)
  2132. {
  2133. id -= TASK_NOSLOWDOWN;
  2134.  
  2135. g_no_slow_down[id] = false;
  2136. }
  2137.  
  2138. public TaskRemoveInvincibility(id)
  2139. {
  2140. id -= TASK_INVINCIBLE;
  2141.  
  2142. if ( !g_alive[id] ) return PLUGIN_HANDLED;
  2143.  
  2144. if ( ( g_admin[id] || g_gived_access[id] ) && !g_godmode[id]
  2145. || ( !g_admin[id] && !g_gived_access[id] ) && !g_all_godmode )
  2146. {
  2147. set_user_godmode(id, 0);
  2148. }
  2149.  
  2150. if ( get_gametime() >= g_stealth_time_out[id] )
  2151. {
  2152. set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 16);
  2153. }
  2154.  
  2155. return PLUGIN_HANDLED;
  2156. }
  2157.  
  2158. public TaskRemoveStealth(id)
  2159. {
  2160. id -= TASK_STEALTH;
  2161.  
  2162. if ( g_connected[id] )
  2163. {
  2164. if ( get_gametime() <= g_invincibility_time_out[id] )
  2165. {
  2166. set_user_rendering(id, kRenderFxGlowShell, 255, 255, 255, kRenderTransColor, 16);
  2167. }
  2168. else
  2169. {
  2170. set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 255);
  2171. }
  2172. }
  2173.  
  2174. g_block_status[id] = false;
  2175. }
  2176.  
  2177. public TaskRemoveBootsOfSpeed(id)
  2178. {
  2179. id -= TASK_BOOTSOFSPEED;
  2180.  
  2181. g_boots_of_speed[id] = 0;
  2182.  
  2183. if ( !g_alive[id] ) return PLUGIN_HANDLED;
  2184.  
  2185. if ( g_ice[id] )
  2186. {
  2187. entity_set_float(id, EV_FL_maxspeed, 400.0);
  2188. }
  2189. else if ( g_honey[id] )
  2190. {
  2191. static block, property1[20];
  2192. block = g_honey[id];
  2193. GetProperty(block, 1, property1);
  2194.  
  2195. entity_set_float(id, EV_FL_maxspeed, str_to_float(property1));
  2196. }
  2197. else
  2198. {
  2199. ResetMaxspeed(id);
  2200. }
  2201.  
  2202. return PLUGIN_HANDLED;
  2203. }
  2204.  
  2205. public TaskRemoveSuperman(id)
  2206. {
  2207. id -= TASK_SUPERMAN;
  2208.  
  2209. if ( g_connected[id] )
  2210. {
  2211. set_user_gravity(id, 1.0);
  2212. }
  2213.  
  2214. g_block_status[id] = false;
  2215. }
  2216.  
  2217. public TaskSpriteNextFrame(params[])
  2218. {
  2219. new ent = params[0];
  2220. if ( !is_valid_ent(ent) )
  2221. {
  2222. remove_task(TASK_SPRITE + ent);
  2223. return PLUGIN_HANDLED;
  2224. }
  2225.  
  2226. new frames = params[1];
  2227. new Float:current_frame = entity_get_float(ent, EV_FL_frame);
  2228.  
  2229. if ( current_frame < 0.0
  2230. || current_frame >= frames )
  2231. {
  2232. entity_set_float(ent, EV_FL_frame, 1.0);
  2233. }
  2234. else
  2235. {
  2236. entity_set_float(ent, EV_FL_frame, current_frame + 1.0);
  2237. }
  2238.  
  2239. return PLUGIN_HANDLED;
  2240. }
  2241.  
  2242. public MsgStatusValue()
  2243. {
  2244. if ( get_msg_arg_int(1) == 2
  2245. && g_block_status[get_msg_arg_int(2)] )
  2246. {
  2247. set_msg_arg_int(1, get_msg_argtype(1), 1);
  2248. set_msg_arg_int(2, get_msg_argtype(2), 0);
  2249. }
  2250. }
  2251.  
  2252. public CmdAttack(id)
  2253. {
  2254. if ( !IsBlock(g_grabbed[id]) ) return PLUGIN_HANDLED;
  2255.  
  2256. if ( IsBlockInGroup(id, g_grabbed[id]) && g_group_count[id] > 1 )
  2257. {
  2258. static block;
  2259. for ( new i = 0; i <= g_group_count[id]; ++i )
  2260. {
  2261. block = g_grouped_blocks[id][i];
  2262. if ( !IsBlockInGroup(id, block) ) continue;
  2263.  
  2264. if ( !IsBlockStuck(block) )
  2265. {
  2266. CopyBlock(block);
  2267. }
  2268. }
  2269. }
  2270. else
  2271. {
  2272. if ( IsBlockStuck(g_grabbed[id]) )
  2273. {
  2274. JCM_Print(id, "You cannot copy a block that is in a stuck position!");
  2275. return PLUGIN_HANDLED;
  2276. }
  2277.  
  2278. new new_block = CopyBlock(g_grabbed[id]);
  2279. if ( !new_block ) return PLUGIN_HANDLED;
  2280.  
  2281. entity_set_int(g_grabbed[id], EV_INT_iuser2, 0);
  2282. entity_set_int(new_block, EV_INT_iuser2, id);
  2283. g_grabbed[id] = new_block;
  2284. }
  2285.  
  2286. return PLUGIN_HANDLED;
  2287. }
  2288.  
  2289. public CmdAttack2(id)
  2290. {
  2291. if ( !IsBlock(g_grabbed[id]) )
  2292. {
  2293. DeleteTeleport(id, g_grabbed[id]);
  2294. return PLUGIN_HANDLED;
  2295. }
  2296.  
  2297. if ( !IsBlockInGroup(id, g_grabbed[id])
  2298. || g_group_count[id] < 2 )
  2299. {
  2300. DeleteBlock(g_grabbed[id]);
  2301. return PLUGIN_HANDLED;
  2302. }
  2303.  
  2304. static block;
  2305. for ( new i = 0; i <= g_group_count[id]; ++i )
  2306. {
  2307. block = g_grouped_blocks[id][i];
  2308. if ( !is_valid_ent(block)
  2309. || !IsBlockInGroup(id, block) ) continue;
  2310.  
  2311. DeleteBlock(block);
  2312. }
  2313.  
  2314. return PLUGIN_HANDLED;
  2315. }
  2316.  
  2317. public CmdRotate(id)
  2318. {
  2319. if ( !IsBlock(g_grabbed[id]) ) return PLUGIN_HANDLED;
  2320.  
  2321. if ( !IsBlockInGroup(id, g_grabbed[id])
  2322. || g_group_count[id] < 2 )
  2323. {
  2324. RotateBlock(g_grabbed[id]);
  2325. return PLUGIN_HANDLED;
  2326. }
  2327.  
  2328. static block;
  2329. for ( new i = 0; i <= g_group_count[id]; ++i )
  2330. {
  2331. block = g_grouped_blocks[id][i];
  2332. if ( !is_valid_ent(block)
  2333. || !IsBlockInGroup(id, block) ) continue;
  2334.  
  2335. RotateBlock(block);
  2336. }
  2337.  
  2338. return PLUGIN_HANDLED;
  2339. }
  2340.  
  2341. public CmdGrab(id)
  2342. {
  2343. if ( !g_admin[id] && !g_gived_access[id] )
  2344. {
  2345. console_print(id, "You have no access to that command");
  2346. return PLUGIN_HANDLED;
  2347. }
  2348.  
  2349. static ent, body;
  2350. g_grab_length[id] = get_user_aiming(id, ent, body);
  2351.  
  2352. new bool:is_block = IsBlock(ent);
  2353.  
  2354. if ( !is_block && !IsTeleport(ent) && !IsLight(ent) && !IsBox(ent) ) return PLUGIN_HANDLED;
  2355.  
  2356. new grabber = entity_get_int(ent, EV_INT_iuser2);
  2357. if ( grabber && grabber != id ) return PLUGIN_HANDLED;
  2358.  
  2359. if ( !is_block )
  2360. {
  2361. SetGrabbed(id, ent);
  2362. return PLUGIN_HANDLED;
  2363. }
  2364.  
  2365. new player = entity_get_int(ent, EV_INT_iuser1);
  2366. if ( player && player != id )
  2367. {
  2368. new player_name[32];
  2369. get_user_name(player, player_name, charsmax(player_name));
  2370.  
  2371. JCM_Print(id, "^4%s3 currently has this block in their group!", player_name);
  2372. return PLUGIN_HANDLED;
  2373. }
  2374.  
  2375. SetGrabbed(id, ent);
  2376.  
  2377. if ( g_group_count[id] < 2 ) return PLUGIN_HANDLED;
  2378.  
  2379. static Float:grabbed_origin[3];
  2380.  
  2381. entity_get_vector(ent, EV_VEC_origin, grabbed_origin);
  2382.  
  2383. static block, Float:origin[3], Float:offset[3];
  2384. for ( new i = 0; i <= g_group_count[id]; ++i )
  2385. {
  2386. block = g_grouped_blocks[id][i];
  2387. if ( !is_valid_ent(block) ) continue;
  2388.  
  2389. entity_get_vector(block, EV_VEC_origin, origin);
  2390.  
  2391. offset[0] = grabbed_origin[0] - origin[0];
  2392. offset[1] = grabbed_origin[1] - origin[1];
  2393. offset[2] = grabbed_origin[2] - origin[2];
  2394.  
  2395. entity_set_vector(block, EV_VEC_vuser1, offset);
  2396. entity_set_int(block, EV_INT_iuser2, id);
  2397. }
  2398.  
  2399. return PLUGIN_HANDLED;
  2400. }
  2401.  
  2402. SetGrabbed(id, ent)
  2403. {
  2404. entity_get_string(id, EV_SZ_viewmodel, g_viewmodel[id], charsmax(g_viewmodel));
  2405. entity_set_string(id, EV_SZ_viewmodel, g_blank);
  2406.  
  2407. static aiming[3], Float:origin[3];
  2408.  
  2409. get_user_origin(id, aiming, 3);
  2410. entity_get_vector(ent, EV_VEC_origin, origin);
  2411.  
  2412. g_grabbed[id] = ent;
  2413. g_grab_offset[id][0] = origin[0] - aiming[0];
  2414. g_grab_offset[id][1] = origin[1] - aiming[1];
  2415. g_grab_offset[id][2] = origin[2] - aiming[2];
  2416.  
  2417. entity_set_int(ent, EV_INT_iuser2, id);
  2418. }
  2419.  
  2420. public CmdRelease(id)
  2421. {
  2422. if ( !g_admin[id] && !g_gived_access[id] )
  2423. {
  2424. console_print(id, "You have no access to that command");
  2425. return PLUGIN_HANDLED;
  2426. }
  2427. else if ( !g_grabbed[id] )
  2428. {
  2429. return PLUGIN_HANDLED;
  2430. }
  2431.  
  2432. if ( IsBlock(g_grabbed[id]) )
  2433. {
  2434. if ( IsBlockInGroup(id, g_grabbed[id]) && g_group_count[id] > 1 )
  2435. {
  2436. static i, block;
  2437.  
  2438. new bool:group_is_stuck = true;
  2439.  
  2440. for ( i = 0; i <= g_group_count[id]; ++i )
  2441. {
  2442. block = g_grouped_blocks[id][i];
  2443. if ( IsBlockInGroup(id, block) )
  2444. {
  2445. entity_set_int(block, EV_INT_iuser2, 0);
  2446.  
  2447. if ( group_is_stuck && !IsBlockStuck(block) )
  2448. {
  2449. group_is_stuck = false;
  2450. break;
  2451. }
  2452. }
  2453. }
  2454.  
  2455. if ( group_is_stuck )
  2456. {
  2457. for ( i = 0; i <= g_group_count[id]; ++i )
  2458. {
  2459. block = g_grouped_blocks[id][i];
  2460. if ( IsBlockInGroup(id, block) ) DeleteBlock(block);
  2461. }
  2462.  
  2463. JCM_Print(id, "^3Group deleted because all the blocks were^3 stuck!");
  2464. }
  2465. }
  2466. else
  2467. {
  2468. if ( is_valid_ent(g_grabbed[id]) )
  2469. {
  2470. if ( IsBlockStuck(g_grabbed[id]) )
  2471. {
  2472. new bool:deleted = DeleteBlock(g_grabbed[id]);
  2473. if ( deleted ) JCM_Print(id, "^3Block deleted because it was^4 stuck!");
  2474. }
  2475. else
  2476. {
  2477. entity_set_int(g_grabbed[id], EV_INT_iuser2, 0);
  2478.  
  2479. new blockType = pev(g_grabbed[id], pev_body);
  2480.  
  2481. if( blockType == MAGIC )
  2482. {
  2483. new Float:fOrigin[3];
  2484. pev(g_grabbed[id], pev_origin, fOrigin);
  2485. set_pev(g_grabbed[id], pev_v_angle, fOrigin);
  2486. }
  2487. }
  2488. }
  2489. }
  2490. }
  2491. else if ( IsTeleport(g_grabbed[id]) )
  2492. {
  2493. entity_set_int(g_grabbed[id], EV_INT_iuser2, 0);
  2494. }
  2495.  
  2496. entity_get_string(id, EV_SZ_viewmodel, g_viewmodel[id], charsmax(g_viewmodel));
  2497. entity_set_string(id, EV_SZ_viewmodel, g_blank);
  2498.  
  2499. g_grabbed[id] = 0;
  2500.  
  2501. return PLUGIN_HANDLED;
  2502. }
  2503.  
  2504. public CmdMainMenu(id)
  2505. {
  2506. if( !g_admin[id] && !g_gived_access[id] )
  2507. {
  2508. CmdShowInfo(id);
  2509. }
  2510. else
  2511. {
  2512. ShowMainMenu(id);
  2513. }
  2514.  
  2515. return PLUGIN_HANDLED;
  2516. }
  2517.  
  2518. ShowMainMenu(id)
  2519. {
  2520. new menu[256];
  2521.  
  2522. format(menu, charsmax(menu),\
  2523. g_main_menu,\
  2524. g_noclip[id] ? "\yOn" : "\rOff",\
  2525. g_godmode[id] ? "\yOn" : "\rOff"
  2526. );
  2527.  
  2528. show_menu(id, g_keys_main_menu, menu, -1, "JcmMainMenu");
  2529. }
  2530.  
  2531. ShowBlockMenu(id)
  2532. {
  2533. new menu[256], col1[3], col2[3], size[8], blockCount, ent;
  2534.  
  2535. while((ent = find_ent_by_class(ent, g_block_classname)))
  2536. {
  2537. blockCount++;
  2538. }
  2539.  
  2540. col1 = g_admin[id] || g_gived_access[id] ? "\r" : "\d";
  2541. col2 = g_admin[id] || g_gived_access[id] ? "\w" : "\d";
  2542.  
  2543. switch ( g_selected_block_size[id] )
  2544. {
  2545. case TINY: size = "Tiny";
  2546. case NORMAL: size = "Normal";
  2547. case LARGE: size = "Large";
  2548. case POLE: size = "Pole";
  2549. }
  2550.  
  2551. format(menu, charsmax(menu),\
  2552. g_block_menu,\
  2553. PLUGIN_PREFIX,\
  2554. blockCount,\
  2555. g_block_names[g_selected_block_type[id]],\
  2556. size,\
  2557. col1,\
  2558. col2,\
  2559. col1,\
  2560. col2,\
  2561. col1,\
  2562. col2,\
  2563. col1,\
  2564. col2,\
  2565. col1,\
  2566. col2,\
  2567. col1,\
  2568. col2
  2569. );
  2570.  
  2571. show_menu(id, g_keys_block_menu, menu, -1, "JcmBlockMenu");
  2572. }
  2573.  
  2574. ShowBlockSelectionMenu(id)
  2575. {
  2576. new menu[256], title[32], entry[32], num;
  2577.  
  2578. format(title, charsmax(title), "\r[%s] \yBlock Selection %d^n^n", PLUGIN_PREFIX, g_block_selection_page[id]);
  2579. add(menu, charsmax(menu), title);
  2580.  
  2581. new start_block = ( g_block_selection_page[id] - 1 ) * 8;
  2582.  
  2583. for ( new i = start_block; i < start_block + 8; ++i )
  2584. {
  2585. if ( i < TOTAL_BLOCKS )
  2586. {
  2587. num = ( i - start_block ) + 1;
  2588.  
  2589. format(entry, charsmax(entry), "\r%d. \w%s^n", num, g_block_names[i]);
  2590. }
  2591. else
  2592. {
  2593. format(entry, charsmax(entry), "^n");
  2594. }
  2595.  
  2596. add(menu, charsmax(menu), entry);
  2597. }
  2598.  
  2599. if ( g_block_selection_page[id] < g_block_selection_pages_max )
  2600. {
  2601. add(menu, charsmax(menu), "^n\r9. \wMore");
  2602. }
  2603. else
  2604. {
  2605. add(menu, charsmax(menu), "^n");
  2606. }
  2607.  
  2608. add(menu, charsmax(menu), "^n\r0. \wBack");
  2609.  
  2610. show_menu(id, g_keys_block_selection_menu, menu, -1, "JcmBlockSelectionMenu");
  2611. }
  2612.  
  2613. ShowPropertiesMenu(id, ent)
  2614. {
  2615. new menu[256], title[32], entry[64], property[20], line1[3], line2[3], line3[3], line4[3], num, block_type;
  2616.  
  2617. block_type = entity_get_int(ent, EV_INT_body);
  2618.  
  2619. format(title, charsmax(title), "\r[%s] \ySet Properties^n^n", PLUGIN_PREFIX);
  2620. add(menu, charsmax(menu), title);
  2621.  
  2622. if ( g_property1_name[block_type][0] )
  2623. {
  2624. if ( block_type == BUNNYHOP
  2625. || block_type == NO_SLOW_DOWN_BUNNYHOP )
  2626. {
  2627. format(entry, charsmax(entry), "\r1. \w%s: %s^n", g_property1_name[block_type], property[0] == '1' ? "\yOn" : "\rOff");
  2628. }
  2629. else if ( block_type == SLAP )
  2630. {
  2631. format(entry, charsmax(entry), "\r1. \w%s: \y%s^n", g_property1_name[block_type], property[0] == '3' ? "High" : property[0] == '2' ? "Medium" : "Low");
  2632. }
  2633. else if( block_type == MAGIC )
  2634. {
  2635. format(entry, charsmax(entry), "\r1. \w%s: \y%s^n", g_property1_name[block_type], property[0] == '3' ? "Everyone" : property[0] == '2' ? "Counter-Terrorists" : "Terrorists");
  2636. }
  2637. else
  2638. {
  2639. format(entry, charsmax(entry), "\r1. \w%s: \y%s^n", g_property1_name[block_type], property);
  2640. }
  2641.  
  2642. add(menu, charsmax(menu), entry);
  2643. }
  2644. else
  2645. {
  2646. format(line1, charsmax(line1), "^n");
  2647. }
  2648.  
  2649. if ( g_property2_name[block_type][0] )
  2650. {
  2651. if ( g_property1_name[block_type][0] )
  2652. {
  2653. num = 2;
  2654. }
  2655. else
  2656. {
  2657. num = 1;
  2658. }
  2659.  
  2660. GetProperty(ent, 2, property);
  2661.  
  2662. format(entry, charsmax(entry), "\r%d. \w%s: \y%s^n", num, g_property2_name[block_type], property);
  2663.  
  2664. add(menu, charsmax(menu), entry);
  2665. }
  2666. else
  2667. {
  2668. format(line2, charsmax(line2), "^n");
  2669. }
  2670.  
  2671. if ( g_property3_name[block_type][0] )
  2672. {
  2673. if ( g_property1_name[block_type][0] && g_property2_name[block_type][0] )
  2674. {
  2675. num = 3;
  2676. }
  2677. else if ( g_property1_name[block_type][0]
  2678. || g_property2_name[block_type][0] )
  2679. {
  2680. num = 2;
  2681. }
  2682. else
  2683. {
  2684. num = 1;
  2685. }
  2686.  
  2687. GetProperty(ent, 3, property);
  2688.  
  2689. if ( block_type == BOOTS_OF_SPEED
  2690. || property[0] != '0' && !( property[0] == '2' && property[1] == '5' && property[2] == '5' ) )
  2691. {
  2692. format(entry, charsmax(entry), "\r%d. \w%s: \y%s^n", num, g_property3_name[block_type], property);
  2693. }
  2694. else
  2695. {
  2696. format(entry, charsmax(entry), "\r%d. \w%s: \rOff^n", num, g_property3_name[block_type]);
  2697. }
  2698.  
  2699. add(menu, charsmax(menu), entry);
  2700. }
  2701. else
  2702. {
  2703. format(line3, charsmax(line3), "^n");
  2704. }
  2705.  
  2706. if ( g_property4_name[block_type][0] )
  2707. {
  2708. if ( g_property1_name[block_type][0] && g_property2_name[block_type][0] && g_property3_name[block_type][0] )
  2709. {
  2710. num = 4;
  2711. }
  2712. else if ( g_property1_name[block_type][0] && g_property2_name[block_type][0]
  2713. || g_property1_name[block_type][0] && g_property3_name[block_type][0]
  2714. || g_property2_name[block_type][0] && g_property3_name[block_type][0] )
  2715. {
  2716. num = 3;
  2717. }
  2718. else if ( g_property1_name[block_type][0]
  2719. || g_property2_name[block_type][0]
  2720. || g_property3_name[block_type][0] )
  2721. {
  2722. num = 2;
  2723. }
  2724. else
  2725. {
  2726. num = 1;
  2727. }
  2728.  
  2729. GetProperty(ent, 4, property);
  2730.  
  2731. format(entry, charsmax(entry), "\r%d. \w%s: %s^n", num, g_property4_name[block_type], property[0] == '1' ? "\yYes" : "\rNo");
  2732. add(menu, charsmax(menu), entry);
  2733. }
  2734. else
  2735. {
  2736. format(line4, charsmax(line4), "^n");
  2737. }
  2738.  
  2739. g_property_info[id][1] = ent;
  2740.  
  2741. add(menu, charsmax(menu), line1);
  2742. add(menu, charsmax(menu), line2);
  2743. add(menu, charsmax(menu), line3);
  2744. add(menu, charsmax(menu), line4);
  2745. add(menu, charsmax(menu), "^n^n^n^n^n^n\r0. \wBack");
  2746.  
  2747. show_menu(id, g_keys_properties_menu, menu, -1, "JcmPropertiesMenu");
  2748. }
  2749.  
  2750. ShowMoveMenu(id)
  2751. {
  2752. if ( !g_admin[id] && !g_gived_access[id] )
  2753. {
  2754. ShowBlockMenu(id);
  2755. return PLUGIN_HANDLED;
  2756. }
  2757.  
  2758. new menu[256];
  2759.  
  2760. format(menu, charsmax(menu), g_move_menu, PLUGIN_PREFIX, g_grid_size[id]);
  2761.  
  2762. show_menu(id, g_keys_move_menu, menu, -1, "JcmMoveMenu");
  2763.  
  2764. return PLUGIN_HANDLED;
  2765. }
  2766.  
  2767. ShowTeleportMenu(id)
  2768. {
  2769. new menu[256], col1[3], col2[3], teleCount, ent;
  2770.  
  2771. while((ent = find_ent_by_class(ent, g_start_classname)))
  2772. {
  2773. teleCount++;
  2774. }
  2775.  
  2776. col1 = g_admin[id] || g_gived_access[id] ? "\r" : "\d";
  2777. col2 = g_admin[id] || g_gived_access[id] ? "\w" : "\d";
  2778.  
  2779. format(menu, charsmax(menu),\
  2780. g_teleport_menu,\
  2781. PLUGIN_PREFIX,\
  2782. teleCount,\
  2783. col1,\
  2784. col2,\
  2785. g_teleport_start[id] ? "\r" : "\d",\
  2786. g_teleport_start[id] ? "\w" : "\d",\
  2787. col1,\
  2788. col2,\
  2789. col1,\
  2790. col2,\
  2791. col1,\
  2792. col2
  2793. );
  2794.  
  2795. show_menu(id, g_keys_teleport_menu, menu, -1, "JcmTeleportMenu");
  2796. }
  2797.  
  2798. ShowLightMenu(id)
  2799. {
  2800. new menu[256], col1[3], col2[3], lightCount, ent;
  2801.  
  2802. while((ent = find_ent_by_class(ent, g_light_classname)))
  2803. {
  2804. lightCount++;
  2805. }
  2806.  
  2807. col1 = g_admin[id] || g_gived_access[id] ? "\r" : "\d";
  2808. col2 = g_admin[id] || g_gived_access[id] ? "\w" : "\d";
  2809.  
  2810. format(menu, charsmax(menu),\
  2811. g_light_menu,\
  2812. PLUGIN_PREFIX,\
  2813. lightCount,\
  2814. col1,\
  2815. col2,\
  2816. col1,\
  2817. col2,\
  2818. col1,\
  2819. col2
  2820. );
  2821.  
  2822. show_menu(id, g_keys_light_menu, menu, -1, "JcmLightMenu");
  2823. }
  2824.  
  2825. ShowBoxMenu(id)
  2826. {
  2827. new menu[256], col1[3], col2[3], boxCount, ent;
  2828.  
  2829. while((ent = find_ent_by_class(ent, g_box_classname)))
  2830. {
  2831. boxCount++;
  2832. }
  2833.  
  2834. col1 = g_admin[id] || g_gived_access[id] ? "\r" : "\d";
  2835. col2 = g_admin[id] || g_gived_access[id] ? "\w" : "\d";
  2836.  
  2837. format(menu, charsmax(menu),\
  2838. g_box_menu,\
  2839. PLUGIN_PREFIX,\
  2840. boxCount,\
  2841. col1,\
  2842. col2,\
  2843. col1,\
  2844. col2,\
  2845. col1,\
  2846. col2
  2847. );
  2848.  
  2849. show_menu(id, g_keys_box_menu, menu, -1, "JcmBoxMenu");
  2850. }
  2851.  
  2852. ShowLightPropertiesMenu(id, ent)
  2853. {
  2854. new menu[256], radius[5], color_red[5], color_green[5], color_blue[5];
  2855.  
  2856. GetProperty(ent, 1, radius);
  2857. GetProperty(ent, 2, color_red);
  2858. GetProperty(ent, 3, color_green);
  2859. GetProperty(ent, 4, color_blue);
  2860.  
  2861. format(menu, charsmax(menu),\
  2862. g_light_properties_menu,\
  2863. PLUGIN_PREFIX,\
  2864. radius,\
  2865. color_red,\
  2866. color_green,\
  2867. color_blue
  2868. );
  2869.  
  2870. g_light_property_info[id][1] = ent;
  2871.  
  2872. show_menu(id, g_keys_light_properties_menu, menu, -1, "JcmLightPropertiesMenu");
  2873. }
  2874.  
  2875. ShowOptionsMenu(id)
  2876. {
  2877. new menu[256], col1[3], col2[3], col3[3], col4[3];
  2878.  
  2879. col1 = g_admin[id] || g_gived_access[id] ? "\r" : "\d";
  2880. col2 = g_admin[id] || g_gived_access[id] ? "\w" : "\d";
  2881. col3 = g_admin[id] ? "\r" : "\d";
  2882. col4 = g_admin[id] ? "\w" : "\d";
  2883.  
  2884. format(menu, charsmax(menu),\
  2885. g_options_menu,\
  2886. PLUGIN_PREFIX,\
  2887. col1,\
  2888. col2,\
  2889. g_snapping[id] ? "\yOn" : "\rOff",\
  2890. col1,\
  2891. col2,\
  2892. g_snapping_gap[id],\
  2893. col1,\
  2894. col2,\
  2895. col1,\
  2896. col2,\
  2897. col3,\
  2898. col4,\
  2899. col3,\
  2900. col4,\
  2901. col3,\
  2902. col4
  2903. );
  2904.  
  2905. show_menu(id, g_keys_options_menu, menu, -1, "JcmOptionsMenu");
  2906. }
  2907.  
  2908. ShowChoiceMenu(id, choice, const title[96])
  2909. {
  2910. new menu[128];
  2911.  
  2912. g_choice_option[id] = choice;
  2913.  
  2914. format(menu, charsmax(menu), g_choice_menu, title);
  2915.  
  2916. show_menu(id, g_keys_choice_menu, menu, -1, "JcmChoiceMenu");
  2917. }
  2918.  
  2919. ShowCommandsMenu(id)
  2920. {
  2921. new menu[256], col1[3], col2[3], col3[3], col4[3];
  2922.  
  2923. col1 = g_admin[id] ? "\r" : "\d";
  2924. col2 = g_admin[id] ? "\w" : "\d";
  2925. col3 = ( g_admin[id] || g_gived_access[id] ) && g_alive[id] ? "\r" : "\d";
  2926. col4 = ( g_admin[id] || g_gived_access[id] ) && g_alive[id] ? "\w" : "\d";
  2927.  
  2928. format(menu, charsmax(menu),\
  2929. g_commands_menu,\
  2930. PLUGIN_PREFIX,\
  2931. col3,\
  2932. col4,\
  2933. g_alive[id] && g_has_checkpoint[id] ? "\r" : "\d",\
  2934. g_alive[id] && g_has_checkpoint[id] ? "\w" : "\d",\
  2935. ( g_admin[id] || g_gived_access[id] ) && !g_alive[id] ? "\r" : "\d",\
  2936. ( g_admin[id] || g_gived_access[id] ) && !g_alive[id] ? "\w" : "\d",\
  2937. col1,\
  2938. col2,\
  2939. col1,\
  2940. col2,\
  2941. col1,\
  2942. col2,\
  2943. g_all_godmode ? "Remove" : "Set",\
  2944. g_all_godmode ? "from" : "on",\
  2945. col1,\
  2946. col2,\
  2947. PLUGIN_PREFIX,\
  2948. col1,\
  2949. col2
  2950. );
  2951.  
  2952. show_menu(id, g_keys_commands_menu, menu, -1, "JcmCommandsMenu");
  2953. }
  2954.  
  2955. public HandleMainMenu(id, key)
  2956. {
  2957. switch ( key )
  2958. {
  2959. case K1: ShowBlockMenu(id);
  2960. case K2: ShowTeleportMenu(id);
  2961. case K3: ShowLightMenu(id);
  2962. case K4: ShowBoxMenu(id);
  2963. case K5: CmdSpectator(id);
  2964. case K6: ToggleNoclip(id);
  2965. case K7: ToggleGodmode(id);
  2966. case K8:
  2967. {
  2968. g_viewing_commands_menu[id] = true;
  2969. ShowCommandsMenu(id);
  2970. }
  2971. case K9: ShowOptionsMenu(id);
  2972. case K0: return;
  2973. }
  2974.  
  2975. if ( key == K6 || key == K5 || key == K7 ) ShowMainMenu(id);
  2976. }
  2977.  
  2978. public HandleBlockMenu(id, key)
  2979. {
  2980. switch ( key )
  2981. {
  2982. case K1:
  2983. {
  2984. g_block_selection_page[id] = 1;
  2985. ShowBlockSelectionMenu(id);
  2986. }
  2987. case K2: ChangeBlockSize(id);
  2988. case K3: CreateBlockAiming(id, g_selected_block_type[id]);
  2989. case K4: ConvertBlockAiming(id, g_selected_block_type[id]);
  2990. case K5: DeleteBlockAiming(id);
  2991. case K6: RotateBlockAiming(id);
  2992. case K7: SetPropertiesBlockAiming(id);
  2993. case K8: ShowMoveMenu(id);
  2994. case K0: ShowMainMenu(id);
  2995. }
  2996.  
  2997. if ( key != K1 && key != K7 && key != K8 && key != K0 ) ShowBlockMenu(id);
  2998. }
  2999.  
  3000. public HandleBlockSelectionMenu(id, key)
  3001. {
  3002. switch ( key )
  3003. {
  3004. case K9:
  3005. {
  3006. ++g_block_selection_page[id];
  3007.  
  3008. if ( g_block_selection_page[id] > g_block_selection_pages_max )
  3009. {
  3010. g_block_selection_page[id] = g_block_selection_pages_max;
  3011. }
  3012.  
  3013. ShowBlockSelectionMenu(id);
  3014. }
  3015. case K0:
  3016. {
  3017. --g_block_selection_page[id];
  3018.  
  3019. if ( g_block_selection_page[id] < 1 )
  3020. {
  3021. ShowBlockMenu(id);
  3022. }
  3023. else
  3024. {
  3025. ShowBlockSelectionMenu(id);
  3026. }
  3027. }
  3028. default:
  3029. {
  3030. key += ( g_block_selection_page[id] - 1 ) * 8;
  3031.  
  3032. if ( key < TOTAL_BLOCKS )
  3033. {
  3034. g_selected_block_type[id] = key;
  3035. ShowBlockMenu(id);
  3036. }
  3037. else
  3038. {
  3039. ShowBlockSelectionMenu(id);
  3040. }
  3041. }
  3042. }
  3043. }
  3044.  
  3045. public HandlePropertiesMenu(id, key)
  3046. {
  3047. new ent = g_property_info[id][1];
  3048. if ( !is_valid_ent(ent) )
  3049. {
  3050. JCM_Print(id, "^3That block has been deleted!");
  3051. g_viewing_properties_menu[id] = false;
  3052. ShowBlockMenu(id);
  3053. return PLUGIN_HANDLED;
  3054. }
  3055.  
  3056. new block_type = entity_get_int(ent, EV_INT_body);
  3057.  
  3058. switch ( key )
  3059. {
  3060. case K1:
  3061. {
  3062. if ( g_property1_name[block_type][0] )
  3063. {
  3064. g_property_info[id][0] = 1;
  3065. }
  3066. else if ( g_property2_name[block_type][0] )
  3067. {
  3068. g_property_info[id][0] = 2;
  3069. }
  3070. else if ( g_property3_name[block_type][0] )
  3071. {
  3072. g_property_info[id][0] = 3;
  3073. }
  3074. else
  3075. {
  3076. g_property_info[id][0] = 4;
  3077. }
  3078.  
  3079. if ( g_property_info[id][0] == 1
  3080. && ( block_type == BUNNYHOP
  3081. || block_type == SLAP
  3082. || block_type == MAGIC
  3083. || block_type == NO_SLOW_DOWN_BUNNYHOP ) )
  3084. {
  3085. ToggleProperty(id, 1);
  3086. }
  3087. else if ( g_property_info[id][0] == 4 )
  3088. {
  3089. ToggleProperty(id, 4);
  3090. }
  3091. else
  3092. {
  3093. JCM_Print(id, "^3Type the new property value for the block^4.%s", g_property_info[id][0] == 3 && block_type != BOOTS_OF_SPEED ? "^1 0^3 and^1 255^3 will turn transparency off." : g_blank);
  3094. client_cmd(id, "messagemode JCM_SetProperty");
  3095. }
  3096. }
  3097. case K2:
  3098. {
  3099. if ( g_property1_name[block_type][0] && g_property2_name[block_type][0]
  3100. || g_property1_name[block_type][0] && g_property3_name[block_type][0]
  3101. || g_property1_name[block_type][0] && g_property4_name[block_type][0]
  3102. || g_property2_name[block_type][0] && g_property3_name[block_type][0]
  3103. || g_property2_name[block_type][0] && g_property4_name[block_type][0]
  3104. || g_property3_name[block_type][0] && g_property4_name[block_type][0] )
  3105. {
  3106. if ( g_property1_name[block_type][0] && g_property2_name[block_type][0] )
  3107. {
  3108. g_property_info[id][0] = 2;
  3109. }
  3110. else if ( g_property1_name[block_type][0] && g_property3_name[block_type][0]
  3111. || g_property2_name[block_type][0] && g_property3_name[block_type][0] )
  3112. {
  3113. g_property_info[id][0] = 3;
  3114. }
  3115. else
  3116. {
  3117. g_property_info[id][0] = 4;
  3118. }
  3119.  
  3120. if ( g_property_info[id][0] == 4 )
  3121. {
  3122. ToggleProperty(id, 4);
  3123. }
  3124. else
  3125. {
  3126. JCM_Print(id, "^3Type the new property value for the block.^4%s", g_property_info[id][0] == 3 && block_type != BOOTS_OF_SPEED ? "^1 0^3 and^1 255^3 will turn transparency off." : g_blank);
  3127. client_cmd(id, "messagemode JCM_SetProperty");
  3128. }
  3129. }
  3130. }
  3131. case K3:
  3132. {
  3133. if ( g_property1_name[block_type][0] && g_property2_name[block_type][0] && g_property3_name[block_type][0]
  3134. || g_property1_name[block_type][0] && g_property2_name[block_type][0] && g_property4_name[block_type][0]
  3135. || g_property1_name[block_type][0] && g_property3_name[block_type][0] && g_property4_name[block_type][0]
  3136. || g_property2_name[block_type][0] && g_property3_name[block_type][0] && g_property4_name[block_type][0] )
  3137. {
  3138. if ( g_property1_name[block_type][0] && g_property2_name[block_type][0] && g_property3_name[block_type][0] )
  3139. {
  3140. g_property_info[id][0] = 3;
  3141. }
  3142. else
  3143. {
  3144. g_property_info[id][0] = 4;
  3145. }
  3146.  
  3147. if ( g_property_info[id][0] == 4 )
  3148. {
  3149. ToggleProperty(id, 4);
  3150. }
  3151. else
  3152. {
  3153. JCM_Print(id, "^3Type the new property value for the block.^4%s", g_property_info[id][0] == 3 && block_type != BOOTS_OF_SPEED ? "^1 0^3 and^1 255^3 will turn transparency off." : g_blank);
  3154. client_cmd(id, "messagemode JCM_SetProperty");
  3155. }
  3156. }
  3157. }
  3158. case K4:
  3159. {
  3160. if ( g_property1_name[block_type][0] && g_property2_name[block_type][0] && g_property3_name[block_type][0] && g_property4_name[block_type][0] )
  3161. {
  3162. ToggleProperty(id, 4);
  3163. }
  3164. }
  3165. case K0:
  3166. {
  3167. g_viewing_properties_menu[id] = false;
  3168. ShowBlockMenu(id);
  3169. }
  3170. }
  3171.  
  3172. if ( key != K0 ) ShowPropertiesMenu(id, ent);
  3173.  
  3174. return PLUGIN_HANDLED;
  3175. }
  3176.  
  3177. public HandleMoveMenu(id, key)
  3178. {
  3179. switch ( key )
  3180. {
  3181. case K1: ToggleGridSize(id);
  3182. case K0: ShowBlockMenu(id);
  3183. default:
  3184. {
  3185. static ent, body;
  3186. get_user_aiming(id, ent, body);
  3187.  
  3188. if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
  3189.  
  3190. static Float:origin[3];
  3191.  
  3192. if ( IsBlockInGroup(id, ent) && g_group_count[id] > 1 )
  3193. {
  3194. static i, block;
  3195.  
  3196. new bool:group_is_stuck = true;
  3197.  
  3198. for ( i = 0; i <= g_group_count[id]; ++i )
  3199. {
  3200. block = g_grouped_blocks[id][i];
  3201. if ( IsBlockInGroup(id, block) )
  3202. {
  3203. entity_get_vector(block, EV_VEC_origin, origin);
  3204.  
  3205. switch ( key )
  3206. {
  3207. case K2: origin[2] += g_grid_size[id];
  3208. case K3: origin[2] -= g_grid_size[id];
  3209. case K4: origin[0] += g_grid_size[id];
  3210. case K5: origin[0] -= g_grid_size[id];
  3211. case K6: origin[1] += g_grid_size[id];
  3212. case K7: origin[1] -= g_grid_size[id];
  3213. }
  3214.  
  3215. MoveEntity(id, block, origin, false);
  3216.  
  3217. if ( group_is_stuck && !IsBlockStuck(block) )
  3218. {
  3219. group_is_stuck = false;
  3220. break;
  3221. }
  3222. }
  3223. }
  3224.  
  3225. if ( group_is_stuck )
  3226. {
  3227. for ( i = 0; i <= g_group_count[id]; ++i )
  3228. {
  3229. block = g_grouped_blocks[id][i];
  3230. if ( IsBlockInGroup(id, block) )
  3231. {
  3232. DeleteBlock(block);
  3233. }
  3234. }
  3235.  
  3236. JCM_Print(id, "^3Group deleted because all the blocks were^4 stuck!");
  3237. }
  3238. }
  3239. else
  3240. {
  3241. entity_get_vector(ent, EV_VEC_origin, origin);
  3242.  
  3243. switch ( key )
  3244. {
  3245. case K2: origin[2] += g_grid_size[id];
  3246. case K3: origin[2] -= g_grid_size[id];
  3247. case K4: origin[0] += g_grid_size[id];
  3248. case K5: origin[0] -= g_grid_size[id];
  3249. case K6: origin[1] += g_grid_size[id];
  3250. case K7: origin[1] -= g_grid_size[id];
  3251. }
  3252.  
  3253. MoveEntity(id, ent, origin, false);
  3254.  
  3255. if ( IsBlockStuck(ent) )
  3256. {
  3257. new bool:deleted = DeleteBlock(ent);
  3258. if ( deleted ) JCM_Print(id, "^3Block deleted because it was^4 stuck!");
  3259. }
  3260. }
  3261. }
  3262. }
  3263.  
  3264. if ( key != K0 ) ShowMoveMenu(id);
  3265.  
  3266. return PLUGIN_HANDLED;
  3267. }
  3268.  
  3269. public HandleTeleportMenu(id, key)
  3270. {
  3271. switch ( key )
  3272. {
  3273. case K1: CreateTeleportAiming(id, TELEPORT_START);
  3274. case K2: CreateTeleportAiming(id, TELEPORT_DESTINATION);
  3275. case K3: DeleteTeleportAiming(id);
  3276. case K4: SwapTeleportAiming(id);
  3277. case K5: ShowTeleportPath(id);
  3278. case K0: ShowMainMenu(id);
  3279. }
  3280.  
  3281. if ( key != K9 && key != K0 ) ShowTeleportMenu(id);
  3282. }
  3283.  
  3284. public HandleLightMenu(id, key)
  3285. {
  3286. switch ( key )
  3287. {
  3288. case K1: CreateLightAiming(id);
  3289. case K2: DeleteLightAiming(id);
  3290. case K3: SetPropertiesLightAiming(id);
  3291. case K0: ShowMainMenu(id);
  3292. }
  3293.  
  3294. if ( key != K3 && key != K0 ) ShowLightMenu(id);
  3295. }
  3296.  
  3297. public HandleBoxMenu(id, key)
  3298. {
  3299. switch ( key )
  3300. {
  3301. case K1: CreateBoxAiming(id);
  3302. case K2: DeleteBoxAiming(id);
  3303. case K0: ShowMainMenu(id);
  3304. }
  3305.  
  3306. if ( key != K0 ) ShowBoxMenu(id);
  3307. }
  3308.  
  3309. public HandleLightPropertiesMenu(id, key)
  3310. {
  3311. new ent = g_light_property_info[id][1];
  3312. if ( !is_valid_ent(ent) )
  3313. {
  3314. JCM_Print(id, "That light has been deleted!");
  3315. g_viewing_light_properties_menu[id] = false;
  3316. ShowLightMenu(id);
  3317. return PLUGIN_HANDLED;
  3318. }
  3319.  
  3320. switch ( key )
  3321. {
  3322. case K1: g_light_property_info[id][0] = 1;
  3323. case K2: g_light_property_info[id][0] = 2;
  3324. case K3: g_light_property_info[id][0] = 3;
  3325. case K4: g_light_property_info[id][0] = 4;
  3326. case K0:
  3327. {
  3328. g_viewing_light_properties_menu[id] = false;
  3329. ShowLightMenu(id);
  3330. }
  3331. }
  3332.  
  3333. if ( key != K0 )
  3334. {
  3335. JCM_Print(id, "Type the new property value for the light.");
  3336. client_cmd(id, "messagemode JCM_SetLightProperty");
  3337. ShowLightPropertiesMenu(id, ent);
  3338. }
  3339.  
  3340. return PLUGIN_HANDLED;
  3341. }
  3342.  
  3343. public HandleOptionsMenu(id, key)
  3344. {
  3345. switch ( key )
  3346. {
  3347. case K1: ToggleSnapping(id);
  3348. case K2: ToggleSnappingGap(id);
  3349. case K3: GroupBlockAiming(id);
  3350. case K4: ClearGroup(id);
  3351. case K5:
  3352. {
  3353. if ( g_admin[id] ) ShowChoiceMenu(id, CHOICE_DELETE, "Are you sure you want to delete all blocks and teleports?");
  3354. else ShowOptionsMenu(id);
  3355. }
  3356. case K6: SaveBlocks(id);
  3357. case K7:
  3358. {
  3359. if ( g_admin[id] ) ShowChoiceMenu(id, CHOICE_LOAD, "Loading will delete all blocks and teleports, do you want to continue?");
  3360. else ShowOptionsMenu(id);
  3361. }
  3362. case K0: ShowMainMenu(id);
  3363. }
  3364.  
  3365. if ( key != K5 && key != K7 && key != K0 ) ShowOptionsMenu(id);
  3366. }
  3367.  
  3368. public HandleChoiceMenu(id, key)
  3369. {
  3370. switch ( key )
  3371. {
  3372. case K1:
  3373. {
  3374. switch ( g_choice_option[id] )
  3375. {
  3376. case CHOICE_DELETE: DeleteAll(id, true);
  3377. case CHOICE_LOAD: LoadBlocks(id);
  3378. }
  3379. }
  3380. case K2: ShowOptionsMenu(id);
  3381. }
  3382.  
  3383. ShowOptionsMenu(id);
  3384. }
  3385.  
  3386. public HandleCommandsMenu(id, key)
  3387. {
  3388. switch ( key )
  3389. {
  3390. case K1: CmdSaveCheckpoint(id);
  3391. case K2: CmdLoadCheckpoint(id);
  3392. case K3: CmdReviveYourself(id);
  3393. case K4: CmdRevivePlayer(id);
  3394. case K5: CmdReviveEveryone(id);
  3395. case K6: ToggleAllGodmode(id);
  3396. case K7: CmdGiveAccess(id);
  3397. case K8: CmdSpectator(id);
  3398. case K0:
  3399. {
  3400. g_viewing_commands_menu[id] = false;
  3401. ShowMainMenu(id);
  3402. }
  3403. }
  3404.  
  3405. if ( key != K0 ) ShowCommandsMenu(id);
  3406. }
  3407.  
  3408. public CmdSpectator(id)
  3409. {
  3410. cs_set_user_team(id, CS_TEAM_SPECTATOR);
  3411. ColorChat ( id, GREY, "%s You just joined^4 Spectator^3!", prefix );
  3412. }
  3413.  
  3414. ToggleNoclip(id)
  3415. {
  3416. if ( g_admin[id] || g_gived_access[id] )
  3417. {
  3418. set_user_noclip(id, g_noclip[id] ? 0 : 1);
  3419. g_noclip[id] = !g_noclip[id];
  3420. }
  3421. }
  3422.  
  3423. ToggleGodmode(id)
  3424. {
  3425. if ( g_admin[id] || g_gived_access[id] )
  3426. {
  3427. set_user_godmode(id, g_godmode[id] ? 0 : 1);
  3428. g_godmode[id] = !g_godmode[id];
  3429. }
  3430. }
  3431.  
  3432. ToggleGridSize(id)
  3433. {
  3434. g_grid_size[id] *= 2;
  3435.  
  3436. {
  3437. g_grid_size[id] = 1.0;
  3438. }
  3439. }
  3440.  
  3441. ToggleSnapping(id)
  3442. {
  3443. if ( g_admin[id] || g_gived_access[id] )
  3444. {
  3445. g_snapping[id] = !g_snapping[id];
  3446. }
  3447. }
  3448.  
  3449. ToggleSnappingGap(id)
  3450. {
  3451. if ( g_admin[id] || g_gived_access[id] )
  3452. {
  3453. g_snapping_gap[id] += 4.0;
  3454.  
  3455. if ( g_snapping_gap[id] > 40.0 )
  3456. {
  3457. g_snapping_gap[id] = 0.0;
  3458. }
  3459. }
  3460. }
  3461.  
  3462. public CmdSaveCheckpoint(id)
  3463. {
  3464. if ( !g_admin[id] && !g_gived_access[id] )
  3465. {
  3466. console_print(id, "You have no access to that command");
  3467. return PLUGIN_HANDLED;
  3468. }
  3469. else if ( !g_alive[id] )
  3470. {
  3471. JCM_Print(id, "^3You have to be alive to save a^4 checkpoint!");
  3472. return PLUGIN_HANDLED;
  3473. }
  3474. else if ( g_noclip[id] )
  3475. {
  3476. JCM_Print(id, "^3You can't save a checkpoint while using noclip!");
  3477. return PLUGIN_HANDLED;
  3478. }
  3479.  
  3480. static Float:velocity[3];
  3481. get_user_velocity(id, velocity);
  3482.  
  3483. new button = entity_get_int(id, EV_INT_button);
  3484. new flags = entity_get_int(id, EV_INT_flags);
  3485.  
  3486. if ( !( ( velocity[2] >= 0.0 || ( flags & FL_INWATER ) ) && !( button & IN_JUMP ) && velocity[2] <= 0.0 ) )
  3487. {
  3488. JCM_Print(id, "^3You can't save a checkpoint while moving up or down!");
  3489. return PLUGIN_HANDLED;
  3490. }
  3491.  
  3492. if ( flags & FL_DUCKING ) g_checkpoint_duck[id] = true;
  3493. else g_checkpoint_duck[id] = false;
  3494.  
  3495. entity_get_vector(id, EV_VEC_origin, g_checkpoint_position[id]);
  3496.  
  3497. JCM_Print(id, "^3Checkpoint saved!");
  3498.  
  3499. if ( !g_has_checkpoint[id] ) g_has_checkpoint[id] = true;
  3500.  
  3501. if ( g_viewing_commands_menu[id] ) ShowCommandsMenu(id);
  3502.  
  3503. return PLUGIN_HANDLED;
  3504. }
  3505.  
  3506. public CmdLoadCheckpoint(id)
  3507. {
  3508. if ( !g_admin[id] && !g_gived_access[id] )
  3509. {
  3510. console_print(id, "You have no access to that command");
  3511. return PLUGIN_HANDLED;
  3512. }
  3513. else if ( !g_alive[id] )
  3514. {
  3515. JCM_Print(id, "^3You have to be alive to load a checkpoint!");
  3516. return PLUGIN_HANDLED;
  3517. }
  3518. else if ( !g_has_checkpoint[id] )
  3519. {
  3520. JCM_Print(id, "^3You don't have a checkpoint!");
  3521. return PLUGIN_HANDLED;
  3522. }
  3523.  
  3524. static Float:origin[3];
  3525. for ( new i = 1; i <= g_max_players; i++ )
  3526. {
  3527. if ( i == id
  3528. || !g_alive[i] ) continue;
  3529.  
  3530. entity_get_vector(id, EV_VEC_origin, origin);
  3531.  
  3532. if ( get_distance_f(g_checkpoint_position[id], origin) <= 35.0 )
  3533. {
  3534. if ( cs_get_user_team(i) == cs_get_user_team(id) ) continue;
  3535.  
  3536. JCM_Print(id, "^3Somebody is too close to your checkpoint!");
  3537. return PLUGIN_HANDLED;
  3538. }
  3539. }
  3540.  
  3541. entity_set_vector(id, EV_VEC_origin, g_checkpoint_position[id]);
  3542. entity_set_vector(id, EV_VEC_velocity, Float:{ 0.0, 0.0, 0.0 });
  3543.  
  3544. if ( g_checkpoint_duck[id] )
  3545. {
  3546. entity_set_int(id, EV_INT_flags, entity_get_int(id, EV_INT_flags) | FL_DUCKING);
  3547. }
  3548.  
  3549. return PLUGIN_HANDLED;
  3550. }
  3551.  
  3552. public CmdReviveYourself(id)
  3553. {
  3554. if ( !g_admin[id] && !g_gived_access[id] )
  3555. {
  3556. console_print(id, "You have no access to that command");
  3557. return PLUGIN_HANDLED;
  3558. }
  3559. else if ( g_alive[id] )
  3560. {
  3561. JCM_Print(id, "^3You are already alive!");
  3562. return PLUGIN_HANDLED;
  3563. }
  3564.  
  3565. ExecuteHam(Ham_CS_RoundRespawn, id);
  3566. JCM_Print(id, "^3You have^4 revived yourself!");
  3567.  
  3568. static name[32];
  3569. get_user_name(id, name, charsmax(name));
  3570.  
  3571. for ( new i = 1; i <= g_max_players; i++ )
  3572. {
  3573. if ( !g_connected[i]
  3574. || i == id ) continue;
  3575.  
  3576. JCM_Print(i, "^3%s^4 revived^3 himself!", name);
  3577. }
  3578.  
  3579. return PLUGIN_HANDLED;
  3580. }
  3581.  
  3582. CmdRevivePlayer(id)
  3583. {
  3584. if ( !g_admin[id] && !g_gived_access[id] )
  3585. {
  3586. console_print(id, "You have no access to that command");
  3587. return PLUGIN_HANDLED;
  3588. }
  3589.  
  3590. client_cmd(id, "messagemode JCM_Revive");
  3591. JCM_Print(id, "^3Type the name of the client that you want to^4 revive.");
  3592.  
  3593. return PLUGIN_HANDLED;
  3594. }
  3595.  
  3596. public RevivePlayer(id)
  3597. {
  3598. if ( !g_admin[id] && !g_gived_access[id] )
  3599. {
  3600. console_print(id, "You have no access to that command");
  3601. return PLUGIN_HANDLED;
  3602. }
  3603.  
  3604. static arg[32], target;
  3605. read_argv(1, arg, charsmax(arg));
  3606.  
  3607. target = cmd_target(id, arg, CMDTARGET_NO_BOTS);
  3608. if ( !target ) return PLUGIN_HANDLED;
  3609. else if ( id == target )
  3610. {
  3611. CmdReviveYourself(id);
  3612. return PLUGIN_HANDLED;
  3613. }
  3614.  
  3615. static target_name[32];
  3616. get_user_name(target, target_name, charsmax(target_name));
  3617.  
  3618. if ( g_admin[target]
  3619. || g_gived_access[target] )
  3620. {
  3621. JCM_Print(id, "^4%s is admin, he can revive himself!", target_name);
  3622. return PLUGIN_HANDLED;
  3623. }
  3624. else if ( g_alive[target] )
  3625. {
  3626. JCM_Print(id, "^4%s is already alive!", target_name);
  3627. return PLUGIN_HANDLED;
  3628. }
  3629.  
  3630. ExecuteHam(Ham_CS_RoundRespawn, target);
  3631.  
  3632. static admin_name[32];
  3633. get_user_name(id, admin_name, charsmax(admin_name));
  3634.  
  3635. JCM_Print(id, "^3You revived^4 %s!", target_name);
  3636.  
  3637. for ( new i = 1; i <= g_max_players; i++ )
  3638. {
  3639. if ( !g_connected[i]
  3640. || i == id
  3641. || i == target ) continue;
  3642.  
  3643. JCM_Print(i, "^4%s^3 revived^4 %s!", admin_name, target_name);
  3644. }
  3645.  
  3646. JCM_Print(target, "^3You have been revived by^4 %s!", admin_name);
  3647.  
  3648. return PLUGIN_HANDLED;
  3649. }
  3650.  
  3651. CmdReviveEveryone(id)
  3652. {
  3653. if ( !g_admin[id] )
  3654. {
  3655. console_print(id, "You have no access to that command");
  3656. return PLUGIN_HANDLED;
  3657. }
  3658.  
  3659. for ( new i = 1; i <= g_max_players; i++ )
  3660. {
  3661. if ( !g_connected[i]
  3662. || g_admin[i]
  3663. || g_gived_access[i]
  3664. || g_alive[i] ) continue;
  3665.  
  3666. ExecuteHam(Ham_CS_RoundRespawn, i);
  3667. }
  3668.  
  3669. static admin_name[32];
  3670. get_user_name(id, admin_name, charsmax(admin_name));
  3671.  
  3672. JCM_Print(0, "^4%s^3 revived everyone!", admin_name);
  3673.  
  3674. return PLUGIN_HANDLED;
  3675. }
  3676.  
  3677. ToggleAllGodmode(id)
  3678. {
  3679. if ( !g_admin[id] )
  3680. {
  3681. console_print(id, "You have no access to that command");
  3682. return PLUGIN_HANDLED;
  3683. }
  3684.  
  3685. for ( new i = 1; i <= g_max_players; i++ )
  3686. {
  3687. if ( !g_connected[i] ) continue;
  3688.  
  3689. if ( g_alive[i]
  3690. && !g_admin[i]
  3691. && !g_gived_access[i] )
  3692. {
  3693. entity_set_float(i, EV_FL_takedamage, g_all_godmode ? DAMAGE_AIM : DAMAGE_NO);
  3694. }
  3695.  
  3696. if ( g_viewing_commands_menu[i] ) ShowCommandsMenu(i);
  3697. }
  3698.  
  3699. g_all_godmode = !g_all_godmode;
  3700.  
  3701. static admin_name[32];
  3702. get_user_name(id, admin_name, charsmax(admin_name));
  3703.  
  3704. if ( g_all_godmode ) JCM_Print(0, "^4%s^3 set godmode on everyone!", admin_name);
  3705. else JCM_Print(0, "^4%s^3 removed godmode from everyone!", admin_name);
  3706.  
  3707. return PLUGIN_HANDLED;
  3708. }
  3709.  
  3710. CmdGiveAccess(id)
  3711. {
  3712. if ( !g_admin[id] )
  3713. {
  3714. console_print(id, "You have no access to that command");
  3715. return PLUGIN_HANDLED;
  3716. }
  3717.  
  3718. client_cmd(id, "messagemode JCM_GiveAccess");
  3719. JCM_Print(id, "^3Type the name of the client that you want to give access to^4 %s.", PLUGIN_PREFIX);
  3720.  
  3721. return PLUGIN_HANDLED;
  3722. }
  3723.  
  3724. public GiveAccess(id)
  3725. {
  3726. if ( !g_admin[id] )
  3727. {
  3728. console_print(id, "You have no access to that command");
  3729. return PLUGIN_HANDLED;
  3730. }
  3731.  
  3732. static arg[32], target;
  3733. read_argv(1, arg, charsmax(arg));
  3734.  
  3735. target = cmd_target(id, arg, CMDTARGET_NO_BOTS);
  3736. if ( !target ) return PLUGIN_HANDLED;
  3737.  
  3738. static target_name[32];
  3739. get_user_name(target, target_name, charsmax(target_name));
  3740.  
  3741. if ( g_admin[target] || g_gived_access[target] )
  3742. {
  3743. JCM_Print(id, "^4%s^3 already have access to^4 %s!", target_name, PLUGIN_PREFIX);
  3744. return PLUGIN_HANDLED;
  3745. }
  3746.  
  3747. g_gived_access[target] = true;
  3748.  
  3749. JCM_Print(id, "^3You gived^4 %s^3 access to^4 %s!", target_name, PLUGIN_PREFIX);
  3750.  
  3751. static admin_name[32];
  3752. get_user_name(id, admin_name, charsmax(admin_name));
  3753.  
  3754. JCM_Print(target, "^4%s^3 has gived you access to ^4JumpGround CourseMaker^3! Type^1 ^4/JCM^3 to bring up the Main Menu.", admin_name);
  3755.  
  3756. for ( new i = 1; i <= g_max_players; i++ )
  3757. {
  3758. if ( i == id
  3759. || i == target
  3760. || !g_connected[i] ) continue;
  3761.  
  3762. JCM_Print(i, "^4%s^3 gived^4 %s^3 access to JumpGround CourceMaker!", admin_name, target_name);
  3763. }
  3764.  
  3765. return PLUGIN_HANDLED;
  3766. }
  3767.  
  3768. public CmdShowInfo(id)
  3769. {
  3770. static text[1120], len, textures[32], title[64];
  3771.  
  3772. get_pcvar_string(g_cvar_textures, textures, charsmax(textures));
  3773.  
  3774. len += format(text[len], charsmax(text) - len, "<html>");
  3775.  
  3776. len += format(text[len], charsmax(text) - len, "<style type = ^"text/css^">");
  3777.  
  3778. len += format(text[len], charsmax(text) - len, "body");
  3779. len += format(text[len], charsmax(text) - len, "{");
  3780. len += format(text[len], charsmax(text) - len, "background-color:#000000;");
  3781. len += format(text[len], charsmax(text) - len, "font-family:Comic Sans MS;");
  3782. len += format(text[len], charsmax(text) - len, "font-weight:bold;");
  3783. len += format(text[len], charsmax(text) - len, "}");
  3784.  
  3785. len += format(text[len], charsmax(text) - len, "h1");
  3786. len += format(text[len], charsmax(text) - len, "{");
  3787. len += format(text[len], charsmax(text) - len, "color:#00FF00;");
  3788. len += format(text[len], charsmax(text) - len, "font-size:large;");
  3789. len += format(text[len], charsmax(text) - len, "}");
  3790.  
  3791. len += format(text[len], charsmax(text) - len, "h2");
  3792. len += format(text[len], charsmax(text) - len, "{");
  3793. len += format(text[len], charsmax(text) - len, "color:#00FF00;");
  3794. len += format(text[len], charsmax(text) - len, "font-size:medium;");
  3795. len += format(text[len], charsmax(text) - len, "}");
  3796.  
  3797. len += format(text[len], charsmax(text) - len, "h3");
  3798. len += format(text[len], charsmax(text) - len, "{");
  3799. len += format(text[len], charsmax(text) - len, "color:#0096FF;");
  3800. len += format(text[len], charsmax(text) - len, "font-size:medium;");
  3801. len += format(text[len], charsmax(text) - len, "}");
  3802.  
  3803. len += format(text[len], charsmax(text) - len, "h4");
  3804. len += format(text[len], charsmax(text) - len, "{");
  3805. len += format(text[len], charsmax(text) - len, "color:#FFFFFF;");
  3806. len += format(text[len], charsmax(text) - len, "font-size:medium;");
  3807. len += format(text[len], charsmax(text) - len, "}");
  3808.  
  3809. len += format(text[len], charsmax(text) - len, "h5");
  3810. len += format(text[len], charsmax(text) - len, "{");
  3811. len += format(text[len], charsmax(text) - len, "color:#FFFFFF;");
  3812. len += format(text[len], charsmax(text) - len, "font-size:x-small;");
  3813. len += format(text[len], charsmax(text) - len, "}");
  3814.  
  3815. len += format(text[len], charsmax(text) - len, "</style>");
  3816.  
  3817. len += format(text[len], charsmax(text) - len, "<body>");
  3818. len += format(text[len], charsmax(text) - len, "<div align = ^"center^">");
  3819.  
  3820. len += format(text[len], charsmax(text) - len, "<h1>");
  3821. len += format(text[len], charsmax(text) - len, "%s v%s", PLUGIN_NAME, PLUGIN_VERSION);
  3822. len += format(text[len], charsmax(text) - len, "</h1>");
  3823.  
  3824. len += format(text[len], charsmax(text) - len, "<h4>");
  3825. len += format(text[len], charsmax(text) - len, "by anderseN and Dinnk");
  3826. len += format(text[len], charsmax(text) - len, "</h4>");
  3827.  
  3828. len += format(text[len], charsmax(text) - len, "<h1>");
  3829. len += format(text[len], charsmax(text) - len, "Texture Design");
  3830. len += format(text[len], charsmax(text) - len, "</h1>");
  3831.  
  3832. len += format(text[len], charsmax(text) - len, "<h4>");
  3833. len += format(text[len], charsmax(text) - len, "by %s", textures);
  3834. len += format(text[len], charsmax(text) - len, "</h4>");
  3835.  
  3836. len += format(text[len], charsmax(text) - len, "<h2>");
  3837. len += format(text[len], charsmax(text) - len, "Features:");
  3838. len += format(text[len], charsmax(text) - len, "</h2>");
  3839.  
  3840. len += format(text[len], charsmax(text) - len, "<h5>");
  3841. len += format(text[len], charsmax(text) - len, "<I>Box Menu</I> <br />");
  3842. len += format(text[len], charsmax(text) - len, "<I>New Menu Style</I> <br />");
  3843. len += format(text[len], charsmax(text) - len, "<I>New HUD Style</I> <br />");
  3844. len += format(text[len], charsmax(text) - len, "<I>Superman Block</I> <br />");
  3845. len += format(text[len], charsmax(text) - len, "<I>Nade Selection</I> <br />");
  3846. len += format(text[len], charsmax(text) - len, "</h5>");
  3847.  
  3848. len += format(text[len], charsmax(text) - len, "<h4>");
  3849. len += format(text[len], charsmax(text) - len, "<I>You can contact JumpGround admins on Email: <h3>JumpGround@hotmail.com</h4></I> <br />");
  3850. len += format(text[len], charsmax(text) - len, "</h4>");
  3851.  
  3852. len += format(text[len], charsmax(text) - len, "</div>");
  3853. len += format(text[len], charsmax(text) - len, "</body>");
  3854.  
  3855. len += format(text[len], charsmax(text) - len, "</html>");
  3856.  
  3857. format(title, charsmax(title) - 1, "%s v%s", PLUGIN_NAME, PLUGIN_VERSION);
  3858. show_motd(id, text, title);
  3859.  
  3860. return PLUGIN_HANDLED;
  3861. }
  3862.  
  3863. MoveGrabbedEntity(id, Float:move_to[3] = { 0.0, 0.0, 0.0 })
  3864. {
  3865. static aiming[3];
  3866. static look[3];
  3867. static Float:float_aiming[3];
  3868. static Float:float_look[3];
  3869. static Float:direction[3];
  3870. static Float:length;
  3871.  
  3872. get_user_origin(id, aiming, 1);
  3873. get_user_origin(id, look, 3);
  3874. IVecFVec(aiming, float_aiming);
  3875. IVecFVec(look, float_look);
  3876.  
  3877. direction[0] = float_look[0] - float_aiming[0];
  3878. direction[1] = float_look[1] - float_aiming[1];
  3879. direction[2] = float_look[2] - float_aiming[2];
  3880. length = get_distance_f(float_look, float_aiming);
  3881.  
  3882. if ( length == 0.0 ) length = 1.0;
  3883.  
  3884. move_to[0] = ( float_aiming[0] + direction[0] * g_grab_length[id] / length ) + g_grab_offset[id][0];
  3885. move_to[1] = ( float_aiming[1] + direction[1] * g_grab_length[id] / length ) + g_grab_offset[id][1];
  3886. move_to[2] = ( float_aiming[2] + direction[2] * g_grab_length[id] / length ) + g_grab_offset[id][2];
  3887. move_to[2] = float(floatround(move_to[2], floatround_floor));
  3888.  
  3889. MoveEntity(id, g_grabbed[id], move_to, true);
  3890. }
  3891.  
  3892. MoveEntity(id, ent, Float:move_to[3], bool:do_snapping)
  3893. {
  3894. if ( do_snapping ) DoSnapping(id, ent, move_to);
  3895.  
  3896. entity_set_origin(ent, move_to);
  3897. }
  3898.  
  3899. CreateBlockAiming(const id, const block_type)
  3900. {
  3901. if ( !g_admin[id] && !g_gived_access[id] )
  3902. {
  3903. console_print(id, "You have no access to that command");
  3904. return PLUGIN_HANDLED;
  3905. }
  3906.  
  3907. static origin[3];
  3908. static Float:float_origin[3];
  3909.  
  3910. get_user_origin(id, origin, 3);
  3911. IVecFVec(origin, float_origin);
  3912. float_origin[2] += 4.0;
  3913.  
  3914. CreateBlock(id, block_type, float_origin, Z, g_selected_block_size[id], g_property1_default_value[block_type], g_property2_default_value[block_type], g_property3_default_value[block_type], g_property4_default_value[block_type]);
  3915.  
  3916. return PLUGIN_HANDLED;
  3917. }
  3918.  
  3919. CreateBlock(const id, const block_type, Float:origin[3], const axis, const size, const property1[], const property2[], const property3[], const property4[])
  3920. {
  3921. new ent = create_entity("info_target");
  3922. if ( !is_valid_ent(ent) ) return 0;
  3923.  
  3924. entity_set_string(ent, EV_SZ_classname, g_block_classname);
  3925. entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
  3926. entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);
  3927.  
  3928. new block_model[256];
  3929. new Float:size_min[3];
  3930. new Float:size_max[3];
  3931. new Float:angles[3];
  3932. new Float:scale;
  3933.  
  3934. switch ( axis )
  3935. {
  3936. case X:
  3937. {
  3938. size_min[0] = -4.0;
  3939. size_min[1] = -32.0;
  3940. size_min[2] = -32.0;
  3941.  
  3942. size_max[0] = 4.0;
  3943. size_max[1] = 32.0;
  3944. size_max[2] = 32.0;
  3945.  
  3946. if(size == POLE)
  3947. {
  3948. size_min[0] = -32.0;
  3949. size_min[1] = -4.0;
  3950. size_min[2] = -4.0;
  3951.  
  3952. size_max[0] = 32.0;
  3953. size_max[1] = 4.0;
  3954. size_max[2] = 4.0;
  3955. }
  3956.  
  3957.  
  3958. angles[0] = 90.0;
  3959. }
  3960. case Y:
  3961. {
  3962. size_min[0] = -32.0;
  3963. size_min[1] = -4.0;
  3964. size_min[2] = -32.0;
  3965.  
  3966. size_max[0] = 32.0;
  3967. size_max[1] = 4.0;
  3968. size_max[2] = 32.0;
  3969.  
  3970. if(size == POLE)
  3971. {
  3972. size_min[0] = -4.0;
  3973. size_min[1] = -32.0;
  3974. size_min[2] = -4.0;
  3975.  
  3976. size_max[0] = 4.0;
  3977. size_max[1] = 32.0;
  3978. size_max[2] = 4.0;
  3979. }
  3980.  
  3981. angles[0] = 90.0;
  3982. angles[2] = 90.0;
  3983. }
  3984. case Z:
  3985. {
  3986. size_min[0] = -32.0;
  3987. size_min[1] = -32.0;
  3988. size_min[2] = -4.0;
  3989.  
  3990. size_max[0] = 32.0;
  3991. size_max[1] = 32.0;
  3992. size_max[2] = 4.0;
  3993.  
  3994. if(size == POLE)
  3995. {
  3996. size_min[0] = -4.0;
  3997. size_min[1] = -4.0;
  3998. size_min[2] = -32.0;
  3999.  
  4000. size_max[0] = 4.0;
  4001. size_max[1] = 4.0;
  4002. size_max[2] = 32.0;
  4003. }
  4004.  
  4005. angles[0] = 0.0;
  4006. angles[1] = 0.0;
  4007. angles[2] = 0.0;
  4008. }
  4009. }
  4010.  
  4011. switch ( size )
  4012. {
  4013. case TINY:
  4014. {
  4015. SetBlockModelName(block_model, g_block_models[block_type], "Tiny");
  4016. scale = 0.25;
  4017. }
  4018. case NORMAL:
  4019. {
  4020. block_model = g_block_models[block_type];
  4021. scale = 1.0;
  4022. }
  4023. case LARGE:
  4024. {
  4025. SetBlockModelName(block_model, g_block_models[block_type], "Large");
  4026. scale = 2.0;
  4027. }
  4028. case POLE:
  4029. {
  4030. SetBlockModelName(block_model, g_block_models[block_type], "Pole");
  4031. scale = 1.0;
  4032. }
  4033. }
  4034.  
  4035. for ( new i = 0; i < 3; ++i )
  4036. {
  4037. if ( size_min[i] != 4.0 && size_min[i] != -4.0 )
  4038. {
  4039. size_min[i] *= scale;
  4040. }
  4041.  
  4042. if ( size_max[i] != 4.0 && size_max[i] != -4.0 )
  4043. {
  4044. size_max[i] *= scale;
  4045. }
  4046. }
  4047.  
  4048. entity_set_model(ent, block_model);
  4049.  
  4050. SetBlockRendering(ent, g_render[block_type], g_red[block_type], g_green[block_type], g_blue[block_type], g_alpha[block_type]);
  4051.  
  4052. entity_set_vector(ent, EV_VEC_angles, angles);
  4053. entity_set_size(ent, size_min, size_max);
  4054. entity_set_int(ent, EV_INT_body, block_type);
  4055.  
  4056. if( block_type == MAGIC )
  4057. {
  4058. set_pev(ent, pev_movetype, MOVETYPE_FLY);
  4059. set_pev(ent, pev_v_angle, origin);
  4060. }
  4061.  
  4062. if ( 1 <= id <= g_max_players )
  4063. {
  4064. DoSnapping(id, ent, origin);
  4065. }
  4066.  
  4067. entity_set_origin(ent, origin);
  4068.  
  4069. SetProperty(ent, 1, property1);
  4070. SetProperty(ent, 2, property2);
  4071. SetProperty(ent, 3, property3);
  4072. SetProperty(ent, 4, property4);
  4073.  
  4074. return ent;
  4075. }
  4076.  
  4077. ConvertBlockAiming(id, const convert_to)
  4078. {
  4079. if ( !g_admin[id] && !g_gived_access[id] )
  4080. {
  4081. console_print(id, "You have no access to that command");
  4082. return PLUGIN_HANDLED;
  4083. }
  4084.  
  4085. static ent, body;
  4086. get_user_aiming(id, ent, body);
  4087.  
  4088. if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
  4089.  
  4090. new grabber = entity_get_int(ent, EV_INT_iuser2);
  4091. if ( grabber && grabber != id ) return PLUGIN_HANDLED;
  4092.  
  4093. new player = entity_get_int(ent, EV_INT_iuser1);
  4094. if ( player && player != id )
  4095. {
  4096. new player_name[32];
  4097. get_user_name(player, player_name, charsmax(player_name));
  4098.  
  4099. JCM_Print(id, "^4%s^3 currently has this block in their group!", player_name);
  4100. return PLUGIN_HANDLED;
  4101. }
  4102.  
  4103. static new_block;
  4104. if ( IsBlockInGroup(id, ent) && g_group_count[id] > 1 )
  4105. {
  4106. static i, block, block_count;
  4107.  
  4108. block_count = 0;
  4109. for ( i = 0; i <= g_group_count[id]; ++i )
  4110. {
  4111. block = g_grouped_blocks[id][i];
  4112. if ( !IsBlockInGroup(id, block) ) continue;
  4113.  
  4114. new_block = ConvertBlock(id, block, convert_to, true);
  4115. if ( new_block != 0 )
  4116. {
  4117. g_grouped_blocks[id][i] = new_block;
  4118.  
  4119. GroupBlock(id, new_block);
  4120. }
  4121. else
  4122. {
  4123. ++block_count;
  4124. }
  4125. }
  4126.  
  4127. if ( block_count > 1 )
  4128. {
  4129. JCM_Print(id, "^3Couldn't convert^4 %d^3 blocks!", block_count);
  4130. }
  4131. }
  4132. else
  4133. {
  4134. new_block = ConvertBlock(id, ent, convert_to, false);
  4135. if ( IsBlockStuck(new_block) )
  4136. {
  4137. new bool:deleted = DeleteBlock(new_block);
  4138. if ( deleted ) JCM_Print(id, "^3Block deleted because it was stuck!");
  4139. }
  4140. }
  4141.  
  4142. return PLUGIN_HANDLED;
  4143. }
  4144.  
  4145. ConvertBlock(id, ent, const convert_to, const bool:preserve_size)
  4146. {
  4147. new axis;
  4148. new block_type;
  4149. new property1[20], property2[20], property3[20], property4[20];
  4150. new Float:origin[3];
  4151. new Float:size_max[3];
  4152.  
  4153. block_type = entity_get_int(ent, EV_INT_body);
  4154.  
  4155. entity_get_vector(ent, EV_VEC_origin, origin);
  4156. entity_get_vector(ent, EV_VEC_maxs, size_max);
  4157.  
  4158. for ( new i = 0; i < 3; ++i )
  4159. {
  4160. if ( size_max[i] == 4.0 )
  4161. {
  4162. axis = i;
  4163. break;
  4164. }
  4165. }
  4166.  
  4167. GetProperty(ent, 2, property2);
  4168. GetProperty(ent, 3, property3);
  4169. GetProperty(ent, 4, property4);
  4170.  
  4171. if ( block_type != convert_to )
  4172. {
  4173. copy(property1, charsmax(property1), g_property1_default_value[convert_to]);
  4174. copy(property2, charsmax(property1), g_property2_default_value[convert_to]);
  4175. copy(property3, charsmax(property1), g_property3_default_value[convert_to]);
  4176. copy(property4, charsmax(property1), g_property4_default_value[convert_to]);
  4177. }
  4178.  
  4179. DeleteBlock(ent);
  4180.  
  4181. if ( preserve_size )
  4182. {
  4183. static size, Float:max_size;
  4184.  
  4185. max_size = size_max[0] + size_max[1] + size_max[2];
  4186.  
  4187. if ( max_size > 128.0 ) size = LARGE;
  4188. else if ( max_size > 64.0 ) size = NORMAL;
  4189. else if ( max_size > 32.0 ) size = POLE;
  4190. else size = TINY;
  4191.  
  4192. return CreateBlock(id, convert_to, origin, axis, size, property1, property2, property3, property4);
  4193. }
  4194. else
  4195. {
  4196. return CreateBlock(id, convert_to, origin, axis, g_selected_block_size[id], property1, property2, property3, property4);
  4197. }
  4198.  
  4199. return ent;
  4200. }
  4201.  
  4202. DeleteBlockAiming(id)
  4203. {
  4204. if ( !g_admin[id] && !g_gived_access[id] )
  4205. {
  4206. console_print(id, "You have no access to that command");
  4207. return PLUGIN_HANDLED;
  4208. }
  4209.  
  4210. static ent, body;
  4211. get_user_aiming(id, ent, body);
  4212.  
  4213. if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
  4214.  
  4215. new grabber = entity_get_int(ent, EV_INT_iuser2);
  4216. if ( grabber && grabber != id ) return PLUGIN_HANDLED;
  4217.  
  4218. new player = entity_get_int(ent, EV_INT_iuser1);
  4219. if ( player && player != id )
  4220. {
  4221. new player_name[32];
  4222. get_user_name(player, player_name, charsmax(player_name));
  4223.  
  4224. JCM_Print(id, "^4%s^3 currently has this block in their group!", player_name);
  4225. return PLUGIN_HANDLED;
  4226. }
  4227.  
  4228. if ( IsBlockInGroup(id, ent) && g_group_count[id] > 1 )
  4229. {
  4230. static i, block;
  4231. for ( i = 0; i <= g_group_count[id]; ++i )
  4232. {
  4233. block = g_grouped_blocks[id][i];
  4234. if ( !is_valid_ent(block) ) continue;
  4235.  
  4236. DeleteBlock(block);
  4237. }
  4238.  
  4239. return PLUGIN_HANDLED;
  4240. }
  4241.  
  4242. DeleteBlock(ent);
  4243.  
  4244. return PLUGIN_HANDLED;
  4245. }
  4246.  
  4247. bool:DeleteBlock(ent)
  4248. {
  4249. if ( !IsBlock(ent) ) return false;
  4250.  
  4251. remove_entity(ent);
  4252. return true;
  4253. }
  4254.  
  4255. RotateBlockAiming(id)
  4256. {
  4257. if ( !g_admin[id] && !g_gived_access[id] )
  4258. {
  4259. console_print(id, "You have no access to that command");
  4260. return PLUGIN_HANDLED;
  4261. }
  4262.  
  4263. static ent, body;
  4264. get_user_aiming(id, ent, body);
  4265.  
  4266. if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
  4267.  
  4268. new grabber = entity_get_int(ent, EV_INT_iuser2);
  4269. if ( grabber && grabber != id ) return PLUGIN_HANDLED;
  4270.  
  4271. new player = entity_get_int(ent, EV_INT_iuser1);
  4272. if ( player && player != id )
  4273. {
  4274. static player_name[32];
  4275. get_user_name(player, player_name, charsmax(player_name));
  4276.  
  4277. JCM_Print(id, "^4%s^3 currently has this block in their group!", player_name);
  4278. return PLUGIN_HANDLED;
  4279. }
  4280.  
  4281. if ( IsBlockInGroup(id, ent) && g_group_count[id] > 1 )
  4282. {
  4283. static block;
  4284. for ( new i = 0; i <= g_group_count[id]; ++i )
  4285. {
  4286. block = g_grouped_blocks[id][i];
  4287. if ( IsBlockInGroup(id, block) ) RotateBlock(block);
  4288. }
  4289. }
  4290. else
  4291. {
  4292. RotateBlock(ent);
  4293. }
  4294.  
  4295. return PLUGIN_HANDLED;
  4296. }
  4297.  
  4298. RotateBlock(ent)
  4299. {
  4300. if ( !is_valid_ent(ent) ) return false;
  4301.  
  4302. static Float:angles[3];
  4303. static Float:size_min[3];
  4304. static Float:size_max[3];
  4305. static Float:temp;
  4306.  
  4307. entity_get_vector(ent, EV_VEC_angles, angles);
  4308. entity_get_vector(ent, EV_VEC_mins, size_min);
  4309. entity_get_vector(ent, EV_VEC_maxs, size_max);
  4310.  
  4311. if ( angles[0] == 0.0 && angles[2] == 0.0 )
  4312. {
  4313. angles[0] = 90.0;
  4314. }
  4315. else if ( angles[0] == 90.0 && angles[2] == 0.0 )
  4316. {
  4317. angles[0] = 90.0;
  4318. angles[2] = 90.0;
  4319. }
  4320. else
  4321. {
  4322. angles[0] = 0.0;
  4323. angles[1] = 0.0;
  4324. angles[2] = 0.0;
  4325. }
  4326.  
  4327. temp = size_min[0];
  4328. size_min[0] = size_min[2];
  4329. size_min[2] = size_min[1];
  4330. size_min[1] = temp;
  4331.  
  4332. temp = size_max[0];
  4333. size_max[0] = size_max[2];
  4334. size_max[2] = size_max[1];
  4335. size_max[1] = temp;
  4336.  
  4337. entity_set_vector(ent, EV_VEC_angles, angles);
  4338. entity_set_size(ent, size_min, size_max);
  4339.  
  4340. return true;
  4341. }
  4342.  
  4343. ChangeBlockSize(id)
  4344. {
  4345. switch ( g_selected_block_size[id] )
  4346. {
  4347. case TINY: g_selected_block_size[id] = NORMAL;
  4348. case NORMAL: g_selected_block_size[id] = LARGE;
  4349. case LARGE: g_selected_block_size[id] = POLE;
  4350. case POLE: g_selected_block_size[id] = TINY;
  4351. }
  4352. }
  4353.  
  4354. SetPropertiesBlockAiming(id)
  4355. {
  4356. if ( !g_admin[id] && !g_gived_access[id] )
  4357. {
  4358. console_print(id, "You have no access to that command");
  4359. ShowBlockMenu(id);
  4360. return PLUGIN_HANDLED;
  4361. }
  4362.  
  4363. static ent, body;
  4364. get_user_aiming(id, ent, body);
  4365.  
  4366. if ( !IsBlock(ent) )
  4367. {
  4368. ShowBlockMenu(id);
  4369. return PLUGIN_HANDLED;
  4370. }
  4371.  
  4372. new block_type = entity_get_int(ent, EV_INT_body);
  4373.  
  4374. if ( !g_property1_name[block_type][0]
  4375. && !g_property2_name[block_type][0]
  4376. && !g_property3_name[block_type][0]
  4377. && !g_property4_name[block_type][0] )
  4378. {
  4379. ShowBlockMenu(id);
  4380. return PLUGIN_HANDLED;
  4381. }
  4382.  
  4383. g_viewing_properties_menu[id] = true;
  4384. ShowPropertiesMenu(id, ent);
  4385.  
  4386. return PLUGIN_HANDLED;
  4387. }
  4388.  
  4389. public SetPropertyBlock(id)
  4390. {
  4391. static arg[20];
  4392. new ent = g_property_info[id][1];
  4393. read_argv(1, arg, charsmax(arg));
  4394.  
  4395. if ( !strlen(arg) )
  4396. {
  4397. JCM_Print(id, "^3You can't set a property blank! Please type a new value.");
  4398. client_cmd(id, "messagemode JCM_SetProperty");
  4399. return PLUGIN_HANDLED;
  4400. }
  4401.  
  4402. if ( !is_valid_ent(ent) )
  4403. {
  4404. JCM_Print(id, "^3That block has been deleted!");
  4405. g_viewing_properties_menu[id] = false;
  4406. ShowBlockMenu(id);
  4407. return PLUGIN_HANDLED;
  4408. }
  4409.  
  4410. static block_type;
  4411. static property;
  4412. static Float:property_value;
  4413.  
  4414. block_type = entity_get_int(ent, EV_INT_body);
  4415. property = g_property_info[id][0];
  4416. property_value = str_to_float(arg);
  4417.  
  4418. if ( property == 3
  4419. && block_type != BOOTS_OF_SPEED )
  4420. {
  4421. if ( !( 50 <= property_value <= 200
  4422. || property_value == 255
  4423. || property_value == 0 ) )
  4424. {
  4425. JCM_Print(id, "^3The property has to be between^4 50^3 and^4 200^3,^4 255^3 or^4 0!");
  4426. return PLUGIN_HANDLED;
  4427. }
  4428. }
  4429. else
  4430. {
  4431. switch ( block_type )
  4432. {
  4433. case DAMAGE, HEALER:
  4434. {
  4435. if ( property == 1
  4436. && !( 1 <= property_value <= 100 ) )
  4437. {
  4438. JCM_Print(id, "^3The property has to be between^4 1^3 and^4 100!");
  4439. return PLUGIN_HANDLED;
  4440. }
  4441. else if ( !( 0.1 <= property_value <= 240 ) )
  4442. {
  4443. JCM_Print(id, "^3The property has to be between^4 0.1^3 and^4 240!");
  4444. return PLUGIN_HANDLED;
  4445. }
  4446. }
  4447. case TRAMPOLINE:
  4448. {
  4449. if ( !( 200 <= property_value <= 2000 ) )
  4450. {
  4451. JCM_Print(id, "^3The property has to be between^4 200^3 and^4 2000!");
  4452. return PLUGIN_HANDLED;
  4453. }
  4454. }
  4455. case SPEED_BOOST:
  4456. {
  4457. if ( property == 1
  4458. && !( 200 <= property_value <= 2000 ) )
  4459. {
  4460. JCM_Print(id, "^3The property has to be between^4 200^3 and^4 2000!");
  4461. return PLUGIN_HANDLED;
  4462. }
  4463. else if ( !( 0 <= property_value <= 2000 ) )
  4464. {
  4465. JCM_Print(id, "^3The property has to be between^4 0^3 and^4 2000!");
  4466. return PLUGIN_HANDLED;
  4467. }
  4468. }
  4469. case LOW_GRAVITY:
  4470. {
  4471. if ( !( 50 <= property_value <= 750 ) )
  4472. {
  4473. JCM_Print(id, "^3The property has to be between^4 50^3 and^4 750!");
  4474. return PLUGIN_HANDLED;
  4475. }
  4476. }
  4477. case HONEY:
  4478. {
  4479. if ( !( 75 <= property_value <= 200
  4480. || property_value == 0 ) )
  4481. {
  4482. JCM_Print(id, "^3The property has to be between^4 75^3 and^4 200^3, or^4 0!");
  4483. return PLUGIN_HANDLED;
  4484. }
  4485. }
  4486. case DELAYED_BUNNYHOP:
  4487. {
  4488. if ( !( 0.5 <= property_value <= 5 ) )
  4489. {
  4490. JCM_Print(id, "^3The property has to be between^4 0.5^3 and^4 5!");
  4491. return PLUGIN_HANDLED;
  4492. }
  4493. }
  4494. case INVINCIBILITY, STEALTH, BOOTS_OF_SPEED:
  4495. {
  4496. if ( property == 1
  4497. && !( 0.5 <= property_value <= 240 ) )
  4498. {
  4499. JCM_Print(id, "^3The property has to be between^4 0.5^3 and^4 240!");
  4500. return PLUGIN_HANDLED;
  4501. }
  4502. else if ( property == 2
  4503. && !( 0 <= property_value <= 240 ) )
  4504. {
  4505. JCM_Print(id, "^3The property has to be between^4 0^3 and^4 240!");
  4506. return PLUGIN_HANDLED;
  4507. }
  4508. else if ( property == 3
  4509. && block_type == BOOTS_OF_SPEED
  4510. && !( 260 <= property_value <= 400 ) )
  4511. {
  4512. JCM_Print(id, "^3The property has to be between^4 260^3 and^4 400!");
  4513. return PLUGIN_HANDLED;
  4514. }
  4515. }
  4516. }
  4517. }
  4518.  
  4519. SetProperty(ent, property, arg);
  4520.  
  4521. for ( new i = 1; i <= g_max_players; i++ )
  4522. {
  4523. if ( !g_connected[i]
  4524. || !g_viewing_properties_menu[i] ) continue;
  4525.  
  4526. ent = g_property_info[i][1];
  4527. ShowPropertiesMenu(i, ent);
  4528. }
  4529.  
  4530. return PLUGIN_HANDLED;
  4531. }
  4532.  
  4533. ToggleProperty(id, property)
  4534. {
  4535. new ent = g_property_info[id][1];
  4536. if ( !is_valid_ent(ent) )
  4537. {
  4538. JCM_Print(id, "That block has been deleted!");
  4539. g_viewing_properties_menu[id] = false;
  4540. ShowBlockMenu(id);
  4541. return PLUGIN_HANDLED;
  4542. }
  4543.  
  4544. static property_value[20];
  4545. GetProperty(ent, property, property_value);
  4546.  
  4547. new block_type = entity_get_int(ent, EV_INT_body);
  4548.  
  4549. if ( (block_type == SLAP || block_type == MAGIC) && property == 1 )
  4550. {
  4551. if ( property_value[0] == '1' ) copy(property_value, charsmax(property_value), "2");
  4552. else if ( property_value[0] == '2' ) copy(property_value, charsmax(property_value), "3");
  4553. else copy(property_value, charsmax(property_value), "1");
  4554. }
  4555. else
  4556. {
  4557. if ( property_value[0] == '0' ) copy(property_value, charsmax(property_value), "1");
  4558. else copy(property_value, charsmax(property_value), "0");
  4559. }
  4560.  
  4561. SetProperty(ent, property, property_value);
  4562.  
  4563. for ( new i = 1; i <= g_max_players; i++ )
  4564. {
  4565. if ( g_connected[i] && g_viewing_properties_menu[i] )
  4566. {
  4567. ent = g_property_info[i][1];
  4568. ShowPropertiesMenu(i, ent);
  4569. }
  4570. }
  4571.  
  4572. return PLUGIN_HANDLED;
  4573. }
  4574.  
  4575. GetProperty(ent, property, property_value[])
  4576. {
  4577. switch( property )
  4578. {
  4579. case 1: pev(ent, pev_message, property_value, 5);
  4580. case 2: pev(ent, pev_netname, property_value, 5);
  4581. case 3: pev(ent, pev_viewmodel2, property_value, 5);
  4582. case 4: pev(ent, pev_weaponmodel2, property_value, 5);
  4583. }
  4584.  
  4585. return (strlen(property_value) ? 1 : 0);
  4586. }
  4587.  
  4588. SetProperty(ent, property, const property_value[])
  4589. {
  4590. switch ( property )
  4591. {
  4592. case 1: set_pev(ent, pev_message, property_value, 5);
  4593. case 2: set_pev(ent, pev_netname, property_value, 5);
  4594. case 3:
  4595. {
  4596. set_pev(ent, pev_viewmodel2, property_value, 5);
  4597.  
  4598. new block_type = entity_get_int(ent, EV_INT_body);
  4599. if ( g_property3_name[block_type][0] && block_type != BOOTS_OF_SPEED )
  4600. {
  4601. new transparency = str_to_num(property_value);
  4602. if ( !transparency
  4603. || transparency == 255 )
  4604. {
  4605. SetBlockRendering(ent, g_render[block_type], g_red[block_type], g_green[block_type], g_blue[block_type], g_alpha[block_type]);
  4606. }
  4607. else
  4608. {
  4609. SetBlockRendering(ent, TRANSALPHA, 255, 255, 255, transparency);
  4610. }
  4611. }
  4612. }
  4613. case 4: set_pev(ent, pev_weaponmodel2, property_value, 5);
  4614. }
  4615.  
  4616. return 1;
  4617. }
  4618.  
  4619. CopyBlock(ent)
  4620. {
  4621. if ( !is_valid_ent(ent) ) return 0;
  4622.  
  4623. new size;
  4624. new axis;
  4625. new property1[20], property2[20], property3[20], property4[20];
  4626. new Float:origin[3];
  4627. new Float:angles[3];
  4628. new Float:size_min[3];
  4629. new Float:size_max[3];
  4630. new Float:max_size;
  4631.  
  4632. entity_get_vector(ent, EV_VEC_origin, origin);
  4633. entity_get_vector(ent, EV_VEC_angles, angles);
  4634. entity_get_vector(ent, EV_VEC_mins, size_min);
  4635. entity_get_vector(ent, EV_VEC_maxs, size_max);
  4636.  
  4637. max_size = size_max[0] + size_max[1] + size_max[2];
  4638.  
  4639. if ( max_size > 128.0 ) size = LARGE;
  4640. else if ( max_size > 64.0 ) size = NORMAL;
  4641. else if ( max_size > 32.0 ) size = POLE;
  4642. else size = TINY;
  4643.  
  4644. for ( new i = 0; i < 3; ++i )
  4645. {
  4646. if ( size_max[i] == 4.0 )
  4647. {
  4648. axis = i;
  4649. break;
  4650. }
  4651. }
  4652.  
  4653. GetProperty(ent, 2, property2);
  4654. GetProperty(ent, 3, property3);
  4655. GetProperty(ent, 4, property4);
  4656.  
  4657. return CreateBlock(0, entity_get_int(ent, EV_INT_body), origin, axis, size, property1, property2, property3, property4);
  4658. }
  4659.  
  4660. GroupBlockAiming(id)
  4661. {
  4662. if ( !g_admin[id] && !g_gived_access[id] )
  4663. {
  4664. console_print(id, "You have no access to that command");
  4665. return PLUGIN_HANDLED;
  4666. }
  4667.  
  4668. static ent, body;
  4669. get_user_aiming(id, ent, body);
  4670.  
  4671. if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
  4672.  
  4673. new player = entity_get_int(ent, EV_INT_iuser1);
  4674. if ( !player )
  4675. {
  4676. ++g_group_count[id];
  4677. g_grouped_blocks[id][g_group_count[id]] = ent;
  4678. GroupBlock(id, ent);
  4679.  
  4680. }
  4681. else if ( player == id )
  4682. {
  4683. UnGroupBlock(ent);
  4684. }
  4685. else
  4686. {
  4687. static player, name[32];
  4688.  
  4689. player = entity_get_int(ent, EV_INT_iuser1);
  4690. get_user_name(player, name, charsmax(name));
  4691.  
  4692. JCM_Print(id, "^3Block is already in a group by:^4 %s", name);
  4693. }
  4694.  
  4695. return PLUGIN_HANDLED;
  4696. }
  4697.  
  4698. GroupBlock(id, ent)
  4699. {
  4700. if ( !is_valid_ent(ent) ) return PLUGIN_HANDLED;
  4701.  
  4702. if ( 1 <= id <= g_max_players )
  4703. {
  4704. entity_set_int(ent, EV_INT_iuser1, id);
  4705. }
  4706.  
  4707. set_rendering(ent, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 16);
  4708.  
  4709. return PLUGIN_HANDLED;
  4710. }
  4711.  
  4712. UnGroupBlock(ent)
  4713. {
  4714. if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
  4715.  
  4716. entity_set_int(ent, EV_INT_iuser1, 0);
  4717.  
  4718. new block_type = entity_get_int(ent, EV_INT_body);
  4719. SetBlockRendering(ent, g_render[block_type], g_red[block_type], g_green[block_type], g_blue[block_type], g_alpha[block_type]);
  4720.  
  4721. return PLUGIN_HANDLED;
  4722. }
  4723.  
  4724. ClearGroup(id)
  4725. {
  4726. if ( !g_admin[id] && !g_gived_access[id] )
  4727. {
  4728. console_print(id, "You have no access to that command");
  4729. return PLUGIN_HANDLED;
  4730. }
  4731.  
  4732. static block;
  4733. static block_count;
  4734. static blocks_deleted;
  4735.  
  4736. block_count = 0;
  4737. blocks_deleted = 0;
  4738. for ( new i = 0; i <= g_group_count[id]; ++i )
  4739. {
  4740. block = g_grouped_blocks[id][i];
  4741. if ( IsBlockInGroup(id, block) )
  4742. {
  4743. if ( IsBlockStuck(block) )
  4744. {
  4745. DeleteBlock(block);
  4746. ++blocks_deleted;
  4747. }
  4748. else
  4749. {
  4750. UnGroupBlock(block);
  4751. ++block_count;
  4752. }
  4753. }
  4754. }
  4755.  
  4756. g_group_count[id] = 0;
  4757.  
  4758. if ( g_connected[id] )
  4759. {
  4760. if ( blocks_deleted > 0 )
  4761. {
  4762. JCM_Print(id, "^3Removed^4 %d^3 blocks from group. Deleted^4 %d^3 stuck blocks!", block_count, blocks_deleted);
  4763. }
  4764. else
  4765. {
  4766. JCM_Print(id, "^3Removed^4 %d^3 blocks from group!", block_count);
  4767. }
  4768. }
  4769.  
  4770. return PLUGIN_HANDLED;
  4771. }
  4772.  
  4773. SetBlockRendering(ent, type, red, green, blue, alpha)
  4774. {
  4775. if ( !IsBlock(ent) ) return PLUGIN_HANDLED;
  4776.  
  4777. switch ( type )
  4778. {
  4779. case GLOWSHELL: set_rendering(ent, kRenderFxGlowShell, red, green, blue, kRenderNormal, alpha);
  4780. case TRANSCOLOR: set_rendering(ent, kRenderFxGlowShell, red, green, blue, kRenderTransColor, alpha);
  4781. case TRANSALPHA: set_rendering(ent, kRenderFxNone, red, green, blue, kRenderTransColor, alpha);
  4782. case TRANSWHITE: set_rendering(ent, kRenderFxNone, red, green, blue, kRenderTransAdd, alpha);
  4783. default: set_rendering(ent, kRenderFxNone, red, green, blue, kRenderNormal, alpha);
  4784. }
  4785.  
  4786. return PLUGIN_HANDLED;
  4787. }
  4788.  
  4789. bool:IsBlock(ent)
  4790. {
  4791. if ( !is_valid_ent(ent) ) return false;
  4792.  
  4793. static classname[32];
  4794. entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname));
  4795.  
  4796. if ( equal(classname, g_block_classname) )
  4797. {
  4798. return true;
  4799. }
  4800.  
  4801. return false;
  4802. }
  4803.  
  4804. bool:IsBlockInGroup(id, ent)
  4805. {
  4806. if ( !is_valid_ent(ent) ) return false;
  4807.  
  4808. new player = entity_get_int(ent, EV_INT_iuser1);
  4809. if ( player == id ) return true;
  4810.  
  4811. return false;
  4812. }
  4813.  
  4814. bool:IsBlockStuck(ent)
  4815. {
  4816. if ( !is_valid_ent(ent) ) return false;
  4817.  
  4818. new content;
  4819. new Float:origin[3];
  4820. new Float:point[3];
  4821. new Float:size_min[3];
  4822. new Float:size_max[3];
  4823.  
  4824. entity_get_vector(ent, EV_VEC_mins, size_min);
  4825. entity_get_vector(ent, EV_VEC_maxs, size_max);
  4826.  
  4827. entity_get_vector(ent, EV_VEC_origin, origin);
  4828.  
  4829. size_min[0] += 1.0;
  4830. size_min[1] += 1.0;
  4831. size_min[2] += 1.0;
  4832.  
  4833. size_max[0] -= 1.0;
  4834. size_max[1] -= 1.0;
  4835. size_max[2] -= 1.0;
  4836.  
  4837. for ( new i = 0; i < 14; ++i )
  4838. {
  4839. point = origin;
  4840.  
  4841. switch ( i )
  4842. {
  4843. case 0:
  4844. {
  4845. point[0] += size_max[0];
  4846. point[1] += size_max[1];
  4847. point[2] += size_max[2];
  4848. }
  4849. case 1:
  4850. {
  4851. point[0] += size_min[0];
  4852. point[1] += size_max[1];
  4853. point[2] += size_max[2];
  4854. }
  4855. case 2:
  4856. {
  4857. point[0] += size_max[0];
  4858. point[1] += size_min[1];
  4859. point[2] += size_max[2];
  4860. }
  4861. case 3:
  4862. {
  4863. point[0] += size_min[0];
  4864. point[1] += size_min[1];
  4865. point[2] += size_max[2];
  4866. }
  4867. case 4:
  4868. {
  4869. point[0] += size_max[0];
  4870. point[1] += size_max[1];
  4871. point[2] += size_min[2];
  4872. }
  4873. case 5:
  4874. {
  4875. point[0] += size_min[0];
  4876. point[1] += size_max[1];
  4877. point[2] += size_min[2];
  4878. }
  4879. case 6:
  4880. {
  4881. point[0] += size_max[0];
  4882. point[1] += size_min[1];
  4883. point[2] += size_min[2];
  4884. }
  4885. case 7:
  4886. {
  4887. point[0] += size_min[0];
  4888. point[1] += size_min[1];
  4889. point[2] += size_min[2];
  4890. }
  4891. case 8: point[0] += size_max[0];
  4892. case 9: point[0] += size_min[0];
  4893. case 10: point[1] += size_max[1];
  4894. case 11: point[1] += size_min[1];
  4895. case 12: point[2] += size_max[2];
  4896. case 13: point[2] += size_min[2];
  4897. }
  4898.  
  4899. content = point_contents(point);
  4900. if ( content == CONTENTS_EMPTY
  4901. || !content ) return false;
  4902. }
  4903.  
  4904. return true;
  4905. }
  4906.  
  4907. CreateTeleportAiming(id, teleport_type)
  4908. {
  4909. if ( !g_admin[id] && !g_gived_access[id] )
  4910. {
  4911. console_print(id, "You have no access to that command");
  4912. return PLUGIN_HANDLED;
  4913. }
  4914.  
  4915. static origin[3];
  4916. static Float:float_origin[3];
  4917.  
  4918. get_user_origin(id, origin, 3);
  4919. IVecFVec(origin, float_origin);
  4920. float_origin[2] += 36.0;
  4921.  
  4922. CreateTeleport(id, teleport_type, float_origin);
  4923.  
  4924. return PLUGIN_HANDLED;
  4925. }
  4926.  
  4927. CreateTeleport(id, teleport_type, Float:origin[3])
  4928. {
  4929. new ent = create_entity("info_target");
  4930. if ( !is_valid_ent(ent) ) return PLUGIN_HANDLED;
  4931.  
  4932. switch ( teleport_type )
  4933. {
  4934. case TELEPORT_START:
  4935. {
  4936. if ( g_teleport_start[id] ) remove_entity(g_teleport_start[id]);
  4937.  
  4938. entity_set_string(ent, EV_SZ_classname, g_start_classname);
  4939. entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
  4940. entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);
  4941. entity_set_model(ent, g_sprite_teleport_start);
  4942. entity_set_size(ent, Float:{ -16.0, -16.0, -16.0 }, Float:{ 16.0, 16.0, 16.0 });
  4943. entity_set_origin(ent, origin);
  4944.  
  4945. entity_set_int(ent, EV_INT_rendermode, 5);
  4946. entity_set_float(ent, EV_FL_renderamt, 255.0);
  4947.  
  4948. static params[2];
  4949. params[0] = ent;
  4950. params[1] = 6;
  4951.  
  4952. set_task(0.1, "TaskSpriteNextFrame", TASK_SPRITE + ent, params, 2, g_b);
  4953.  
  4954. g_teleport_start[id] = ent;
  4955. }
  4956. case TELEPORT_DESTINATION:
  4957. {
  4958. if ( !g_teleport_start[id] )
  4959. {
  4960. remove_entity(ent);
  4961. return PLUGIN_HANDLED;
  4962. }
  4963.  
  4964. entity_set_string(ent, EV_SZ_classname, g_destination_classname);
  4965. entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
  4966. entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);
  4967. entity_set_model(ent, g_sprite_teleport_destination);
  4968. entity_set_size(ent, Float:{ -16.0, -16.0, -16.0 }, Float:{ 16.0, 16.0, 16.0 });
  4969. entity_set_origin(ent, origin);
  4970.  
  4971. entity_set_int(ent, EV_INT_rendermode, 5);
  4972. entity_set_float(ent, EV_FL_renderamt, 255.0);
  4973.  
  4974. entity_set_int(ent, EV_INT_iuser1, g_teleport_start[id]);
  4975. entity_set_int(g_teleport_start[id], EV_INT_iuser1, ent);
  4976.  
  4977. static params[2];
  4978. params[0] = ent;
  4979. params[1] = 4;
  4980.  
  4981. set_task(0.1, "TaskSpriteNextFrame", TASK_SPRITE + ent, params, 2, g_b);
  4982.  
  4983. g_teleport_start[id] = 0;
  4984. }
  4985. }
  4986.  
  4987. return PLUGIN_HANDLED;
  4988. }
  4989.  
  4990. DeleteTeleportAiming(id)
  4991. {
  4992. if ( !g_admin[id] && !g_gived_access[id] )
  4993. {
  4994. console_print(id, "You have no access to that command");
  4995. return PLUGIN_HANDLED;
  4996. }
  4997.  
  4998. static ent, body;
  4999. get_user_aiming(id, ent, body, 9999);
  5000.  
  5001. new bool:deleted = DeleteTeleport(id, ent);
  5002. if ( deleted ) JCM_Print(id, "^3Teleport deleted!");
  5003.  
  5004. return PLUGIN_HANDLED;
  5005. }
  5006.  
  5007. bool:DeleteTeleport(id, ent)
  5008. {
  5009. for ( new i = 0; i < 2; ++i )
  5010. {
  5011. if ( !IsTeleport(ent) ) return false;
  5012.  
  5013. new tele = entity_get_int(ent, EV_INT_iuser1);
  5014.  
  5015. if ( g_teleport_start[id] == ent
  5016. || g_teleport_start[id] == tele )
  5017. {
  5018. g_teleport_start[id] = 0;
  5019. }
  5020.  
  5021. if ( task_exists(TASK_SPRITE + ent) )
  5022. {
  5023. remove_task(TASK_SPRITE + ent);
  5024. }
  5025.  
  5026. if ( task_exists(TASK_SPRITE + tele) )
  5027. {
  5028. remove_task(TASK_SPRITE + tele);
  5029. }
  5030.  
  5031. if ( tele ) remove_entity(tele);
  5032.  
  5033. remove_entity(ent);
  5034. return true;
  5035. }
  5036.  
  5037. return false;
  5038. }
  5039.  
  5040. SwapTeleportAiming(id)
  5041. {
  5042. if ( !g_admin[id] && !g_gived_access[id] )
  5043. {
  5044. console_print(id, "You have no access to that command");
  5045. return PLUGIN_HANDLED;
  5046. }
  5047.  
  5048. static ent, body;
  5049. get_user_aiming(id, ent, body, 9999);
  5050.  
  5051. if ( !IsTeleport(ent) ) return PLUGIN_HANDLED;
  5052.  
  5053. SwapTeleport(id, ent);
  5054.  
  5055. return PLUGIN_HANDLED;
  5056. }
  5057.  
  5058. SwapTeleport(id, ent)
  5059. {
  5060. static Float:origin_ent[3];
  5061. static Float:origin_tele[3];
  5062.  
  5063. new tele = entity_get_int(ent, EV_INT_iuser1);
  5064. if ( !is_valid_ent(tele) )
  5065. {
  5066. JCM_Print(id, "^3Can't swap teleport positions!");
  5067. return PLUGIN_HANDLED;
  5068. }
  5069.  
  5070. entity_get_vector(ent, EV_VEC_origin, origin_ent);
  5071. entity_get_vector(tele, EV_VEC_origin, origin_tele);
  5072.  
  5073. static classname[32];
  5074. entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname));
  5075.  
  5076. DeleteTeleport(id, ent);
  5077.  
  5078. if ( equal(classname, g_start_classname) )
  5079. {
  5080. CreateTeleport(id, TELEPORT_START, origin_tele);
  5081. CreateTeleport(id, TELEPORT_DESTINATION, origin_ent);
  5082. }
  5083. else if ( equal(classname, g_destination_classname) )
  5084. {
  5085. CreateTeleport(id, TELEPORT_START, origin_ent);
  5086. CreateTeleport(id, TELEPORT_DESTINATION, origin_tele);
  5087. }
  5088.  
  5089. JCM_Print(id, "^3Teleports swapped!");
  5090.  
  5091. return PLUGIN_HANDLED;
  5092. }
  5093.  
  5094. ShowTeleportPath(id)
  5095. {
  5096. static ent, body;
  5097. get_user_aiming(id, ent, body);
  5098.  
  5099. if ( !IsTeleport(ent) ) return PLUGIN_HANDLED;
  5100.  
  5101. new tele = entity_get_int(ent, EV_INT_iuser1);
  5102. if ( !tele ) return PLUGIN_HANDLED;
  5103.  
  5104. static Float:origin1[3], Float:origin2[3], Float:dist;
  5105.  
  5106. entity_get_vector(ent, EV_VEC_origin, origin1);
  5107. entity_get_vector(tele, EV_VEC_origin, origin2);
  5108.  
  5109. message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  5110. write_byte(TE_BEAMPOINTS);
  5111. write_coord(floatround(origin1[0], floatround_floor));
  5112. write_coord(floatround(origin1[1], floatround_floor));
  5113. write_coord(floatround(origin1[2], floatround_floor));
  5114. write_coord(floatround(origin2[0], floatround_floor));
  5115. write_coord(floatround(origin2[1], floatround_floor));
  5116. write_coord(floatround(origin2[2], floatround_floor));
  5117. write_short(g_sprite_beam);
  5118. write_byte(0);
  5119. write_byte(1);
  5120. write_byte(50);
  5121. write_byte(5);
  5122. write_byte(0);
  5123. write_byte(255);
  5124. write_byte(255);
  5125. write_byte(255);
  5126. write_byte(255);
  5127. write_byte(0);
  5128. message_end();
  5129.  
  5130. dist = get_distance_f(origin1, origin2);
  5131.  
  5132. JCM_Print(id, "^3A line has been drawn to show the teleport path. Distance:^4 %f units", dist);
  5133.  
  5134. return PLUGIN_HANDLED;
  5135. }
  5136.  
  5137. bool:IsTeleport(ent)
  5138. {
  5139. if ( !is_valid_ent(ent) ) return false;
  5140.  
  5141. static classname[32];
  5142. entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname));
  5143.  
  5144. if ( equal(classname, g_start_classname)
  5145. || equal(classname, g_destination_classname) )
  5146. {
  5147. return true;
  5148. }
  5149.  
  5150. return false;
  5151. }
  5152.  
  5153. CreateBoxAiming(const id)
  5154. {
  5155. if ( !g_admin[id] && !g_gived_access[id] )
  5156. {
  5157. console_print(id, "You have no access to that command");
  5158. return PLUGIN_HANDLED;
  5159. }
  5160.  
  5161. static origin[3];
  5162. static Float:float_origin[3];
  5163.  
  5164. get_user_origin(id, origin, 3);
  5165. IVecFVec(origin, float_origin);
  5166. float_origin[2] += 4.0;
  5167.  
  5168. CreateBox(float_origin, "255", "255", "255");
  5169.  
  5170. return PLUGIN_HANDLED;
  5171. }
  5172.  
  5173. CreateBox(Float:origin[3], const color_red[], const color_green[], const color_blue[])
  5174. {
  5175. new ent = create_entity("info_target");
  5176. if ( !is_valid_ent(ent) ) return 0;
  5177.  
  5178. entity_set_origin(ent, origin);
  5179. entity_set_model(ent, g_model_box);
  5180. entity_set_float(ent, EV_FL_scale, 0.25);
  5181. entity_set_string(ent, EV_SZ_classname, g_box_classname);
  5182. entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
  5183. entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);
  5184.  
  5185. entity_set_size(ent, Float:{ -27.0, -27.0, -27.0 }, Float:{ 27.0, 27.0, 27.0 });
  5186.  
  5187. static Float:color[3];
  5188. color[0] = str_to_float(color_red);
  5189. color[1] = str_to_float(color_green);
  5190. color[2] = str_to_float(color_blue);
  5191.  
  5192. entity_set_vector(ent, EV_VEC_rendercolor, color);
  5193.  
  5194. SetProperty(ent, 1, color_red);
  5195. SetProperty(ent, 2, color_green);
  5196. SetProperty(ent, 3, color_blue);
  5197.  
  5198. entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.01);
  5199.  
  5200. return ent;
  5201. }
  5202.  
  5203. DeleteBoxAiming(id)
  5204. {
  5205. if ( !g_admin[id] && !g_gived_access[id] )
  5206. {
  5207. console_print(id, "You have no access to that command");
  5208. return PLUGIN_HANDLED;
  5209. }
  5210.  
  5211. static ent, body;
  5212. get_user_aiming(id, ent, body);
  5213.  
  5214. if ( !IsBox(ent) ) return PLUGIN_HANDLED;
  5215.  
  5216. new grabber = entity_get_int(ent, EV_INT_iuser2);
  5217. if ( grabber && grabber != id ) return PLUGIN_HANDLED;
  5218.  
  5219. DeleteBox(ent);
  5220.  
  5221. return PLUGIN_HANDLED;
  5222. }
  5223.  
  5224. bool:DeleteBox(ent)
  5225. {
  5226. if ( !IsBox(ent) ) return false;
  5227.  
  5228. remove_entity(ent);
  5229.  
  5230. return true;
  5231. }
  5232.  
  5233. bool:IsBox(ent)
  5234. {
  5235. if ( !is_valid_ent(ent) ) return false;
  5236.  
  5237. static classname[32];
  5238. entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname));
  5239.  
  5240. if ( equal(classname, g_box_classname) )
  5241. {
  5242. return true;
  5243. }
  5244.  
  5245. return false;
  5246. }
  5247.  
  5248. CreateLightAiming(const id)
  5249. {
  5250. if ( !g_admin[id] && !g_gived_access[id] )
  5251. {
  5252. console_print(id, "You have no access to that command");
  5253. return PLUGIN_HANDLED;
  5254. }
  5255.  
  5256. static origin[3];
  5257. static Float:float_origin[3];
  5258.  
  5259. get_user_origin(id, origin, 3);
  5260. IVecFVec(origin, float_origin);
  5261. float_origin[2] += 4.0;
  5262.  
  5263. CreateLight(float_origin, "25", "255", "255", "255");
  5264.  
  5265. return PLUGIN_HANDLED;
  5266. }
  5267.  
  5268. CreateLight(Float:origin[3], const radius[], const color_red[], const color_green[], const color_blue[])
  5269. {
  5270. new ent = create_entity("info_target");
  5271. if ( !is_valid_ent(ent) ) return 0;
  5272.  
  5273. entity_set_origin(ent, origin);
  5274. entity_set_model(ent, g_sprite_light);
  5275. entity_set_float(ent, EV_FL_scale, 0.25);
  5276. entity_set_string(ent, EV_SZ_classname, g_light_classname);
  5277. entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
  5278. entity_set_int(ent, EV_INT_movetype, MOVETYPE_NONE);
  5279.  
  5280. entity_set_size(ent, Float:{ -3.0, -3.0, -6.0 }, Float:{ 3.0, 3.0, 6.0 });
  5281.  
  5282. static Float:color[3];
  5283. color[0] = str_to_float(color_red);
  5284. color[1] = str_to_float(color_green);
  5285. color[2] = str_to_float(color_blue);
  5286.  
  5287. entity_set_vector(ent, EV_VEC_rendercolor, color);
  5288.  
  5289. SetProperty(ent, 1, radius);
  5290. SetProperty(ent, 2, color_red);
  5291. SetProperty(ent, 3, color_green);
  5292. SetProperty(ent, 4, color_blue);
  5293.  
  5294. entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.01);
  5295.  
  5296. return ent;
  5297. }
  5298.  
  5299. DeleteLightAiming(id)
  5300. {
  5301. if ( !g_admin[id] && !g_gived_access[id] )
  5302. {
  5303. console_print(id, "You have no access to that command");
  5304. return PLUGIN_HANDLED;
  5305. }
  5306.  
  5307. static ent, body;
  5308. get_user_aiming(id, ent, body);
  5309.  
  5310. if ( !IsLight(ent) ) return PLUGIN_HANDLED;
  5311.  
  5312. new grabber = entity_get_int(ent, EV_INT_iuser2);
  5313. if ( grabber && grabber != id ) return PLUGIN_HANDLED;
  5314.  
  5315. DeleteLight(ent);
  5316.  
  5317. return PLUGIN_HANDLED;
  5318. }
  5319.  
  5320. bool:DeleteLight(ent)
  5321. {
  5322. if ( !IsLight(ent) ) return false;
  5323.  
  5324. remove_entity(ent);
  5325.  
  5326. return true;
  5327. }
  5328.  
  5329. SetPropertiesLightAiming(id)
  5330. {
  5331. if ( !g_admin[id] && !g_gived_access[id] )
  5332. {
  5333. console_print(id, "You have no access to that command");
  5334. ShowLightMenu(id);
  5335. return PLUGIN_HANDLED;
  5336. }
  5337.  
  5338. static ent, body;
  5339. get_user_aiming(id, ent, body);
  5340.  
  5341. if ( !IsLight(ent) )
  5342. {
  5343. ShowLightMenu(id);
  5344. return PLUGIN_HANDLED;
  5345. }
  5346.  
  5347. g_viewing_light_properties_menu[id] = true;
  5348. ShowLightPropertiesMenu(id, ent);
  5349.  
  5350. return PLUGIN_HANDLED;
  5351. }
  5352.  
  5353. public SetPropertyLight(id)
  5354. {
  5355. static arg[33];
  5356. read_argv(1, arg, charsmax(arg));
  5357.  
  5358. if ( !strlen(arg) )
  5359. {
  5360. JCM_Print(id, "^3You can't set a property blank! Please type a new value.");
  5361. client_cmd(id, "messagemode JCM_SetLightProperty");
  5362. return PLUGIN_HANDLED;
  5363. }
  5364. else if ( !is_str_num(arg) )
  5365. {
  5366. JCM_Print(id, "^3You can't use letters in a property! Please type a new value.");
  5367. client_cmd(id, "messagemode JCM_SetLightProperty");
  5368. return PLUGIN_HANDLED;
  5369. }
  5370.  
  5371. new ent = g_light_property_info[id][1];
  5372. if ( !is_valid_ent(ent) )
  5373. {
  5374. JCM_Print(id, "^3That light has been deleted!");
  5375. g_viewing_light_properties_menu[id] = false;
  5376. ShowLightMenu(id);
  5377. return PLUGIN_HANDLED;
  5378. }
  5379.  
  5380. static property;
  5381. static property_value;
  5382.  
  5383. property = g_light_property_info[id][0];
  5384. property_value = str_to_num(arg);
  5385.  
  5386. if ( property == 1 )
  5387. {
  5388. if ( !( 1 <= property_value <= 100 ) )
  5389. {
  5390. JCM_Print(id, "^3The property has to be between^4 1^3 and^4 100!");
  5391. return PLUGIN_HANDLED;
  5392. }
  5393. }
  5394. else if ( !( 0 <= property_value <= 255 ) )
  5395. {
  5396. JCM_Print(id, "^3The property has to be between^4 0^3 and^4 255!");
  5397. return PLUGIN_HANDLED;
  5398. }
  5399.  
  5400. SetProperty(ent, property, arg);
  5401.  
  5402. if ( property != 1 )
  5403. {
  5404. static color_red[5], color_green[5], color_blue[5];
  5405.  
  5406. GetProperty(ent, 2, color_red);
  5407. GetProperty(ent, 3, color_green);
  5408. GetProperty(ent, 4, color_blue);
  5409.  
  5410. static Float:color[3];
  5411. color[0] = str_to_float(color_red);
  5412. color[1] = str_to_float(color_green);
  5413. color[2] = str_to_float(color_blue);
  5414.  
  5415. entity_set_vector(ent, EV_VEC_rendercolor, color);
  5416. }
  5417.  
  5418. for ( new i = 1; i <= g_max_players; i++ )
  5419. {
  5420. if ( !g_connected[i]
  5421. || !g_viewing_light_properties_menu[i] ) continue;
  5422.  
  5423. ent = g_light_property_info[i][1];
  5424. ShowLightPropertiesMenu(i, ent);
  5425. }
  5426.  
  5427. return PLUGIN_HANDLED;
  5428. }
  5429.  
  5430. public LightThink(ent)
  5431. {
  5432. static radius[5], color_red[5], color_green[5], color_blue[5];
  5433.  
  5434. GetProperty(ent, 1, radius);
  5435. GetProperty(ent, 2, color_red);
  5436. GetProperty(ent, 3, color_green);
  5437. GetProperty(ent, 4, color_blue);
  5438.  
  5439. static Float:float_origin[3];
  5440. entity_get_vector(ent, EV_VEC_origin, float_origin);
  5441.  
  5442. static origin[3];
  5443. FVecIVec(float_origin, origin);
  5444.  
  5445. message_begin(MSG_PVS, SVC_TEMPENTITY, origin, 0);
  5446. write_byte(TE_DLIGHT);
  5447. write_coord(origin[0]);
  5448. write_coord(origin[1]);
  5449. write_coord(origin[2]);
  5450. write_byte(str_to_num(radius));
  5451. write_byte(str_to_num(color_red));
  5452. write_byte(str_to_num(color_green));
  5453. write_byte(str_to_num(color_blue));
  5454. write_byte(1);
  5455. write_byte(1);
  5456. message_end();
  5457.  
  5458. entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.01);
  5459. }
  5460.  
  5461. bool:IsLight(ent)
  5462. {
  5463. if ( !is_valid_ent(ent) ) return false;
  5464.  
  5465. static classname[32];
  5466. entity_get_string(ent, EV_SZ_classname, classname, charsmax(classname));
  5467.  
  5468. if ( equal(classname, g_light_classname) )
  5469. {
  5470. return true;
  5471. }
  5472.  
  5473. return false;
  5474. }
  5475.  
  5476. DoSnapping(id, ent, Float:move_to[3])
  5477. {
  5478. if ( !g_snapping[id] ) return PLUGIN_HANDLED;
  5479.  
  5480. new traceline;
  5481. new closest_trace;
  5482. new block_face;
  5483. new Float:snap_size;
  5484. new Float:v_return[3];
  5485. new Float:dist;
  5486. new Float:old_dist;
  5487. new Float:trace_start[3];
  5488. new Float:trace_end[3];
  5489. new Float:size_min[3];
  5490. new Float:size_max[3];
  5491.  
  5492. entity_get_vector(ent, EV_VEC_mins, size_min);
  5493. entity_get_vector(ent, EV_VEC_maxs, size_max);
  5494.  
  5495. snap_size = g_snapping_gap[id] + 10.0;
  5496. old_dist = 9999.9;
  5497. closest_trace = 0;
  5498. for ( new i = 0; i < 6; ++i )
  5499. {
  5500. trace_start = move_to;
  5501.  
  5502. switch ( i )
  5503. {
  5504. case 0: trace_start[0] += size_min[0];
  5505. case 1: trace_start[0] += size_max[0];
  5506. case 2: trace_start[1] += size_min[1];
  5507. case 3: trace_start[1] += size_max[1];
  5508. case 4: trace_start[2] += size_min[2];
  5509. case 5: trace_start[2] += size_max[2];
  5510. }
  5511.  
  5512. trace_end = trace_start;
  5513.  
  5514. switch ( i )
  5515. {
  5516. case 0: trace_end[0] -= snap_size;
  5517. case 1: trace_end[0] += snap_size;
  5518. case 2: trace_end[1] -= snap_size;
  5519. case 3: trace_end[1] += snap_size;
  5520. case 4: trace_end[2] -= snap_size;
  5521. case 5: trace_end[2] += snap_size;
  5522. }
  5523.  
  5524. traceline = trace_line(ent, trace_start, trace_end, v_return);
  5525. if ( IsBlock(traceline)
  5526. && ( !IsBlockInGroup(id, traceline) || !IsBlockInGroup(id, ent) ) )
  5527. {
  5528. dist = get_distance_f(trace_start, v_return);
  5529. if ( dist < old_dist )
  5530. {
  5531. closest_trace = traceline;
  5532. old_dist = dist;
  5533.  
  5534. block_face = i;
  5535. }
  5536. }
  5537. }
  5538.  
  5539. if ( !is_valid_ent(closest_trace) ) return PLUGIN_HANDLED;
  5540.  
  5541. static Float:trace_origin[3];
  5542. static Float:trace_size_min[3];
  5543. static Float:trace_size_max[3];
  5544.  
  5545. entity_get_vector(closest_trace, EV_VEC_origin, trace_origin);
  5546. entity_get_vector(closest_trace, EV_VEC_mins, trace_size_min);
  5547. entity_get_vector(closest_trace, EV_VEC_maxs, trace_size_max);
  5548.  
  5549. move_to = trace_origin;
  5550.  
  5551. if ( block_face == 0 ) move_to[0] += ( trace_size_max[0] + size_max[0] ) + g_snapping_gap[id];
  5552. if ( block_face == 1 ) move_to[0] += ( trace_size_min[0] + size_min[0] ) - g_snapping_gap[id];
  5553. if ( block_face == 2 ) move_to[1] += ( trace_size_max[1] + size_max[1] ) + g_snapping_gap[id];
  5554. if ( block_face == 3 ) move_to[1] += ( trace_size_min[1] + size_min[1] ) - g_snapping_gap[id];
  5555. if ( block_face == 4 ) move_to[2] += ( trace_size_max[2] + size_max[2] ) + g_snapping_gap[id];
  5556. if ( block_face == 5 ) move_to[2] += ( trace_size_min[2] + size_min[2] ) - g_snapping_gap[id];
  5557.  
  5558. return PLUGIN_HANDLED;
  5559. }
  5560.  
  5561. DeleteAll(id, bool:notify)
  5562. {
  5563. if ( !g_admin[id] )
  5564. {
  5565. console_print(id, "You have no access to that command");
  5566. return PLUGIN_HANDLED;
  5567. }
  5568.  
  5569. static ent, block_count, tele_count, light_count, box_count, bool:deleted;
  5570.  
  5571. ent = -1;
  5572. block_count = 0;
  5573. while ( ( ent = find_ent_by_class(ent, g_block_classname) ) )
  5574. {
  5575. deleted = DeleteBlock(ent);
  5576. if ( deleted )
  5577. {
  5578. ++block_count;
  5579. }
  5580. }
  5581.  
  5582. ent = -1;
  5583. tele_count = 0;
  5584. while ( ( ent = find_ent_by_class(ent, g_start_classname) ) )
  5585. {
  5586. deleted = DeleteTeleport(id, ent);
  5587. if ( deleted )
  5588. {
  5589. ++tele_count;
  5590. }
  5591. }
  5592.  
  5593. ent = -1;
  5594. light_count = 0;
  5595. box_count = 0;
  5596. while ( ( ent = find_ent_by_class(ent, g_light_classname) ) )
  5597. {
  5598. deleted = DeleteLight(ent);
  5599. if ( deleted )
  5600. {
  5601. ++light_count;
  5602. }
  5603. }
  5604.  
  5605. while ( ( ent = find_ent_by_class(ent, g_box_classname) ) )
  5606. {
  5607. deleted = DeleteBox(ent);
  5608. if ( deleted )
  5609. {
  5610. ++box_count;
  5611. }
  5612. }
  5613.  
  5614. if ( ( block_count
  5615. || tele_count
  5616. || light_count
  5617. || box_count )
  5618. && notify )
  5619. {
  5620. static name[32];
  5621. get_user_name(id, name, charsmax(name));
  5622.  
  5623. for ( new i = 1; i <= g_max_players; ++i )
  5624. {
  5625. g_grabbed[i] = 0;
  5626. g_teleport_start[i] = 0;
  5627.  
  5628. if ( !g_connected[i]
  5629. || !g_admin[i] && !g_gived_access[i] ) continue;
  5630.  
  5631. JCM_Print(i, "^4%s^3 deleted^4 %d^3 blocks,^4 %d^3 teleports,^4 %d^3 lights,^4 %d^3 boxes from the map!", name, block_count, tele_count, light_count, box_count);
  5632. }
  5633. }
  5634.  
  5635. return PLUGIN_HANDLED;
  5636. }
  5637.  
  5638. SaveBlocks(id)
  5639. {
  5640. if ( !g_admin[id] )
  5641. {
  5642. console_print(id, "You have no access to that command");
  5643. return PLUGIN_HANDLED;
  5644. }
  5645.  
  5646. new ent;
  5647. new file;
  5648. new data[128];
  5649. new block_count;
  5650. new tele_count;
  5651. new light_count;
  5652. new box_count;
  5653. new block_type;
  5654. new size;
  5655. new property1[20], property2[20], property3[20], property4[20];
  5656. new tele;
  5657. new Float:origin[3];
  5658. new Float:angles[3];
  5659. new Float:tele_start[3];
  5660. new Float:tele_end[3];
  5661. new Float:max_size;
  5662. new Float:size_max[3];
  5663.  
  5664. file = fopen(g_file, "wt");
  5665.  
  5666. block_count = 0;
  5667. tele_count = 0;
  5668.  
  5669. ent = -1;
  5670. while ( ( ent = find_ent_by_class(ent, g_block_classname) ) )
  5671. {
  5672. block_type = entity_get_int(ent, EV_INT_body);
  5673. if( block_type == MAGIC )
  5674. {
  5675. pev(ent, pev_v_angle, origin);
  5676. }
  5677. else
  5678. {
  5679. entity_get_vector(ent, EV_VEC_origin, origin);
  5680. }
  5681.  
  5682. entity_get_vector(ent, EV_VEC_angles, angles);
  5683. entity_get_vector(ent, EV_VEC_maxs, size_max);
  5684.  
  5685. GetProperty(ent, 2, property2);
  5686. GetProperty(ent, 3, property3);
  5687. GetProperty(ent, 4, property4);
  5688.  
  5689. if ( !property1[0] ) copy(property1, charsmax(property1), "/");
  5690. if ( !property2[0] ) copy(property2, charsmax(property2), "/");
  5691. if ( !property3[0] ) copy(property3, charsmax(property3), "/");
  5692. if ( !property4[0] ) copy(property4, charsmax(property4), "/");
  5693.  
  5694. max_size = size_max[0] + size_max[1] + size_max[2];
  5695.  
  5696. if ( max_size > 128.0 ) size = LARGE;
  5697. else if ( max_size > 64.0 ) size = NORMAL;
  5698. else if ( max_size > 32.0 ) size = POLE;
  5699. else size = TINY;
  5700.  
  5701. formatex(data, charsmax(data), "%c %f %f %f %f %f %f %d %s %s %s %s^n",\
  5702. g_block_save_ids[block_type],\
  5703. origin[0],\
  5704. origin[1],\
  5705. origin[2],\
  5706. angles[0],\
  5707. angles[1],\
  5708. angles[2],\
  5709. size,\
  5710. property1,\
  5711. property2,\
  5712. property3,\
  5713. property4
  5714. );
  5715. fputs(file, data);
  5716.  
  5717. ++block_count;
  5718. }
  5719.  
  5720. ent = -1;
  5721. while ( ( ent = find_ent_by_class(ent, g_destination_classname) ) )
  5722. {
  5723. tele = entity_get_int(ent, EV_INT_iuser1);
  5724. if ( tele )
  5725. {
  5726. entity_get_vector(tele, EV_VEC_origin, tele_start);
  5727. entity_get_vector(ent, EV_VEC_origin, tele_end);
  5728.  
  5729. formatex(data, charsmax(data), "* %f %f %f %f %f %f^n",\
  5730. tele_start[0],\
  5731. tele_start[1],\
  5732. tele_start[2],\
  5733. tele_end[0],\
  5734. tele_end[1],\
  5735. tele_end[2]
  5736. );
  5737. fputs(file, data);
  5738.  
  5739. ++tele_count;
  5740. }
  5741. }
  5742.  
  5743. while ( ( ent = find_ent_by_class(ent, g_box_classname) ) )
  5744. {
  5745. entity_get_vector(ent, EV_VEC_origin, origin);
  5746.  
  5747. GetProperty(ent, 1, property1);
  5748. GetProperty(ent, 2, property2);
  5749. GetProperty(ent, 3, property3);
  5750.  
  5751. formatex(data, charsmax(data), "? %f %f %f / / / / %s %s %s^n",\
  5752. origin[0],\
  5753. origin[1],\
  5754. origin[2],\
  5755. property1,\
  5756. property2,\
  5757. property3
  5758. );
  5759. fputs(file, data);
  5760.  
  5761. ++box_count;
  5762. }
  5763.  
  5764. ent = -1;
  5765. while ( ( ent = find_ent_by_class(ent, g_light_classname) ) )
  5766. {
  5767. entity_get_vector(ent, EV_VEC_origin, origin);
  5768.  
  5769. GetProperty(ent, 1, property1);
  5770. GetProperty(ent, 2, property2);
  5771. GetProperty(ent, 3, property3);
  5772. GetProperty(ent, 4, property4);
  5773.  
  5774. formatex(data, charsmax(data), "! %f %f %f / / / / %s %s %s %s^n",\
  5775. origin[0],\
  5776. origin[1],\
  5777. origin[2],\
  5778. property1,\
  5779. property2,\
  5780. property3,\
  5781. property4
  5782. );
  5783. fputs(file, data);
  5784.  
  5785. ++light_count;
  5786. }
  5787.  
  5788. static name[32];
  5789. get_user_name(id, name, charsmax(name));
  5790.  
  5791. for ( new i = 1; i <= g_max_players; ++i )
  5792. {
  5793. if ( g_connected[i]
  5794. && ( g_admin[i] || g_gived_access[i] ) )
  5795. {
  5796. JCM_Print(i, "^4%s^3 saved^4 %d^3 block%s,^4 %d^3 teleport%s,^4 %d^3 box%s and^4 %d^3 light%s! There are^4 %d^3 entities in the map!", name, block_count, block_count == 1 ? g_blank : "s", tele_count, tele_count == 1 ? g_blank : "s", box_count, box_count == 1 ? g_blank : "es", light_count, light_count == 1 ? g_blank : "s", entity_count());
  5797. }
  5798. }
  5799.  
  5800. fclose(file);
  5801. return PLUGIN_HANDLED;
  5802. }
  5803.  
  5804. LoadBlocks(id)
  5805. {
  5806. if ( id != 0 && !g_admin[id] )
  5807. {
  5808. console_print(id, "You have no access to that command");
  5809. return PLUGIN_HANDLED;
  5810. }
  5811. else if ( !file_exists(g_file)
  5812. && 1 <= id <= g_max_players )
  5813. {
  5814. JCM_Print(id, "Couldn't find file:^1 %s", g_file);
  5815. return PLUGIN_HANDLED;
  5816. }
  5817.  
  5818. if ( 1 <= id <= g_max_players )
  5819. {
  5820. DeleteAll(id, false);
  5821. }
  5822.  
  5823. new file;
  5824. new data[128];
  5825. new block_count;
  5826. new tele_count;
  5827. new light_count;
  5828. new box_count;
  5829. new type[2];
  5830. new block_size[17];
  5831. new origin_x[17];
  5832. new origin_y[17];
  5833. new origin_z[17];
  5834. new angel_x[17];
  5835. new angel_y[17];
  5836. new angel_z[17];
  5837. new block_type;
  5838. new axis;
  5839. new size;
  5840. new property1[20], property2[20], property3[20], property4[20];
  5841. new Float:origin[3];
  5842. new Float:angles[3];
  5843.  
  5844. file = fopen(g_file, "rt");
  5845.  
  5846. block_count = 0;
  5847. tele_count = 0;
  5848.  
  5849. while ( !feof(file) )
  5850. {
  5851. type = g_blank;
  5852.  
  5853. fgets(file, data, charsmax(data));
  5854. parse(data,\
  5855. type, charsmax(type),\
  5856. origin_x, charsmax(origin_x),\
  5857. origin_y, charsmax(origin_y),\
  5858. origin_z, charsmax(origin_z),\
  5859. angel_x, charsmax(angel_x),\
  5860. angel_y, charsmax(angel_y),\
  5861. angel_z, charsmax(angel_z),\
  5862. block_size, charsmax(block_size),\
  5863. property1, charsmax(property1),\
  5864. property2, charsmax(property2),\
  5865. property3, charsmax(property3),\
  5866. property4, charsmax(property4)
  5867. );
  5868.  
  5869. origin[0] = str_to_float(origin_x);
  5870. origin[1] = str_to_float(origin_y);
  5871. origin[2] = str_to_float(origin_z);
  5872. angles[0] = str_to_float(angel_x);
  5873. angles[1] = str_to_float(angel_y);
  5874. angles[2] = str_to_float(angel_z);
  5875. size = str_to_num(block_size);
  5876.  
  5877. if ( strlen(type) > 0 )
  5878. {
  5879. if ( type[0] != '*' )
  5880. {
  5881. if ( angles[0] == 90.0 && angles[1] == 0.0 && angles[2] == 0.0 )
  5882. {
  5883. axis = X;
  5884. }
  5885. else if ( angles[0] == 90.0 && angles[1] == 0.0 && angles[2] == 90.0 )
  5886. {
  5887. axis = Y;
  5888. }
  5889. else
  5890. {
  5891. axis = Z;
  5892. }
  5893. }
  5894.  
  5895. switch ( type[0] )
  5896. {
  5897. case 'A': block_type = PLATFORM;
  5898. case 'B': block_type = BUNNYHOP;
  5899. case 'C': block_type = DAMAGE;
  5900. case 'D': block_type = HEALER;
  5901. case 'E': block_type = NO_FALL_DAMAGE;
  5902. case 'F': block_type = ICE;
  5903. case 'G': block_type = TRAMPOLINE;
  5904. case 'H': block_type = SPEED_BOOST;
  5905. case 'I': block_type = DEATH;
  5906. case 'J': block_type = LOW_GRAVITY;
  5907. case 'K': block_type = SLAP;
  5908. case 'L': block_type = HONEY;
  5909. case 'M': block_type = CT_BARRIER;
  5910. case 'N': block_type = T_BARRIER;
  5911. case 'O': block_type = GLASS;
  5912. case 'P': block_type = NO_SLOW_DOWN_BUNNYHOP;
  5913. case 'Q': block_type = DELAYED_BUNNYHOP;
  5914. case 'R': block_type = INVINCIBILITY;
  5915. case 'S': block_type = STEALTH;
  5916. case 'T': block_type = BOOTS_OF_SPEED;
  5917. case '1': block_type = SUPERMAN;
  5918. case '2': block_type = NADES;
  5919. case '3': block_type = MAGIC;
  5920. case '4': block_type = DEAGLE;
  5921. case '5': block_type = AWP;
  5922. case '*':
  5923. {
  5924. CreateTeleport(0, TELEPORT_START, origin);
  5925. CreateTeleport(0, TELEPORT_DESTINATION, angles);
  5926.  
  5927. ++tele_count;
  5928. }
  5929. case '!':
  5930. {
  5931. CreateLight(origin, property1, property2, property3, property4);
  5932.  
  5933. ++light_count;
  5934. }
  5935. case '?':
  5936. {
  5937. CreateBox(origin, property1, property2, property3);
  5938.  
  5939. ++box_count;
  5940. }
  5941. }
  5942.  
  5943. if ( type[0] != '*' && type[0] != '!' && type[0] != '?' )
  5944. {
  5945. CreateBlock(0, block_type, origin, axis, size, property1, property2, property3, property4);
  5946.  
  5947. ++block_count;
  5948. }
  5949. }
  5950. }
  5951.  
  5952. fclose(file);
  5953.  
  5954. if ( 1 <= id <= g_max_players )
  5955. {
  5956. static name[32];
  5957. get_user_name(id, name, charsmax(name));
  5958.  
  5959. for ( new i = 1; i <= g_max_players; ++i )
  5960. {
  5961. if ( !g_connected[i]
  5962. || !g_admin[i] && !g_gived_access[i] ) continue;
  5963.  
  5964. JCM_Print(i, "^4%s^3 loaded^4 %d^3 block%s,^4 %d^3 teleport%s,^4 %d^3 box%s and^4 %d^3 light%s! There are^4 %d^3 enities in the map", name, block_count, block_count == 1 ? g_blank : "s", tele_count, tele_count == 1 ? g_blank : "s", box_count, box_count == 1 ? g_blank : "es", light_count, light_count == 1 ? g_blank : "s", entity_count());
  5965. }
  5966. }
  5967.  
  5968. return PLUGIN_HANDLED;
  5969. }
  5970.  
  5971. bool:IsStrFloat(string[])
  5972. {
  5973. new len = strlen(string);
  5974. for ( new i = 0; i < len; i++ )
  5975. {
  5976. switch ( string[i] )
  5977. {
  5978. case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '-': continue;
  5979. default: return false;
  5980. }
  5981. }
  5982.  
  5983. return true;
  5984. }
  5985.  
  5986. ResetPlayer(id)
  5987. {
  5988. g_no_fall_damage[id] = false;
  5989. g_ice[id] = false;
  5990. g_low_gravity[id] = false;
  5991. g_no_slow_down[id] = false;
  5992. g_block_status[id] = false;
  5993. g_has_hud_text[id] = false;
  5994.  
  5995. g_slap_times[id] = 0;
  5996. g_honey[id] = 0;
  5997. g_boots_of_speed[id] = 0;
  5998.  
  5999. g_next_damage_time[id] = 0.0;
  6000. g_next_heal_time[id] = 0.0;
  6001. g_invincibility_time_out[id] = 0.0;
  6002. g_invincibility_next_use[id] = 0.0;
  6003. g_stealth_time_out[id] = 0.0;
  6004. g_stealth_next_use[id] = 0.0;
  6005. g_boots_of_speed_time_out[id] = 0.0;
  6006. g_boots_of_speed_next_use[id] = 0.0;
  6007. g_superman_time_out[id] = 0.0;
  6008. g_superman_next_use[id] = 0.0;
  6009. g_nades_next_use[id] = 0.0;
  6010.  
  6011. g_deagle_used[id] = false;
  6012. g_awp_used[id] = false;
  6013.  
  6014. new task_id = TASK_INVINCIBLE + id;
  6015. if ( task_exists(task_id) )
  6016. {
  6017. TaskRemoveInvincibility(task_id);
  6018. remove_task(task_id);
  6019. }
  6020.  
  6021. task_id = TASK_STEALTH + id;
  6022. if ( task_exists(task_id) )
  6023. {
  6024. TaskRemoveStealth(task_id);
  6025. remove_task(task_id);
  6026. }
  6027.  
  6028. task_id = TASK_BOOTSOFSPEED + id;
  6029. if ( task_exists(task_id) )
  6030. {
  6031. TaskRemoveBootsOfSpeed(task_id);
  6032. remove_task(task_id);
  6033. }
  6034.  
  6035. task_id = TASK_SUPERMAN + id;
  6036. if ( task_exists(task_id) )
  6037. {
  6038. TaskRemoveSuperman(task_id);
  6039. remove_task(task_id);
  6040. }
  6041.  
  6042. if ( g_connected[id] )
  6043. {
  6044. set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 255);
  6045. }
  6046.  
  6047. g_reseted[id] = true;
  6048. }
  6049.  
  6050. ResetMaxspeed(id)
  6051. {
  6052. static Float:max_speed;
  6053. switch ( get_user_weapon(id) )
  6054. {
  6055. case CSW_SG550, CSW_AWP, CSW_G3SG1: max_speed = 210.0;
  6056. case CSW_M249: max_speed = 220.0;
  6057. case CSW_AK47: max_speed = 221.0;
  6058. case CSW_M3, CSW_M4A1: max_speed = 230.0;
  6059. case CSW_SG552: max_speed = 235.0;
  6060. case CSW_XM1014, CSW_AUG, CSW_GALIL, CSW_FAMAS: max_speed = 240.0;
  6061. case CSW_P90: max_speed = 245.0;
  6062. case CSW_SCOUT: max_speed = 260.0;
  6063. default: max_speed = 250.0;
  6064. }
  6065.  
  6066. entity_set_float(id, EV_FL_maxspeed, max_speed);
  6067. }
  6068.  
  6069. JCM_Print(id, const message_fmt[], any:...)
  6070. {
  6071. static i; i = id ? id : GetPlayer();
  6072. if ( !i ) return;
  6073.  
  6074. static message[256], len;
  6075. len = formatex(message, charsmax(message), "^4[JG]^3 ", PLUGIN_PREFIX, PLUGIN_VERSION);
  6076. vformat(message[len], charsmax(message) - len, message_fmt, 3);
  6077. message[192] = 0;
  6078.  
  6079. static msgid_SayText;
  6080. if ( !msgid_SayText ) msgid_SayText = get_user_msgid("SayText");
  6081.  
  6082. static const team_names[][] =
  6083. {
  6084. "",
  6085. "TERRORIST",
  6086. "CT",
  6087. "SPECTATOR"
  6088. };
  6089.  
  6090. static team; team = get_user_team(i);
  6091.  
  6092. TeamInfo(i, id, team_names[0]);
  6093.  
  6094. message_begin(id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgid_SayText, _, id);
  6095. write_byte(i);
  6096. write_string(message);
  6097. message_end();
  6098.  
  6099. TeamInfo(i, id, team_names[team]);
  6100. }
  6101.  
  6102. TeamInfo(receiver, sender, team[])
  6103. {
  6104. static msgid_TeamInfo;
  6105. if ( !msgid_TeamInfo ) msgid_TeamInfo = get_user_msgid("TeamInfo");
  6106.  
  6107. message_begin(sender ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgid_TeamInfo, _, sender);
  6108. write_byte(receiver);
  6109. write_string(team);
  6110. message_end();
  6111. }
  6112.  
  6113. GetPlayer()
  6114. {
  6115. for ( new id = 1; id <= g_max_players; id++ )
  6116. {
  6117. if ( !g_connected[id] ) continue;
  6118.  
  6119. return id;
  6120. }
  6121.  
  6122. return 0;
  6123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement