Advertisement
Guest User

Untitled

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