Advertisement
Guest User

Untitled

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