Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
Wklejka 1b7z6uux7928o dodana przez fdrest, 28.02.2012 20:38
do tłumaczenia 4
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 212. 213. 214. 215. 216. 217. 218. 219. 220. 221. 222. 223. 224. 225. 226. 227. 228. 229. 230. 231. 232. 233. 234. 235. 236. 237. 238. 239. 240. 241. 242. 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. 253. 254. 255. 256. 257. 258. 259. 260. 261. 262. 263. 264. 265. 266. 267. 268. 269. 270. 271. 272. 273. 274. 275. 276. 277. 278. 279. 280. 281. 282. 283. 284. 285. 286. 287. 288. 289. 290. 291. 292. 293. 294. 295. 296. 297. 298. 299. 300. 301. 302. 303. 304. 305. 306. 307. 308. 309. 310. 311. 312. 313. 314. 315. 316. 317. 318. 319. 320. 321. 322. 323. 324. 325. 326. 327. 328. 329. 330. 331. 332. 333. 334. 335. 336. 337. 338. 339. 340. 341. 342. 343. 344. 345. 346. 347. 348. 349. 350. 351. 352. 353. 354. 355. 356. 357. 358. 359. 360. 361. 362. 363. 364. 365. 366. 367. 368. 369. 370. 371. 372. 373. 374. 375. 376. 377. 378. 379. 380. 381. 382. 383. 384. 385. 386. 387. 388. 389. 390. 391. 392. 393. 394. 395. 396. 397. 398. 399. 400. 401. 402. 403. 404. 405. 406. 407. 408. 409. 410. 411. 412. 413. 414. 415. 416. 417. 418. 419. 420. 421. 422. 423. 424. 425. 426. 427. 428. 429. 430. 431. 432. 433. 434. 435. 436. 437. 438. 439. 440. 441. 442. 443. 444. 445. 446. 447. 448. 449. 450. 451. 452. 453. 454. 455. 456. 457. 458. 459. 460. 461. 462. 463. 464. 465. 466. 467. 468. 469. 470. 471. 472. 473. 474. 475. 476. 477. 478. 479. 480. 481. 482. 483. 484. 485. 486. 487. 488. 489. 490. 491. 492. 493. 494. 495. 496. 497. 498. 499. 500. 501. 502. 503. 504. 505. 506. 507. 508. 509. 510. 511. 512. 513. 514. 515. 516. 517. 518. 519. 520. 521. 522. 523. 524. 525. 526. 527. 528. 529. 530. 531. 532. 533. 534. 535. 536. 537. 538. 539. 540. 541. 542. 543. 544. 545. 546. 547. 548. 549. 550. 551. 552. 553. 554. 555. 556. 557. 558. 559. 560. 561. 562. 563. 564. 565. 566. 567. 568. 569. 570. 571. 572. 573. 574. 575. 576. 577. 578. 579. 580. 581. 582. 583. 584. 585. 586. 587. 588. 589. 590. 591. 592. 593. 594. 595. 596. 597. 598. 599. 600. 601. 602. 603. 604. 605. 606. 607. 608. 609. 610. 611. 612. 613. 614. 615. 616. 617. 618. 619. 620. 621. 622. 623. 624. 625. 626. 627. 628. 629. 630. 631. 632. 633. 634. 635. 636. 637. 638. 639. 640. 641. 642. 643. 644. 645. 646. 647. 648. 649. 650. 651. 652. 653. 654. 655. 656. 657. 658. 659. 660. 661. 662. 663. 664. 665. 666. 667. 668. 669. 670. 671. 672. 673. 674. 675. 676. 677. 678. 679. 680. 681. 682. 683. 684. 685. 686. 687. 688. 689. 690. 691. 692. 693. 694. 695. 696. 697. 698. 699. 700. 701. 702. 703. 704. 705. 706. 707. 708. 709. 710. 711. 712. 713. 714. 715. 716. 717. 718. 719. 720. 721. 722. 723. 724. 725. 726. 727. 728. 729. 730. 731. 732. 733. 734. 735. 736. 737. 738. 739. 740. 741. 742. 743. 744. 745. 746. 747. 748. 749. 750. 751. 752. 753. 754. 755. 756. 757. 758. 759. 760. 761. 762. 763. 764. 765. 766. 767. 768. 769. 770. 771. 772. 773. 774. 775. 776. 777. 778. 779. 780. 781. 782. 783. 784. 785. 786. 787. 788. 789. 790. 791. 792. 793. 794. 795. 796. 797. 798. 799. 800. 801. 802. 803. 804. 805. 806. 807. 808. 809. 810. 811. 812. 813. 814. 815. 816. 817. 818. 819. 820. 821. 822. 823. 824. 825. 826. 827. 828. 829. 830. 831. 832. 833. 834. 835. 836. 837. 838. 839. 840. 841. 842. 843. 844. 845. 846. 847. 848. 849. 850. 851. 852. 853. 854. 855. 856. 857. 858. 859. 860. 861. 862. 863. 864. 865. 866. 867. 868. 869. 870. 871. 872. 873. 874. 875. 876. 877. 878. 879. 880. 881. 882. 883. 884. 885. 886. 887. 888. 889. 890. 891. 892. 893. 894. 895. 896. 897. 898. 899. 900. 901. 902. 903. 904. 905. 906. 907. 908. 909. 910. 911. 912. 913. 914. 915. 916. 917. 918. 919. 920. 921. 922. 923. 924. 925. 926. 927. 928. 929. 930. 931. 932. 933. 934. 935. 936. 937. 938. 939. 940. 941. 942. 943. 944. 945. 946. 947. 948. 949. 950. 951. 952. 953. 954. 955. 956. 957. 958. 959. 960. 961. 962. 963. 964. 965. 966. 967. 968. 969. 970. 971. 972. 973. 974. 975. 976. 977. 978. 979. 980. 981. 982. 983. 984. 985. 986. 987. 988. 989. 990. 991. 992. 993. 994. 995. 996. 997. 998. 999. 1000. 1001. 1002. 1003. 1004. 1005. 1006. 1007. 1008. 1009. 1010. 1011. 1012. 1013. 1014. 1015. 1016. 1017. 1018. 1019. 1020. 1021. 1022. 1023. 1024. 1025. 1026. 1027. 1028. 1029. 1030. 1031. 1032. 1033. 1034. 1035. 1036. 1037. 1038. 1039. 1040. 1041. 1042. 1043. 1044. 1045. 1046. 1047. 1048. 1049. 1050. 1051. 1052. 1053. 1054. 1055. 1056. 1057. 1058. 1059. 1060. 1061. 1062. 1063. 1064. 1065. 1066. 1067. 1068. 1069. 1070. 1071. 1072. 1073. 1074. 1075. 1076. 1077. 1078. 1079. 1080. 1081. 1082. 1083. 1084. 1085. 1086. 1087.
#include <amxmodx> #include <fakemeta> #include <hamsandwich> #include <cstrike> #include <fun> #define PLUGIN "R Paintball Gun" #define VERSION "5.10" #define AUTHOR "Rul4 - WhooKid" #define MAX_PAINTBALLS 200 #define TASK_PB_RESET 1000 #define TASK_RELOAD 2000 #define TASK_NADE 5000 #define CROSSHAIR_REMOVED ( 1<<6 ) #define PB_MARKER 1 #define PB_USP 2 #define PB_GLOCK 3 #define PB_SNIPER 4 #define PB_LAUNCHER 5 #define PB_SHOTGUN 6 #define PB_SUPERMARKER 7 new g_msgHideWeapon; new g_paintballs[MAX_PAINTBALLS], g_pbstatus[MAX_PAINTBALLS], g_pbcount, Float:lastshot[33], Float:nextattack[33], freezetime; new pbgun, color, shots, blife, sound, bglow, damage, friendlyfire, beamspr; new blood1, blood2, knife_ohk, jamon, pellets_real, pbslauncher; new fire_rate_low, fire_rate_medium, fire_rate_high, jam_prob_low, jam_prob_high, gravity, speed_marker, speed_pistol, speed_shotgun, speed_sniper, dispersion, removecrosshair, speed_launcher, speed_smarker ; static const g_shot_anim[8] = {0, 3, 9, 5, 1, 1, 1, 3}; static const g_pbgun_models[11][] = {"models/v_pbgun.mdl", "models/v_pbgun1.mdl", "models/v_pbgun2.mdl", "models/v_pbgun3.mdl", "models/v_pbgun4.mdl", "models/v_pbgun5.mdl", "models/v_pbgun6.mdl", "models/v_pbgun7.mdl", "models/v_pbgun8.mdl", "models/v_pbgun9.mdl", "models/v_pbgun10.mdl"}; new g_Jammed[33]; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_cvar("rpaintballgun", VERSION, FCVAR_SERVER|FCVAR_UNLOGGED); set_cvar_string("rpaintballgun", VERSION) register_clcmd("say /ent", "ent_info", ADMIN_SLAY); g_msgHideWeapon = get_user_msgid( "HideWeapon" ); if (get_pcvar_num(pbgun)) { register_event("CurWeapon", "ev_curweapon", "be"); register_logevent("ev_roundstart", 2, "0=World triggered", "1=Round_Start"); if (get_cvar_num("mp_freezetime") > 0) register_event("HLTV", "ev_freezetime", "a", "1=0", "2=0"); register_forward(FM_Touch, "fw_touch"); register_forward(FM_SetModel, "fw_setmodel"); register_forward(FM_CmdStart, "fw_cmdstart"); register_forward(FM_UpdateClientData, "fw_updateclientdata",1); if (get_pcvar_num(pbslauncher)) register_forward(FM_Think, "fw_think"); RegisterHam ( Ham_TakeDamage, "player", "fwd_TakeDamage" ); RegisterHam (Ham_Weapon_Reload, "weapon_m3", "fw_reload", 1); RegisterHam (Ham_Weapon_Reload, "weapon_xm1014", "fw_reload", 1); RegisterHam (Ham_Weapon_Reload, "weapon_scout", "fw_reload", 1); set_cvar_num ("sv_maxvelocity", 4000); new a, max_ents_allow = global_get(glb_maxEntities) - 5; for (a = 1; a <= get_pcvar_num(shots); a++) if (a < MAX_PAINTBALLS) if (engfunc(EngFunc_NumberOfEntities) < max_ents_allow) { g_paintballs[a] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")); if (pev_valid(g_paintballs[a])) { set_pev(g_paintballs[a], pev_effects, pev(g_paintballs[a], pev_effects) | EF_NODRAW); g_pbcount++; } } if (g_pbcount < 1) set_fail_state("[AMXX] Failed to load Realism for Paintball Gun (unable to create ents)"); server_print("*** %s v%s by %s Enabled ***", PLUGIN, VERSION, AUTHOR); } } public plugin_precache() { pbgun = register_cvar("amx_pbgun", "1"); knife_ohk = register_cvar("amx_knifeonehitkill", "1"); jamon = register_cvar("amx_pbgun_jam","1"); friendlyfire = get_cvar_pointer("mp_friendlyfire"); if (get_pcvar_num(pbgun)) { color = register_cvar("pbgun_color", "1"); shots = register_cvar("pbgun_shots", "100"); blife = register_cvar("pbgun_life", "15"); sound = register_cvar("pbgun_sound", "1"); bglow = register_cvar("pbgun_glow", "c"); damage = register_cvar("pbgun_damage", "100"); fire_rate_low = register_cvar("pbgun_fireratelow", "1.1"); fire_rate_high = register_cvar("pbgun_fireratehigh", "0.16"); fire_rate_medium = register_cvar("pbgun_fireratemedium", "0.7"); jam_prob_low = register_cvar("pbgun_jamproblow", "30"); jam_prob_high = register_cvar("pbgun_jamprobhigh", "100"); gravity = register_cvar("pbgun_gravity", "1"); speed_marker = register_cvar("pbgun_velocity_marker", "2000"); speed_smarker = register_cvar("pbgun_velocity_super_marker", "2500"); speed_pistol = register_cvar("pbgun_velocity_pistol", "1500"); speed_launcher = register_cvar("pbgun_velocity_launcher", "1500"); speed_shotgun = register_cvar("pbgun_velocity_shotgun", "1500"); speed_sniper = register_cvar("pbgun_velocity_sniper", "4000"); dispersion = register_cvar("pbgun_dispersion", "100"); removecrosshair = register_cvar("pbgun_nocrosshair", "1"); pellets_real = register_cvar("pbgun_real_pellets", "1"); pbslauncher = register_cvar("pbgun_pbslauncher", "1"); precache_model(g_pbgun_models[3]); precache_model(g_pbgun_models[7]); precache_model("models/v_pbgun1.mdl"); precache_model("models/v_pbgun6.mdl"); precache_model("models/p_pbgun.mdl"); precache_model("models/p_pbgun1.mdl"); precache_model("models/w_pbgun.mdl"); precache_model("models/v_pb_sniper.mdl"); precache_model("models/p_pb_sniper.mdl"); precache_model("models/w_pb_sniper.mdl"); precache_model("models/v_pb_shotgun.mdl"); precache_model("models/p_pb_shotgun.mdl"); precache_model("models/w_pb_shotgun.mdl"); precache_model("models/v_pb_launcher.mdl"); precache_model("models/w_pb_launcher.mdl"); precache_model("models/p_pb_launcher.mdl"); precache_model("models/w_pb_launch_he.mdl"); precache_model("models/p_pb_knife.mdl"); precache_model("models/v_pb_knife.mdl"); precache_model("models/v_pb_superlauncher.mdl"); precache_model("models/w_pb_supernade.mdl"); blood1 = precache_model("sprites/blood.spr"); blood2 = precache_model("sprites/bloodspray.spr"); precache_model("models/v_pbusp.mdl"); precache_model("models/p_pbusp.mdl"); precache_model("models/v_pbglock.mdl"); precache_model("models/p_pbglock.mdl"); precache_sound("misc/pb1.wav"); precache_sound("misc/pb2.wav"); precache_sound("misc/pb3.wav"); precache_sound("misc/pb4.wav"); precache_sound("misc/pbg.wav"); precache_sound("misc/pb_launcher.wav"); precache_model("models/w_paintball.mdl"); precache_model("sprites/paintball.spr"); precache_sound("weapons/scout_fire-1.wav"); precache_sound("weapons/dryfire_pistol.wav"); precache_sound("weapons/scout_bolt.wav"); precache_sound("weapons/draw.wav"); precache_sound("weapons/insert.wav"); precache_sound("weapons/magin.wav"); precache_sound("weapons/magout.wav"); precache_sound("weapons/magrel.wav"); precache_sound("weapons/pullout.wav"); precache_sound("weapons/roll.wav"); } beamspr = precache_model("sprites/laserbeam.spr"); } public ent_info(id) client_print(id, print_chat, "[AMXX] [Ent Info (Current/Max)] Paintballs: (%d/%d) Entities: (%d/%d)", g_pbcount, get_pcvar_num(shots), engfunc(EngFunc_NumberOfEntities), global_get(glb_maxEntities)); public ev_curweapon(id) { //replace the weapon model with the PB model new model[25]; pev(id, pev_viewmodel2, model, 24); if (equali(model, "models/v_mp5.mdl") && get_pcvar_num(pbgun)) { set_pev(id, pev_viewmodel2, (get_user_team(id) == 1) ? g_pbgun_models[3] : g_pbgun_models[7]); set_pev(id, pev_weaponmodel2, "models/p_pbgun1.mdl"); } else if (equali(model, "models/v_usp.mdl") && get_pcvar_num(pbgun)) { set_pev(id, pev_viewmodel2, "models/v_pbusp.mdl"); set_pev(id, pev_weaponmodel2, "models/p_pbusp.mdl"); } else if (equali(model, "models/v_glock18.mdl") && get_pcvar_num(pbgun)) { set_pev(id, pev_viewmodel2, "models/v_pbglock.mdl"); set_pev(id, pev_weaponmodel2, "models/p_pbglock.mdl"); }else if (equali(model, "models/v_scout.mdl") && get_pcvar_num(pbgun)) { set_pev(id, pev_viewmodel2, "models/v_pb_sniper.mdl"); set_pev(id, pev_weaponmodel2, "models/p_pb_sniper.mdl"); }else if (equali(model, "models/v_m3.mdl") && get_pcvar_num(pbgun)) { set_pev(id, pev_viewmodel2, "models/v_pb_launcher.mdl"); set_pev(id, pev_weaponmodel2, "models/p_pb_launcher.mdl"); }else if (equali(model, "models/v_knife.mdl") && get_pcvar_num(pbgun)) { set_pev(id, pev_viewmodel2, "models/v_pb_knife.mdl"); set_pev(id, pev_weaponmodel2, "models/p_pb_knife.mdl"); }else if (equali(model, "models/v_p90.mdl") && get_pcvar_num(pbgun)) { set_pev(id, pev_viewmodel2, (get_user_team(id) == 1) ? "models/v_pbgun1.mdl" : "models/v_pbgun6.mdl" ); set_pev(id, pev_weaponmodel2, "models/p_pbgun1.mdl"); }else if (equali(model, "models/v_xm1014.mdl") && get_pcvar_num(pbgun)) { set_pev(id, pev_viewmodel2, "models/v_pb_shotgun.mdl"); set_pev(id, pev_weaponmodel2, "models/p_pb_shotgun.mdl"); }else if (equali(model, "models/v_flashbang.mdl") && get_pcvar_num(pbgun) && get_pcvar_num(pbslauncher)) { set_pev(id, pev_viewmodel2, "models/v_pb_superlauncher.mdl"); set_pev(id, pev_weaponmodel2, "models/p_pb_shotgun.mdl"); } new my_pbgun = user_has_pbgun(id); if (my_pbgun){ if (get_pcvar_num(removecrosshair)) { //Remove the crosshair message_begin( MSG_ONE_UNRELIABLE, g_msgHideWeapon, _, id ); write_byte( CROSSHAIR_REMOVED ); message_end(); } } } public fw_setmodel(ent, model[]) { //replace dropped models with PB models if (equali(model, "models/w_mp5.mdl") || equali(model, "models/w_p90.mdl")) if (get_pcvar_num(pbgun)) { engfunc(EngFunc_SetModel, ent, "models/w_pbgun.mdl"); return FMRES_SUPERCEDE; } if (equali(model, "models/w_scout.mdl")) if (get_pcvar_num(pbgun)) { engfunc(EngFunc_SetModel, ent, "models/w_pb_sniper.mdl"); return FMRES_SUPERCEDE; } if (equali(model, "models/w_m3.mdl")) if (get_pcvar_num(pbgun)) { engfunc(EngFunc_SetModel, ent, "models/w_pb_launcher.mdl"); return FMRES_SUPERCEDE; } if (equali(model, "models/w_xm1014.mdl")) if (get_pcvar_num(pbgun)) { engfunc(EngFunc_SetModel, ent, "models/w_pb_shotgun.mdl"); return FMRES_SUPERCEDE; } if (equali(model, "models/w_flashbang.mdl") && get_pcvar_num(pbslauncher)) if (get_pcvar_num(pbgun)) { engfunc(EngFunc_SetModel, ent, "models/w_pb_supernade.mdl"); return FMRES_SUPERCEDE; } return FMRES_IGNORED; } public fw_updateclientdata(id, sw, cd_handle) { //this function overrides the client side sounds and stuff if (user_has_pbgun(id) && cd_handle) { set_cd(cd_handle, CD_ID, 1); get_cd(cd_handle, CD_flNextAttack, nextattack[id]); return FMRES_HANDLED; } return FMRES_IGNORED; } public fw_reload(weapon) { new id = pev(weapon, pev_owner) new ammo, null = get_user_weapon(id, ammo, null); new my_pbgun = user_has_pbgun(id) if ((my_pbgun == PB_LAUNCHER && ammo < 8) || (my_pbgun == PB_SHOTGUN && ammo < 7) || (my_pbgun == PB_SNIPER && ammo < 10)) { lastshot[id] = get_gametime(); set_hudmessage(255, 255, 255, -1.0, 0.33, 0, 1.0, 1.0); show_hudmessage(id, "Weapon reloading..."); message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, id); write_byte(3); write_byte(0); message_end(); } } public try_to_jam(id, my_pbgun){ //chance of jamming the current weapon if(get_pcvar_num(jamon) && !g_Jammed[id] && my_pbgun != PB_GLOCK && my_pbgun != PB_USP && !is_user_bot(id)) { new average_usage_jam; switch (my_pbgun) { case PB_MARKER: average_usage_jam = get_pcvar_num(jam_prob_high); case PB_GLOCK: average_usage_jam = get_pcvar_num(jam_prob_high); case PB_USP: average_usage_jam = get_pcvar_num(jam_prob_high); case PB_SNIPER: average_usage_jam = get_pcvar_num(jam_prob_low); case PB_LAUNCHER: average_usage_jam = get_pcvar_num(jam_prob_low); case PB_SHOTGUN: average_usage_jam = get_pcvar_num(jam_prob_low); case PB_SUPERMARKER: average_usage_jam = get_pcvar_num(jam_prob_high) * 2; default: average_usage_jam = get_pcvar_num(jam_prob_high); } new jam = (random(average_usage_jam)==0); if(jam) { emit_sound(id,CHAN_AUTO, "weapons/dryfire_pistol.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); g_Jammed[id] = my_pbgun; } } } public fw_cmdstart( id, uc_handle, random_seed ) { if ( !is_user_alive( id ) ) return FMRES_IGNORED static buttons; buttons = get_uc( uc_handle, UC_Buttons ) new my_pbgun = user_has_pbgun(id); //if jammed, clear the chamber if ( buttons & IN_USE && my_pbgun == g_Jammed[id] && my_pbgun && get_pcvar_num(jamon)) clear_chamber(id); //if he is shooting with a PBGUN if ( buttons & IN_ATTACK && my_pbgun) { //check if weapon is jammed if(g_Jammed[id] == my_pbgun && !is_user_bot(id) && get_pcvar_num(jamon)) { weapon_jam(id, uc_handle); return FMRES_IGNORED; } set_uc (uc_handle, UC_Buttons, buttons & ~IN_ATTACK); new ammo, null = get_user_weapon(id, ammo, null); if (ammo) { new Float:gametime = get_gametime(), Float:g_speed; switch (my_pbgun) { case PB_MARKER: g_speed = get_pcvar_float(fire_rate_high); case PB_GLOCK: g_speed = get_pcvar_float(fire_rate_high); case PB_USP: g_speed = get_pcvar_float(fire_rate_high); case PB_SNIPER: g_speed = get_pcvar_float(fire_rate_low); case PB_LAUNCHER: g_speed = get_pcvar_float(fire_rate_low); case PB_SHOTGUN: g_speed = get_pcvar_float(fire_rate_medium); case PB_SUPERMARKER: g_speed = get_pcvar_float(fire_rate_high)/2.0; default: g_speed = get_pcvar_float(fire_rate_high); } new cangofull = (my_pbgun == PB_MARKER || my_pbgun == PB_LAUNCHER || my_pbgun == PB_SHOTGUN || my_pbgun == PB_SUPERMARKER); //check that the button was not pressed before or that the weapon can go full-auto new auto = !(pev(id, pev_oldbuttons) & IN_ATTACK) || cangofull; //check the fire-rate and freezetime if (gametime-lastshot[id] > g_speed && (is_user_bot(id) || nextattack[id] < 0.0) && !freezetime && auto) { new fired; if (my_pbgun == PB_SHOTGUN) { //shoot 5 pellets for (new a = 0; a < 5; a++) fired = paint_fire(id, a) || fired; } else //shoot 1 pellet fired = paint_fire(id, 0); if (fired) { lastshot[id] = gametime; set_user_clip(id, ammo - 1); //show the animation set_pev(id, pev_punchangle, Float:{-0.5, 0.0, 0.0}); message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, id); write_byte(g_shot_anim[my_pbgun]); write_byte(0); message_end(); //shooting sound if (get_pcvar_num(sound)) if (my_pbgun != PB_SNIPER) if (my_pbgun != PB_LAUNCHER) emit_sound(id, CHAN_AUTO, "misc/pbg.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); else emit_sound(id, CHAN_AUTO, "misc/pb_launcher.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); else emit_sound(id, CHAN_AUTO, "weapons/scout_fire-1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); try_to_jam(id,my_pbgun) } } } return FMRES_IGNORED; } return FMRES_IGNORED } public paint_fire(id, num) { new a, ent; while (a++ < g_pbcount - 1 && !ent) if (g_pbstatus[a] == 0) ent = g_pbstatus[a] = g_paintballs[a]; if (!ent) while (a-- > 1 && !ent) if (g_pbstatus[a] == 2) ent = g_pbstatus[a] = g_paintballs[a]; if (pev_valid(ent) && is_user_alive(id)) { new Float:vangles[3], Float:nvelocity[3], Float:voriginf[3], vorigin[3], clr; set_pev(ent, pev_owner, id); new my_pbgun = user_has_pbgun(id); if (my_pbgun != PB_LAUNCHER) { //create a pellet set_pev(ent, pev_classname, "pbBullet"); engfunc(EngFunc_SetModel, ent, "models/w_paintball.mdl"); if (my_pbgun == PB_SHOTGUN) //make them smaller to avoid creation collisions engfunc(EngFunc_SetSize, ent, Float:{0.0, 0.0, 0.0}, Float:{1.0, 1.0, 1.0}); else engfunc(EngFunc_SetSize, ent, Float:{-1.0, -1.0, -1.0}, Float:{1.0, 1.0, 1.0}); switch (get_pcvar_num(color)) { case 2: clr = (get_user_team(id) == 1) ? 0 : 1; case 3: clr = (get_user_team(id) == 1) ? 4 : 3; case 4: clr = (get_user_team(id) == 1) ? 2 : 5; default: clr = random_num(0, 6); } set_pev(ent, pev_skin, clr); set_pev(ent, pev_gravity, 0.5); }else { //create a nade set_pev(ent, pev_classname, "pbExplosive"); engfunc(EngFunc_SetModel, ent, "models/w_pb_launch_he.mdl"); engfunc(EngFunc_SetSize, ent, Float:{-3.0, -3.0, -3.0}, Float:{3.0, 3.0, 3.0}); set_pev(ent, pev_gravity, 1.0); } get_user_origin(id, vorigin, 1); if (my_pbgun == PB_SHOTGUN) { //avoid creation collisions vorigin[0] += random(5)-2; vorigin[1] += random(5)-2; vorigin[2] += num*5 } IVecFVec(vorigin, voriginf); engfunc(EngFunc_SetOrigin, ent, voriginf); vangles[0] = random_float(-180.0, 180.0); vangles[1] = random_float(-180.0, 180.0); set_pev(ent, pev_angles, vangles); pev(id, pev_v_angle, vangles); set_pev(ent, pev_v_angle, vangles); pev(id, pev_view_ofs, vangles); set_pev(ent, pev_view_ofs, vangles); new veloc; if (get_pcvar_num(gravity)) set_pev(ent, pev_movetype, MOVETYPE_BOUNCE); else set_pev(ent, pev_movetype, MOVETYPE_FLY); set_pev(ent, pev_solid, 2); //Different guns shoot at different speeds switch (my_pbgun) { case PB_MARKER: veloc = get_pcvar_num(speed_marker); case PB_GLOCK: veloc = get_pcvar_num(speed_pistol); case PB_USP: veloc = get_pcvar_num(speed_pistol); case PB_SNIPER: veloc = get_pcvar_num(speed_sniper); case PB_LAUNCHER: veloc = get_pcvar_num(speed_launcher); case PB_SHOTGUN: veloc = get_pcvar_num(speed_shotgun); case PB_SUPERMARKER: veloc = get_pcvar_num(speed_smarker); default: veloc = get_pcvar_num(speed_pistol); } velocity_by_aim(id, veloc, nvelocity); //Fix aim for bots if (is_user_bot(id)) switch (my_pbgun) { case PB_MARKER: nvelocity[2] += (get_pcvar_num(gravity))? 150 : 0; case PB_GLOCK: nvelocity[2] += (get_pcvar_num(gravity))? 200 : 0; case PB_USP: nvelocity[2] += (get_pcvar_num(gravity))? 200 : 0; case PB_SNIPER: nvelocity[2] += (get_pcvar_num(gravity))? 35 : 0; case PB_LAUNCHER: nvelocity[2] += 250; case PB_SHOTGUN: nvelocity[2] += (get_pcvar_num(gravity))? 50 : 0; case PB_SUPERMARKER: nvelocity[2] += (get_pcvar_num(gravity))? 100 : 0; default: nvelocity[2] += (get_pcvar_num(gravity))? 150 : 0; } //Recoil!!! if (cs_get_user_zoom(id)== CS_SET_NO_ZOOM){ //the sniper will shoot terribly bad without a scope new modifier = (my_pbgun != PB_SNIPER)? 1 : 5; new buttons = pev(id, pev_button); if (my_pbgun == PB_SHOTGUN) modifier = 2; else //shoot worse while moving if (buttons & IN_JUMP || buttons & IN_FORWARD || buttons & IN_BACK || buttons & IN_MOVELEFT || buttons & IN_MOVERIGHT) modifier *= 2; new disp = get_pcvar_num(dispersion); nvelocity[0] += (random(disp)-disp/2) * modifier; nvelocity[1] += (random(disp)-disp/2) * modifier; nvelocity[2] += (random(disp)-disp/2) * modifier; } set_pev(ent, pev_velocity, nvelocity); set_pev(ent, pev_effects, pev(ent, pev_effects) & ~EF_NODRAW); //glow set_task(0.1, "paint_glow", ent); if (my_pbgun != PB_LAUNCHER) //make it dissapear after a while set_task(15.0 , "paint_reset", ent+TASK_PB_RESET); else //make it explode if there is no impact set_task(2.0, "time_explode", ent+TASK_PB_RESET); } return ent; } public fw_touch(bullet, ent) { new class[20]; pev(bullet, pev_classname, class, 19); if (!equali(class, "pbBullet")&&!equali(class, "pbHarmlessBullet")&&!equali(class, "pbExplosive")) return FMRES_IGNORED; new owner = pev(bullet, pev_owner); new Float:origin[3], class2[20], is_ent_alive = is_user_alive(ent); pev(ent, pev_classname, class2, 19); pev(bullet, pev_origin, origin); if (equali(class, "pbExplosive")){ //it is a nade new Float:gametime = get_gametime(); //if it hits something after this time, explode if (gametime-lastshot[owner] > 0.5){ act_explode(bullet); set_pev(bullet, pev_velocity, Float:{0.0, 0.0, 0.0}); set_pev(bullet, pev_classname, "pbPaint"); set_pev(bullet, pev_solid, 0); set_pev(bullet, pev_movetype, 0); engfunc(EngFunc_SetModel, bullet, "sprites/paintball.spr"); new a, findpb = 0; while (a++ < g_pbcount && !findpb) if (g_paintballs[a] == bullet) findpb = g_pbstatus[a] = 2; remove_task(bullet); remove_task(bullet+TASK_PB_RESET); paint_reset(bullet+TASK_PB_RESET); return FMRES_HANDLED; } else if (!equali(class2, "pbBullet")&&!equali(class2, "pbHarmlessBullet")&&get_pcvar_num(gravity)){ //make it bounce and loose some velocity new Float:vel[3]; pev(bullet,pev_velocity,vel); vel[0] /= 5.0; vel[1] /= 5.0; vel[2] /= 5.0; set_pev(bullet, pev_velocity, vel); if (!is_ent_alive) //make damage to world stuff ExecuteHam(Ham_TakeDamage, ent, owner, owner, get_pcvar_float(damage), 4098); return FMRES_IGNORED; } } //The bullet hits or bounces new hit; hit = random(5); if (is_ent_alive) //make damage { if (owner == ent || pev(ent, pev_takedamage) == DAMAGE_NO) return FMRES_IGNORED; if (get_user_team(owner) == get_user_team(ent)) if (!get_pcvar_num(friendlyfire)) return FMRES_IGNORED; if (hit != 0 && !equali(class, "pbHarmlessBullet")) ExecuteHam(Ham_TakeDamage, ent, owner, owner, get_pcvar_float(damage), 4098); } if (!equali(class2, "pbBullet")&&!equali(class2, "pbHarmlessBullet")) if (hit != 0 || !get_pcvar_num(pellets_real)) { //stop the pellet and make a splat set_pev(bullet, pev_velocity, Float:{0.0, 0.0, 0.0}); set_pev(bullet, pev_classname, "pbPaint"); set_pev(bullet, pev_solid, 0); set_pev(bullet, pev_movetype, 0); engfunc(EngFunc_SetModel, bullet, "sprites/paintball.spr"); new a, findpb = 0; while (a++ < g_pbcount && !findpb) if (g_paintballs[a] == bullet) findpb = g_pbstatus[a] = 2; remove_task(bullet); remove_task(bullet+TASK_PB_RESET); if (get_pcvar_num(sound)) { static wav[20]; formatex(wav, 20, is_ent_alive ? "player/pl_pain%d.wav" : "misc/pb%d.wav", is_ent_alive ? random_num(4,7) : random_num(1,4)); emit_sound(bullet, CHAN_AUTO, wav, 1.0, ATTN_NORM, 0, PITCH_NORM); } new bool:valid_surface = (is_ent_alive || containi(class2, "door") != -1) ? false : true; if (pev(ent, pev_health) && !is_ent_alive) { ExecuteHam(Ham_TakeDamage, ent, owner, owner, float(pev(ent, pev_health)), 0); valid_surface = false; } if (valid_surface) { paint_splat(bullet); set_task(float(get_pcvar_num(blife)), "paint_reset", bullet+TASK_PB_RESET); } else paint_reset(bullet+TASK_PB_RESET); return FMRES_HANDLED; }else { //the pellet bounces, reduce its speed if (get_pcvar_num(gravity)){ new Float:vel[3]; pev(bullet,pev_velocity,vel); vel[0] /= 10.0; vel[1] /= 10.0; vel[2] /= 10.0; set_pev(bullet, pev_velocity, vel); } //A bullet that bounces becomes harmless to players set_pev(bullet, pev_classname, "pbHarmlessBullet"); return FMRES_IGNORED; } /*else { paint_reset(bullet+TASK_PB_RESET); return FMRES_HANDLED; } */ return FMRES_IGNORED; } //for the super launcher public fw_think(ent) { new model[35]; pev(ent, pev_model, model, 34); if (!equali(model, "models/w_pb_supernade.mdl")) return FMRES_IGNORED; if(!is_user_alive(pev(ent, pev_owner))) return FMRES_IGNORED; set_task(1.6, "act_superboom", ent); return FMRES_SUPERCEDE; } public act_superboom(ent) { for (new a = 0; a < 10; a++) set_task(0.1 + a*0.2, "launch_nade", ent + TASK_NADE); set_task(2.5, "remove_nade", ent + TASK_NADE); } public remove_nade(ent) { remove_task (ent) ent -= TASK_NADE act_explode(ent); engfunc(EngFunc_RemoveEntity, ent); } public launch_nade(param) { new spawnent = param - TASK_NADE new a, ent; while (a++ < g_pbcount - 1 && !ent) if (g_pbstatus[a] == 0) ent = g_pbstatus[a] = g_paintballs[a]; if (!ent) while (a-- > 1 && !ent) if (g_pbstatus[a] == 2) ent = g_pbstatus[a] = g_paintballs[a]; if (pev_valid(ent)&&pev_valid(spawnent)) { new Float:nvelocity[3], vorigin[3]; set_pev(ent, pev_owner, pev(spawnent, pev_owner)); //create a nade set_pev(ent, pev_classname, "pbExplosive"); engfunc(EngFunc_SetModel, ent, "models/w_pb_launch_he.mdl"); engfunc(EngFunc_SetSize, ent, Float:{-3.0, -3.0, -3.0}, Float:{3.0, 3.0, 3.0}); set_pev(ent, pev_gravity, 1.0); pev(spawnent,pev_origin, vorigin) vorigin[2] += 30 set_pev(ent, pev_origin, vorigin) //IVecFVec(vorigin, voriginf); //engfunc(EngFunc_SetOrigin, ent, vorigin); set_pev(ent, pev_movetype, MOVETYPE_BOUNCE); set_pev(ent, pev_solid, 2); nvelocity[0] = random_float(-200.0, 200.0); nvelocity[1] = random_float(-200.0, 200.0); nvelocity[2] = 500.0; set_pev(ent, pev_velocity, nvelocity); set_pev(ent, pev_effects, pev(ent, pev_effects) & ~EF_NODRAW); set_task(2.0, "time_explode", ent+TASK_PB_RESET); } return ent; } public act_explode(ent) { new origin[3], Float:forigin[3], colors[4], owner = pev(ent, pev_owner), user_team = get_user_team(owner); colors = (user_team == 1) ? { 255, 0, 247, 70} : { 0, 255, 208, 30}; pev(ent, pev_origin, forigin); FVecIVec(forigin, origin); new id, Float:distance = 150.0, Float:porigin[3]; new MaxPlayers = get_maxplayers(); message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_BLOODSPRITE); write_coord(origin[0]); write_coord(origin[1]); write_coord(origin[2] + 20); write_short(blood2); write_short(blood1); write_byte(colors[2]); write_byte(30); message_end(); while (id++ < MaxPlayers) if (is_user_alive(id)) { pev(id, pev_origin, porigin); if (get_distance_f(forigin, porigin) <= distance) if (fm_is_visible(ent, id)) ExecuteHam(Ham_TakeDamage, id, owner, owner, (user_team != get_user_team(id)) ? 100.0 : 300.0, 4098); } emit_sound(ent, CHAN_AUTO, "weapons/sg_explode.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); set_pev(ent, pev_classname, "pbHarmlessBullet"); } stock bool:fm_is_visible(ent, target) { if (pev_valid(ent) && pev_valid(target)) { new Float:start[3], Float:view_ofs[3], Float:point[3]; pev(ent, pev_origin, start); pev(ent, pev_view_ofs, view_ofs); pev(target, pev_origin, point); start[0] += view_ofs[0]; start[1] += view_ofs[1]; start[2] += view_ofs[2]; engfunc(EngFunc_TraceLine, start, point, 1, ent, 0); new Float:fraction; get_tr2(0, TR_flFraction, fraction); if (fraction == 1.0) return true; } return false; } public paint_splat(ent) { new Float:origin[3], Float:norigin[3], Float:viewofs[3], Float:angles[3], Float:normal[3], Float:aiming[3]; pev(ent, pev_origin, origin); pev(ent, pev_view_ofs, viewofs); pev(ent, pev_v_angle, angles); norigin[0] = origin[0] + viewofs[0]; norigin[1] = origin[1] + viewofs[1]; norigin[2] = origin[2] + viewofs[2]; aiming[0] = norigin[0] + floatcos(angles[1], degrees) * 1000.0; aiming[1] = norigin[1] + floatsin(angles[1], degrees) * 1000.0; aiming[2] = norigin[2] + floatsin(-angles[0], degrees) * 1000.0; new tr = 0 engfunc(EngFunc_TraceLine, norigin, aiming, 0, ent, tr); //get_tr2(tr, TR_vecPlaneNormal, normal); //EngFunc_TraceHull,(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr); //engfunc(EngFunc_TraceHull, norigin, aiming, 0, HULL_LARGE, ent, tr) get_tr2(tr, TR_vecPlaneNormal, normal) vector_to_angle(normal, angles); angles[1] += 180.0; if (angles[1] >= 360.0) angles[1] -= 360.0; set_pev(ent, pev_angles, angles); set_pev(ent, pev_v_angle, angles); origin[0] += (normal[0] * random_float(0.3, 2.7)); origin[1] += (normal[1] * random_float(0.3, 2.7)); origin[2] += (normal[2] * random_float(0.3, 2.7)); engfunc(EngFunc_SetOrigin, ent, origin); set_pev(ent, pev_frame, float(random_num( (pev(ent, pev_skin) * 18), (pev(ent, pev_skin) * 18) + 17 ) )); if (pev(ent, pev_renderfx) != kRenderFxNone) set_rendering(ent); } public paint_glow(ent) { if (pev_valid(ent)) { static pbglow[5], clr[3]; get_pcvar_string(bglow, pbglow, 4); switch (get_pcvar_num(color)) { case 2: clr = (get_user_team(pev(ent, pev_owner))==1) ? {255, 0, 0} : {0, 0, 255}; default: clr = {255, 255, 255}; } if (read_flags(pbglow) & (1 << 0)) set_rendering(ent, kRenderFxGlowShell, clr[0], clr[1], clr[2], kRenderNormal, 255); if (read_flags(pbglow) & (1 << 1)) { message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(TE_BEAMFOLLOW); write_short(ent); write_short(beamspr); write_byte(4); write_byte(2); write_byte(clr[0]); write_byte(clr[1]); write_byte(clr[2]); write_byte(255); message_end(); } } } public paint_reset(ent) { remove_task(ent); ent -= TASK_PB_RESET; new a, findpb = 1; while (a++ <= g_pbcount && findpb) if (g_paintballs[a] == ent) findpb = g_pbstatus[a] = 0; set_pev(ent, pev_effects, pev(ent, pev_effects) | EF_NODRAW); engfunc(EngFunc_SetSize, ent, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0}); set_pev(ent, pev_velocity, Float:{0.0, 0.0, 0.0}); engfunc(EngFunc_SetOrigin, ent, Float:{-2000.0, -2000.0, -2000.0}); if (pev(ent, pev_renderfx) != kRenderFxNone) set_rendering(ent); } public time_explode(ent) { remove_task(ent); ent -= TASK_PB_RESET; if (!pev_valid(ent)) return; act_explode(ent); set_pev(ent, pev_velocity, Float:{0.0, 0.0, 0.0}); set_pev(ent, pev_classname, "pbPaint"); set_pev(ent, pev_solid, 0); set_pev(ent, pev_movetype, 0); engfunc(EngFunc_SetModel, ent, "sprites/paintball.spr"); new a, findpb = 0; while (a++ < g_pbcount && !findpb) if (g_paintballs[a] == ent) findpb = g_pbstatus[a] = 2; remove_task(ent); paint_reset(ent+TASK_PB_RESET); } public ev_roundstart() { for (new a = 1; a <= g_pbcount; a++) if (g_pbstatus[a] != 0) paint_reset(g_paintballs[a]+TASK_PB_RESET); if (freezetime) freezetime = 0; } public ev_freezetime() freezetime = 1; stock user_has_pbgun(id) { new retval; if (is_user_alive(id)) { switch(get_user_weapon(id)) { case CSW_MP5NAVY: retval = PB_MARKER; case CSW_USP: retval = PB_USP; case CSW_GLOCK18: retval = PB_GLOCK; case CSW_SCOUT: retval = PB_SNIPER; case CSW_M3: retval = PB_LAUNCHER; case CSW_XM1014: retval = PB_SHOTGUN; case CSW_P90: retval = PB_SUPERMARKER; default: retval = 0; } } return retval; } stock set_user_clip(id, ammo) { new weaponname[32], weaponid = -1, weapon = get_user_weapon(id, _, _); get_weaponname(weapon, weaponname, 31); while ((weaponid = engfunc(EngFunc_FindEntityByString, weaponid, "classname", weaponname)) != 0) if (pev(weaponid, pev_owner) == id) { set_pdata_int(weaponid, 51, ammo, 4); return weaponid; } return 0; } // teame06's function stock set_rendering(index, fx=kRenderFxNone, r=0, g=0, b=0, render=kRenderNormal, amount=16) { set_pev(index, pev_renderfx, fx); new Float:RenderColor[3]; RenderColor[0] = float(r); RenderColor[1] = float(g); RenderColor[2] = float(b); set_pev(index, pev_rendercolor, RenderColor); set_pev(index, pev_rendermode, render); set_pev(index, pev_renderamt, float(amount)); } public fwd_TakeDamage ( id, i_Inflictor, i_Attacker, Float:f_Damage, i_DamageBits ) { if (!is_user_alive(i_Attacker)) return PLUGIN_CONTINUE; if ( get_user_weapon(i_Attacker) == CSW_KNIFE && get_pcvar_num(knife_ohk)) { ExecuteHam(Ham_TakeDamage, id, i_Attacker, i_Attacker, 101.0, 4098); } return PLUGIN_CONTINUE; } public weapon_jam(id, uc_handle) { if (get_pcvar_num(jamon)) { // show messages set_hudmessage(255, 255, 255, -1.0, 0.33, 0, 6.0, 12.0) show_hudmessage(id, "Weapon Jammed - Press Use To Clear") // block the attack button static buttons; buttons = get_uc( uc_handle, UC_Buttons ) set_uc (uc_handle, UC_Buttons, buttons & ~IN_ATTACK); } } public clear_chamber(id) { if (get_pcvar_num(jamon)) { g_Jammed[id] = false; emit_sound(id,CHAN_AUTO,"weapons/scout_bolt.wav",1.0,ATTN_NORM,0,PITCH_NORM); // show messages set_hudmessage(255, 255, 255, -1.0, 0.3, 0, 3.0, 12.0); show_hudmessage(id, "Chamber Clear"); } } public make_solid(ent) { remove_task(ent); ent -= TASK_PB_RESET; if (!pev_valid(ent)) return; set_pev(ent, pev_solid, 2); if (get_pcvar_num(gravity)) set_pev(ent, pev_movetype, MOVETYPE_BOUNCE); } stock is_rpaintball_active() { if(!cvar_exists("amx_pbmod")) { log_amx("Cvar: ^"amx_pbmod^" does not exist.") return 0 } return get_cvar_num("amx_pbmod") } /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{ rtf1 ansi deff0{ fonttbl{ f0 fnil Tahoma;}}n viewkind4 uc1 pard lang11274 f0 fs16 n par } */
Dodanych wklejek: 4031
Powered By (Pav32) Pastebin © 2011