Guest User

Untitled

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