Advertisement
Guest User

Untitled

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