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 1f4kwr8ohfom5 dodana przez Extr3m, 28.01.2014 19:40
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.
/* AMX Mod X * Players Menu Plugin * * by the AMX Mod X Development Team * originally developed by OLO * * This file is part of AMX Mod X. * * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, the author gives permission to * link the code of this program with the Half-Life Game Engine ("HL * Engine") and Modified Game Libraries ("MODs") developed by Valve, * L.L.C ("Valve"). You must obey the GNU General Public License in all * respects for all of the code used other than the HL Engine and MODs * from Valve. If you modify this file, you may extend this exception * to your version of the file, but you are not obligated to do so. If * you do not wish to do so, delete this exception statement from your * version. */ #include <amxmodx> #include <amxmisc> /** skip autoloading since it's optional */ #define AMXMODX_NOAUTOLOAD #include <cstrike> new g_menuPosition[33] new g_menuPlayers[33][32] new g_menuPlayersNum[33] new g_menuOption[33] new g_menuSettings[33] new g_menuSelect[33][64] new g_menuSelectNum[33] #define MAX_CLCMDS 24 new g_clcmdName[MAX_CLCMDS][32] new g_clcmdCmd[MAX_CLCMDS][64] new g_clcmdMisc[MAX_CLCMDS][2] new g_clcmdNum new g_coloredMenus new g_cstrike = 0 new Array:g_bantimes; new Array:g_slapsettings; new g_CSTeamNames[3][] = { "TERRORIST", "CT", "SPECTATOR" } new g_CSTeamNumbers[3][] = { "1", "2", "6" } new g_CSTeamiNumbers[3] = { 1, 2, 6 } public plugin_natives() { set_module_filter("module_filter") set_native_filter("native_filter") } public plugin_init() { register_plugin("Players Menu", AMXX_VERSION_STR, "AMXX Dev Team") register_dictionary("common.txt") register_dictionary("admincmd.txt") register_dictionary("plmenu.txt") register_clcmd("amx_kickmenu", "cmdKickMenu", ADMIN_KICK, "- displays kick menu") register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN, "- displays ban menu") register_clcmd("amx_slapmenu", "cmdSlapMenu", ADMIN_SLAY, "- displays slap/slay menu") register_clcmd("amx_teammenu", "cmdTeamMenu", ADMIN_LEVEL_A, "- displays team menu") register_clcmd("amx_clcmdmenu", "cmdClcmdMenu", ADMIN_LEVEL_A, "- displays client cmds menu") register_menucmd(register_menuid("Ban Menu"), 1023, "actionBanMenu") register_menucmd(register_menuid("Kick Menu"), 1023, "actionKickMenu") register_menucmd(register_menuid("Slap/Slay Menu"), 1023, "actionSlapMenu") register_menucmd(register_menuid("Team Menu"), 1023, "actionTeamMenu") register_menucmd(register_menuid("Client Cmds Menu"), 1023, "actionClcmdMenu") g_bantimes = ArrayCreate(); // Load up the old default values ArrayPushCell(g_bantimes, 0); ArrayPushCell(g_bantimes, 5); ArrayPushCell(g_bantimes, 10); ArrayPushCell(g_bantimes, 15); ArrayPushCell(g_bantimes, 30); ArrayPushCell(g_bantimes, 45); ArrayPushCell(g_bantimes, 60); g_slapsettings = ArrayCreate(); // Old default values ArrayPushCell(g_slapsettings, 0); // First option is ignored - it is slay ArrayPushCell(g_slapsettings, 0); // slap 0 damage ArrayPushCell(g_slapsettings, 1); ArrayPushCell(g_slapsettings, 5); register_srvcmd("amx_plmenu_bantimes", "plmenu_setbantimes"); register_srvcmd("amx_plmenu_slapdmg", "plmenu_setslapdmg"); g_coloredMenus = colored_menus() new clcmds_ini_file[64] get_configsdir(clcmds_ini_file, 63) format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file) load_settings(clcmds_ini_file) if (module_exists("cstrike")) g_cstrike = 1 } public plmenu_setbantimes() { new buff[32]; new args = read_argc(); if (args <= 1) { server_print("usage: amx_plmenu_bantimes <time1> [time2] [time3] ..."); server_print(" use time of 0 for permanent."); return; } ArrayClear(g_bantimes); for (new i = 1; i < args; i++) { read_argv(i, buff, charsmax(buff)); ArrayPushCell(g_bantimes, str_to_num(buff)); } } public plmenu_setslapdmg() { new buff[32]; new args = read_argc(); if (args <= 1) { server_print("usage: amx_plmenu_slapdmg <dmg1> [dmg2] [dmg3] ..."); server_print(" slay is automatically set for the first value."); return; } ArrayClear(g_slapsettings); ArrayPushCell(g_slapsettings, 0); // compensate for slay for (new i = 1; i < args; i++) { read_argv(i, buff, charsmax(buff)); ArrayPushCell(g_slapsettings, str_to_num(buff)); } } public module_filter(const module[]) { if (equali(module, "cstrike")) return PLUGIN_HANDLED return PLUGIN_CONTINUE } public native_filter(const name[], index, trap) { if (!trap) return PLUGIN_HANDLED return PLUGIN_CONTINUE } /* Ban menu */ public actionBanMenu(id, key) { switch (key) { case 7: { /* BEGIN OF CHANGES BY MISTAGEE ADDED A FEW MORE OPTIONS */ ++g_menuOption[id] g_menuOption[id] %= ArraySize(g_bantimes); g_menuSettings[id] = ArrayGetCell(g_bantimes, g_menuOption[id]); displayBanMenu(id, g_menuPosition[id]) } case 8: displayBanMenu(id, ++g_menuPosition[id]) case 9: displayBanMenu(id, --g_menuPosition[id]) default: { new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] new name[32], name2[32], authid[32], authid2[32] get_user_name(player, name2, 31) get_user_authid(id, authid, 31) get_user_authid(player, authid2, 31) get_user_name(id, name, 31) new userid2 = get_user_userid(player) log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")", name, get_user_userid(id), authid, name2, userid2, authid2, g_menuSettings[id]) if (g_menuSettings[id]==0) // permanent { new maxpl = get_maxplayers(); for (new i = 1; i <= maxpl; i++) { show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "PERM"); } } else { new tempTime[32]; formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]); new maxpl = get_maxplayers(); for (new i = 1; i <= maxpl; i++) { show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "FOR_MIN", tempTime); } } /* ---------- check for Steam ID added by MistaGee -------------------- IF AUTHID == 4294967295 OR VALVE_ID_LAN OR HLTV, BAN PER IP TO NOT BAN EVERYONE */ if (equal("4294967295", authid2) || equal("HLTV", authid2) || equal("STEAM_ID_LAN", authid2) || equali("VALVE_ID_LAN", authid2)) { /* END OF MODIFICATIONS BY MISTAGEE */ new ipa[32] get_user_ip(player, ipa, 31, 1) server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa) } else { server_cmd("banid %d #%d kick;writeid", g_menuSettings[id], userid2) } server_exec() displayBanMenu(id, g_menuPosition[id]) } } return PLUGIN_HANDLED } displayBanMenu(id, pos) { if (pos < 0) return get_players(g_menuPlayers[id], g_menuPlayersNum[id]) new menuBody[512] new b = 0 new i new name[32] new start = pos * 7 if (start >= g_menuPlayersNum[id]) start = pos = g_menuPosition[id] = 0 new len = format(menuBody, 511, g_coloredMenus ? "y%LR%d/%d^nw^n" : "%L %d/%d^n^n", id, "BAN_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0))) new end = start + 7 new keys = MENU_KEY_0|MENU_KEY_8 if (end > g_menuPlayersNum[id]) end = g_menuPlayersNum[id] for (new a = start; a < end; ++a) { i = g_menuPlayers[id][a] get_user_name(i, name, 31) if (is_user_bot(i) || (access(i, ADMIN_IMMUNITY) && i != id)) { ++b if (g_coloredMenus) len += format(menuBody[len], 511-len, "d%d. %s^nw", b, name) else len += format(menuBody[len], 511-len, "#. %s^n", name) } else { keys |= (1<<b) if (is_user_admin(i)) len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s r*^nw" : "%d. %s *^n", ++b, name) else len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name) } } if (g_menuSettings[id]) len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id]) else len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM") if (end != g_menuPlayersNum[id]) { format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") keys |= MENU_KEY_9 } else format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") show_menu(id, keys, menuBody, -1, "Ban Menu") } public cmdBanMenu(id, level, cid) { if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED g_menuOption[id] = 0 if (ArraySize(g_bantimes) > 0) { g_menuSettings[id] = ArrayGetCell(g_bantimes, g_menuOption[id]); } else { // should never happen, but failsafe g_menuSettings[id] = 0 } displayBanMenu(id, g_menuPosition[id] = 0) return PLUGIN_HANDLED } /* Slap/Slay */ public actionSlapMenu(id, key) { switch (key) { case 7: { ++g_menuOption[id] g_menuOption[id] %= ArraySize(g_slapsettings); g_menuSettings[id] = ArrayGetCell(g_slapsettings, g_menuOption[id]); displaySlapMenu(id, g_menuPosition[id]); } case 8: displaySlapMenu(id, ++g_menuPosition[id]) case 9: displaySlapMenu(id, --g_menuPosition[id]) default: { new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] new name2[32] get_user_name(player, name2, 31) if (!is_user_alive(player)) { client_print(id, print_chat, "%L", id, "CANT_PERF_DEAD", name2) displaySlapMenu(id, g_menuPosition[id]) return PLUGIN_HANDLED } new authid[32], authid2[32], name[32] get_user_authid(id, authid, 31) get_user_authid(player, authid2, 31) get_user_name(id, name, 31) if (g_menuOption[id]) { log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, g_menuSettings[id], name2, get_user_userid(player), authid2) show_activity_key("ADMIN_SLAP_1", "ADMIN_SLAP_2", name, name2, g_menuSettings[id]); } else { log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2) show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", name, name2); } if (g_menuOption[id]) user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0) else user_kill(player) displaySlapMenu(id, g_menuPosition[id]) } } return PLUGIN_HANDLED } displaySlapMenu(id, pos) { if (pos < 0) return get_players(g_menuPlayers[id], g_menuPlayersNum[id]) new menuBody[512] new b = 0 new i new name[32], team[4] new start = pos * 7 if (start >= g_menuPlayersNum[id]) start = pos = g_menuPosition[id] = 0 new len = format(menuBody, 511, g_coloredMenus ? "y%LR%d/%d^nw^n" : "%L %d/%d^n^n", id, "SLAP_SLAY_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0))) new end = start + 7 new keys = MENU_KEY_0|MENU_KEY_8 if (end > g_menuPlayersNum[id]) end = g_menuPlayersNum[id] for (new a = start; a < end; ++a) { i = g_menuPlayers[id][a] get_user_name(i, name, 31) if (g_cstrike) { if (cs_get_user_team(i) == CS_TEAM_T) { copy(team, 3, "TE") } else if (cs_get_user_team(i) == CS_TEAM_CT) { copy(team, 3, "CT") } else { get_user_team(i, team, 3) } } else { get_user_team(i, team, 3) } if (!is_user_alive(i) || (access(i, ADMIN_IMMUNITY) && i != id)) { ++b if (g_coloredMenus) len += format(menuBody[len], 511-len, "d%d. %sR%s^nw", b, name, team) else len += format(menuBody[len], 511-len, "#. %s %s^n", name, team) } else { keys |= (1<<b) if (is_user_admin(i)) len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s r*yR%s^nw" : "%d. %s * %s^n", ++b, name, team) else len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %syR%s^nw" : "%d. %s %s^n", ++b, name, team) } } if (g_menuOption[id]) len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id]) else len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY") if (end != g_menuPlayersNum[id]) { format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") keys |= MENU_KEY_9 } else format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") show_menu(id, keys, menuBody, -1, "Slap/Slay Menu") } public cmdSlapMenu(id, level, cid) { if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED g_menuOption[id] = 0 if (ArraySize(g_slapsettings) > 0) { g_menuSettings[id] = ArrayGetCell(g_slapsettings, g_menuOption[id]); } else { // should never happen, but failsafe g_menuSettings[id] = 0 } displaySlapMenu(id, g_menuPosition[id] = 0) return PLUGIN_HANDLED } /* Kick */ public actionKickMenu(id, key) { switch (key) { case 8: displayKickMenu(id, ++g_menuPosition[id]) case 9: displayKickMenu(id, --g_menuPosition[id]) default: { new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key] new authid[32], authid2[32], name[32], name2[32] get_user_authid(id, authid, 31) get_user_authid(player, authid2, 31) get_user_name(id, name, 31) get_user_name(player, name2, 31) new userid2 = get_user_userid(player) log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, userid2, authid2) show_activity_key("ADMIN_KICK_1", "ADMIN_KICK_2", name, name2); server_cmd("kick #%d", userid2) server_exec() displayKickMenu(id, g_menuPosition[id]) } } return PLUGIN_HANDLED } displayKickMenu(id, pos) { if (pos < 0) return get_players(g_menuPlayers[id], g_menuPlayersNum[id]) new menuBody[512] new b = 0 new i new name[32] new start = pos * 8 if (start >= g_menuPlayersNum[id]) start = pos = g_menuPosition[id] = 0 new len = format(menuBody, 511, g_coloredMenus ? "y%LR%d/%d^nw^n" : "%L %d/%d^n^n", id, "KICK_MENU", pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0))) new end = start + 8 new keys = MENU_KEY_0 if (end > g_menuPlayersNum[id]) end = g_menuPlayersNum[id] for (new a = start; a < end; ++a) { i = g_menuPlayers[id][a] get_user_name(i, name, 31) if (access(i, ADMIN_IMMUNITY) && i != id) { ++b if (g_coloredMenus) len += format(menuBody[len], 511-len, "d%d. %s^nw", b, name) else len += format(menuBody[len], 511-len, "#. %s^n", name) } else { keys |= (1<<b) if (is_user_admin(i)) len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s r*^nw" : "%d. %s *^n", ++b, name) else len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name) } } if (end != g_menuPlayersNum[id]) { format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") keys |= MENU_KEY_9 } else format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") show_menu(id, keys, menuBody, -1, "Kick Menu") } public cmdKickMenu(id, level, cid) { if (cmd_access(id, level, cid, 1)) displayKickMenu(id, g_menuPosition[id] = 0) return PLUGIN_HANDLED } /* Team menu */ public actionTeamMenu(id, key) { switch (key) { case 7: { g_menuOption[id] = (g_menuOption[id] + 1) % (g_cstrike ? 3 : 2); displayTeamMenu(id, g_menuPosition[id]) } case 8: displayTeamMenu(id, ++g_menuPosition[id]) case 9: displayTeamMenu(id, --g_menuPosition[id]) default: { new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] new authid[32], authid2[32], name[32], name2[32] get_user_name(player, name2, 31) get_user_authid(id, authid, 31) get_user_authid(player, authid2, 31) get_user_name(id, name, 31) log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2, g_menuOption[id] ? "TERRORIST" : "CT") show_activity_key("ADMIN_TRANSF_1", "ADMIN_TRANSF_2", name, name2, g_CSTeamNames[g_menuOption[id] % 3]); if (g_cstrike) { if (is_user_alive(player)) { new deaths = cs_get_user_deaths(player) user_kill(player, 1) cs_set_user_deaths(player, deaths) } // This modulo math just aligns the option to the CsTeams-corresponding number cs_set_user_team(player, (g_menuOption[id] % 3) + 1) cs_reset_user_model(player) } else { new limit_setting = get_cvar_num("mp_limitteams") set_cvar_num("mp_limitteams", 0) engclient_cmd(player, "jointeam", g_CSTeamNumbers[g_menuOption[id] % 2]) engclient_cmd(player, "joinclass", "1") set_cvar_num("mp_limitteams", limit_setting) } displayTeamMenu(id, g_menuPosition[id]) } } return PLUGIN_HANDLED } displayTeamMenu(id, pos) { if (pos < 0) return get_players(g_menuPlayers[id], g_menuPlayersNum[id]) new menuBody[512] new b = 0 new i, iteam new name[32], team[4] new start = pos * 7 if (start >= g_menuPlayersNum[id]) start = pos = g_menuPosition[id] = 0 new len = format(menuBody, 511, g_coloredMenus ? "y%LR%d/%d^nw^n" : "%L %d/%d^n^n", id, "TEAM_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0))) new end = start + 7 new keys = MENU_KEY_0|MENU_KEY_8 if (end > g_menuPlayersNum[id]) end = g_menuPlayersNum[id] for (new a = start; a < end; ++a) { i = g_menuPlayers[id][a] get_user_name(i, name, 31) if (g_cstrike) { iteam = _:cs_get_user_team(i) if (iteam == 1) { copy(team, 3, "TE") } else if (iteam == 2) { copy(team, 3, "CT") } else if (iteam == 3) { copy(team, 3, "SPE"); iteam = 6; } else { iteam = get_user_team(i, team, 3) } } else { iteam = get_user_team(i, team, 3) } if ((iteam == g_CSTeamiNumbers[g_menuOption[id] % (g_cstrike ? 3 : 2)]) || (access(i, ADMIN_IMMUNITY) && i != id)) { ++b if (g_coloredMenus) len += format(menuBody[len], 511-len, "d%d. %sR%s^nw", b, name, team) else len += format(menuBody[len], 511-len, "#. %s %s^n", name, team) } else { keys |= (1<<b) if (is_user_admin(i)) len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s r*yR%s^nw" : "%d. %s * %s^n", ++b, name, team) else len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %syR%s^nw" : "%d. %s %s^n", ++b, name, team) } } len += format(menuBody[len], 511-len, "^n8. %L^n", id, "TRANSF_TO", g_CSTeamNames[g_menuOption[id] % (g_cstrike ? 3 : 2)]) if (end != g_menuPlayersNum[id]) { format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") keys |= MENU_KEY_9 } else format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") show_menu(id, keys, menuBody, -1, "Team Menu") } public cmdTeamMenu(id, level, cid) { if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED g_menuOption[id] = 0 displayTeamMenu(id, g_menuPosition[id] = 0) return PLUGIN_HANDLED } /* Client cmds menu */ public actionClcmdMenu(id, key) { switch (key) { case 7: { ++g_menuOption[id] g_menuOption[id] %= g_menuSelectNum[id] displayClcmdMenu(id, g_menuPosition[id]) } case 8: displayClcmdMenu(id, ++g_menuPosition[id]) case 9: displayClcmdMenu(id, --g_menuPosition[id]) default: { new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] new flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1] if (is_user_connected(player)) { new command[512], authid[32], name[32], userid[32] copy(command, charsmax(command), g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]]) get_user_authid(player, authid, 31) get_user_name(player, name, 31) num_to_str(get_user_userid(player), userid, 31) replace(command, charsmax(command), "%userid%", userid) replace(command, charsmax(command), "%authid%", authid) replace(command, charsmax(command), "%name%", name) if (flags & 1) { server_cmd("%s", command) server_exec() } else if (flags & 2) client_cmd(id, "%s", command) else if (flags & 4) client_cmd(player, "%s", command) } if (flags & 8) displayClcmdMenu(id, g_menuPosition[id]) } } return PLUGIN_HANDLED } displayClcmdMenu(id, pos) { if (pos < 0) return get_players(g_menuPlayers[id], g_menuPlayersNum[id]) new menuBody[512] new b = 0 new i new name[32] new start = pos * 7 if (start >= g_menuPlayersNum[id]) start = pos = g_menuPosition[id] = 0 new len = format(menuBody, 511, g_coloredMenus ? "y%LR%d/%d^nw^n" : "%L %d/%d^n^n", id, "CL_CMD_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0))) new end = start + 7 new keys = MENU_KEY_0|MENU_KEY_8 if (end > g_menuPlayersNum[id]) end = g_menuPlayersNum[id] for (new a = start; a < end; ++a) { i = g_menuPlayers[id][a] get_user_name(i, name, 31) if (!g_menuSelectNum[id] || (access(i, ADMIN_IMMUNITY) && i != id)) { ++b if (g_coloredMenus) len += format(menuBody[len], 511-len, "d%d. %s^nw", b, name) else len += format(menuBody[len], 511-len, "#. %s^n", name) } else { keys |= (1<<b) if (is_user_admin(i)) len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s r*^nw" : "%d. %s *^n", ++b, name) else len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name) } } if (g_menuSelectNum[id]) len += format(menuBody[len], 511-len, "^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]]) else len += format(menuBody[len], 511-len, "^n8. %L^n", id, "NO_CMDS") if (end != g_menuPlayersNum[id]) { format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") keys |= MENU_KEY_9 } else format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") show_menu(id, keys, menuBody, -1, "Client Cmds Menu") } public cmdClcmdMenu(id, level, cid) { if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED g_menuSelectNum[id] = 0 for (new a = 0; a < g_clcmdNum; ++a) if (access(id, g_clcmdMisc[a][0])) g_menuSelect[id][g_menuSelectNum[id]++] = a g_menuOption[id] = 0 displayClcmdMenu(id, g_menuPosition[id] = 0) return PLUGIN_HANDLED } load_settings(szFilename[]) { if (!file_exists(szFilename)) return 0 new text[256], szFlags[32], szAccess[32] new a, pos = 0 while (g_clcmdNum < MAX_CLCMDS && read_file(szFilename, pos++, text, 255, a)) { if (text[0] == ';') continue if (parse(text, g_clcmdName[g_clcmdNum], 31, g_clcmdCmd[g_clcmdNum], 63, szFlags, 31, szAccess, 31) > 3) { while (replace(g_clcmdCmd[g_clcmdNum], 63, "'", "^"")) { // do nothing } g_clcmdMisc[g_clcmdNum][1] = read_flags(szFlags) g_clcmdMisc[g_clcmdNum][0] = read_flags(szAccess) g_clcmdNum++ } } return 1 }
Dodanych wklejek: 11179
Powered By (Pav32) Pastebin © 2011