hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.08.05. 22:01



Jelenlévő felhasználók

Jelenleg 395 felhasználó van jelen :: 2 regisztrált, 0 rejtett és 393 vendég

A legtöbb felhasználó (2883 fő) 2025.07.30. 16:00-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot], Google [Bot]az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása Hozzászólás a témához  [3 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: plmenu átírása
HozzászólásElküldve:2014.02.22. 09:04 
Offline
Nagyúr
Avatar

Csatlakozott:2012.09.23. 09:50
Hozzászólások:569
Megköszönt másnak: 76 alkalommal
Megköszönték neki: 37 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. /* AMX Mod X
  2. * Players Menu Plugin
  3. *
  4. * by the AMX Mod X Development Team
  5. * originally developed by OLO
  6. *
  7. * This file is part of AMX Mod X.
  8. *
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at
  13. * your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software Foundation,
  22. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. * In addition, as a special exception, the author gives permission to
  25. * link the code of this program with the Half-Life Game Engine ("HL
  26. * Engine") and Modified Game Libraries ("MODs") developed by Valve,
  27. * L.L.C ("Valve"). You must obey the GNU General Public License in all
  28. * respects for all of the code used other than the HL Engine and MODs
  29. * from Valve. If you modify this file, you may extend this exception
  30. * to your version of the file, but you are not obligated to do so. If
  31. * you do not wish to do so, delete this exception statement from your
  32. * version.
  33. */
  34.  
  35. #include <amxmodx>
  36. #include <amxmisc>
  37.  
  38. /** skip autoloading since it's optional */
  39. #define AMXMODX_NOAUTOLOAD
  40. #include <cstrike>
  41.  
  42. new g_menuPosition[33]
  43. new g_menuPlayers[33][32]
  44. new g_menuPlayersNum[33]
  45. new g_menuOption[33]
  46. new g_menuSettings[33]
  47.  
  48. new g_menuSelect[33][64]
  49. new g_menuSelectNum[33]
  50.  
  51. #define MAX_CLCMDS 24
  52.  
  53. new g_clcmdName[MAX_CLCMDS][32]
  54. new g_clcmdCmd[MAX_CLCMDS][64]
  55. new g_clcmdMisc[MAX_CLCMDS][2]
  56. new g_clcmdNum
  57.  
  58. new g_coloredMenus
  59. new g_cstrike = 0
  60.  
  61. new Array:g_bantimes;
  62. new Array:g_slapsettings;
  63.  
  64. new g_CSTeamNames[3][] = {
  65. "TERRORIST",
  66. "CT",
  67. "SPECTATOR"
  68. }
  69. new g_CSTeamNumbers[3][] = {
  70. "1",
  71. "2",
  72. "6"
  73. }
  74. new g_CSTeamiNumbers[3] = {
  75. 1,
  76. 2,
  77. 6
  78. }
  79.  
  80. new g_ban_player[33];
  81.  
  82.  
  83. public plugin_natives()
  84. {
  85. set_module_filter("module_filter")
  86. set_native_filter("native_filter")
  87. }
  88.  
  89. public plugin_init()
  90. {
  91. register_plugin("Players Menu", AMXX_VERSION_STR, "AMXX Dev Team")
  92. register_dictionary("common.txt")
  93. register_dictionary("admincmd.txt")
  94. register_dictionary("plmenu.txt")
  95.  
  96. register_clcmd("amx_kickmenu", "cmdKickMenu", ADMIN_KICK, "- displays kick menu")
  97. register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN, "- displays ban menu")
  98. register_clcmd("amx_slapmenu", "cmdSlapMenu", ADMIN_SLAY, "- displays slap/slay menu")
  99. register_clcmd("amx_teammenu", "cmdTeamMenu", ADMIN_LEVEL_A, "- displays team menu")
  100. register_clcmd("amx_clcmdmenu", "cmdClcmdMenu", ADMIN_LEVEL_A, "- displays client cmds menu")
  101. register_clcmd("amx_banreason", "CmdBanReason", ADMIN_BAN, "<reason>");
  102.  
  103. register_menucmd(register_menuid("Ban Menu"), 1023, "actionBanMenu")
  104. register_menucmd(register_menuid("Kick Menu"), 1023, "actionKickMenu")
  105. register_menucmd(register_menuid("Slap/Slay Menu"), 1023, "actionSlapMenu")
  106. register_menucmd(register_menuid("Team Menu"), 1023, "actionTeamMenu")
  107. register_menucmd(register_menuid("Client Cmds Menu"), 1023, "actionClcmdMenu")
  108.  
  109.  
  110. g_bantimes = ArrayCreate();
  111. // Load up the old default values
  112. ArrayPushCell(g_bantimes, 0);
  113. ArrayPushCell(g_bantimes, 5);
  114. ArrayPushCell(g_bantimes, 10);
  115. ArrayPushCell(g_bantimes, 15);
  116. ArrayPushCell(g_bantimes, 30);
  117. ArrayPushCell(g_bantimes, 45);
  118. ArrayPushCell(g_bantimes, 60);
  119.  
  120.  
  121. g_slapsettings = ArrayCreate();
  122. // Old default values
  123. ArrayPushCell(g_slapsettings, 0); // First option is ignored - it is slay
  124. ArrayPushCell(g_slapsettings, 0); // slap 0 damage
  125. ArrayPushCell(g_slapsettings, 1);
  126. ArrayPushCell(g_slapsettings, 5);
  127.  
  128.  
  129. register_srvcmd("amx_plmenu_bantimes", "plmenu_setbantimes");
  130. register_srvcmd("amx_plmenu_slapdmg", "plmenu_setslapdmg");
  131.  
  132. g_coloredMenus = colored_menus()
  133.  
  134. new clcmds_ini_file[64]
  135. get_configsdir(clcmds_ini_file, 63)
  136. format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file)
  137. load_settings(clcmds_ini_file)
  138.  
  139. if (module_exists("cstrike"))
  140. g_cstrike = 1
  141. }
  142. public plmenu_setbantimes()
  143. {
  144. new buff[32];
  145. new args = read_argc();
  146.  
  147. if (args <= 1)
  148. {
  149. server_print("usage: amx_plmenu_bantimes <time1> [time2] [time3] ...");
  150. server_print(" use time of 0 for permanent.");
  151.  
  152. return;
  153. }
  154.  
  155. ArrayClear(g_bantimes);
  156.  
  157. for (new i = 1; i < args; i++)
  158. {
  159. read_argv(i, buff, charsmax(buff));
  160.  
  161. ArrayPushCell(g_bantimes, str_to_num(buff));
  162.  
  163. }
  164.  
  165. }
  166. public plmenu_setslapdmg()
  167. {
  168. new buff[32];
  169. new args = read_argc();
  170.  
  171. if (args <= 1)
  172. {
  173. server_print("usage: amx_plmenu_slapdmg <dmg1> [dmg2] [dmg3] ...");
  174. server_print(" slay is automatically set for the first value.");
  175.  
  176. return;
  177. }
  178.  
  179. ArrayClear(g_slapsettings);
  180.  
  181. ArrayPushCell(g_slapsettings, 0); // compensate for slay
  182.  
  183. for (new i = 1; i < args; i++)
  184. {
  185. read_argv(i, buff, charsmax(buff));
  186.  
  187. ArrayPushCell(g_slapsettings, str_to_num(buff));
  188.  
  189. }
  190.  
  191. }
  192. public module_filter(const module[])
  193. {
  194. if (equali(module, "cstrike"))
  195. return PLUGIN_HANDLED
  196.  
  197. return PLUGIN_CONTINUE
  198. }
  199.  
  200. public native_filter(const name[], index, trap)
  201. {
  202. if (!trap)
  203. return PLUGIN_HANDLED
  204.  
  205. return PLUGIN_CONTINUE
  206. }
  207.  
  208. /* Ban menu */
  209.  
  210. public client_disconnect(id)
  211. {
  212. g_ban_player[id] = 0;
  213. }
  214.  
  215. public CmdBanReason(id)
  216. {
  217. new player = g_ban_player[id];
  218.  
  219. if( !player ) return PLUGIN_HANDLED;
  220.  
  221. new reason[128];
  222. read_args(reason, sizeof(reason) - 1);
  223. remove_quotes(reason);
  224.  
  225. new name[32], name2[32], authid[32], authid2[32]
  226.  
  227. get_user_name(player, name2, 31)
  228. get_user_authid(id, authid, 31)
  229. get_user_authid(player, authid2, 31)
  230. get_user_name(id, name, 31)
  231.  
  232. new userid2 = get_user_userid(player)
  233.  
  234. log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, g_menuSettings[id], reason)
  235.  
  236. if ( !equal("STEAM_0:", authid2, 8))
  237. {
  238. client_cmd(id, "amx_banip #%i %i ^"%s^"", userid2, g_menuSettings[id], reason);
  239. }
  240. else
  241. {
  242. client_cmd(id, "amx_ban #%i %i ^"%s^"", userid2, g_menuSettings[id], reason);
  243. }
  244.  
  245. server_exec()
  246.  
  247. g_ban_player[id] = 0;
  248.  
  249. displayBanMenu(id, g_menuPosition[id])
  250.  
  251. return PLUGIN_HANDLED;
  252. }
  253.  
  254. public actionBanMenu(id, key)
  255. {
  256. switch (key)
  257. {
  258. case 7:
  259. {
  260. /* BEGIN OF CHANGES BY MISTAGEE ADDED A FEW MORE OPTIONS */
  261.  
  262. ++g_menuOption[id]
  263. g_menuOption[id] %= ArraySize(g_bantimes);
  264.  
  265. g_menuSettings[id] = ArrayGetCell(g_bantimes, g_menuOption[id]);
  266.  
  267. displayBanMenu(id, g_menuPosition[id])
  268. }
  269. case 8: displayBanMenu(id, ++g_menuPosition[id])
  270. case 9: displayBanMenu(id, --g_menuPosition[id])
  271. default:
  272. {
  273. g_ban_player[id] = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  274.  
  275. client_cmd(id, "messagemode amx_banreason");
  276.  
  277. client_print(id, print_chat, "[AMXX] Type in the reason for banning this player.");
  278.  
  279.  
  280. /*new name[32], name2[32], authid[32], authid2[32]
  281.  
  282. get_user_name(player, name2, 31)
  283. get_user_authid(id, authid, 31)
  284. get_user_authid(player, authid2, 31)
  285. get_user_name(id, name, 31)
  286.  
  287. new userid2 = get_user_userid(player)
  288.  
  289. 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])
  290.  
  291. if (g_menuSettings[id]==0) // permanent
  292. {
  293. new maxpl = get_maxplayers();
  294. for (new i = 1; i <= maxpl; i++)
  295. {
  296. show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "PERM");
  297. }
  298. }
  299. else
  300. {
  301. new tempTime[32];
  302. formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]);
  303. new maxpl = get_maxplayers();
  304. for (new i = 1; i <= maxpl; i++)
  305. {
  306. show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "FOR_MIN", tempTime);
  307. }
  308. }
  309. // ---------- check for Steam ID added by MistaGee --------------------
  310. // IF AUTHID == 4294967295 OR VALVE_ID_LAN OR HLTV, BAN PER IP TO NOT BAN EVERYONE
  311.  
  312. if (equal("4294967295", authid2)
  313. || equal("HLTV", authid2)
  314. || equal("STEAM_ID_LAN", authid2)
  315. || equali("VALVE_ID_LAN", authid2))
  316. {
  317. // END OF MODIFICATIONS BY MISTAGEE
  318. server_cmd("amx_banip #%i %i ^"Banned From Menu^"", userid2, g_menuSettings[id]);
  319. }
  320. else
  321. {
  322. server_cmd("amx_ban #%i %i ^"Banned From Menu^"", userid2, g_menuSettings[id]);
  323. }
  324.  
  325. server_exec()
  326.  
  327. displayBanMenu(id, g_menuPosition[id])*/
  328. }
  329. }
  330.  
  331. return PLUGIN_HANDLED
  332. }
  333.  
  334. displayBanMenu(id, pos)
  335. {
  336. if (pos < 0)
  337. return
  338.  
  339. get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  340.  
  341. new menuBody[512]
  342. new b = 0
  343. new i
  344. new name[32]
  345. new start = pos * 7
  346.  
  347. if (start >= g_menuPlayersNum[id])
  348. start = pos = g_menuPosition[id] = 0
  349.  
  350. new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "BAN_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  351. new end = start + 7
  352. new keys = MENU_KEY_0|MENU_KEY_8
  353.  
  354. if (end > g_menuPlayersNum[id])
  355. end = g_menuPlayersNum[id]
  356.  
  357. for (new a = start; a < end; ++a)
  358. {
  359. i = g_menuPlayers[id][a]
  360. get_user_name(i, name, 31)
  361.  
  362. if (is_user_bot(i) || (access(i, ADMIN_IMMUNITY) && i != id))
  363. {
  364. ++b
  365.  
  366. if (g_coloredMenus)
  367. len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
  368. else
  369. len += format(menuBody[len], 511-len, "#. %s^n", name)
  370. } else {
  371. keys |= (1<<b)
  372.  
  373. if (is_user_admin(i))
  374. len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
  375. else
  376. len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
  377. }
  378. }
  379.  
  380. if (g_menuSettings[id])
  381. {
  382. new banLength[32]
  383. if (timeToString(g_menuSettings[id], banLength, 31))
  384. len += format(menuBody[len], 511-len, "^n8. Ban for %s^n", banLength)
  385. else
  386. len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id])
  387. }
  388. else
  389. len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM")
  390.  
  391. if (end != g_menuPlayersNum[id])
  392. {
  393. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  394. keys |= MENU_KEY_9
  395. }
  396. else
  397. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  398.  
  399. show_menu(id, keys, menuBody, -1, "Ban Menu")
  400. }
  401.  
  402. timeToString(minutes, output[], len)
  403. {
  404. new hours = minutes / 60;
  405. minutes %= 60;
  406.  
  407. new days = hours / 24;
  408. hours %= 24;
  409.  
  410. new ret
  411.  
  412. if (days)
  413. ret += formatex(output[ret], len-ret, "%s%d day%s", ret ? ", " : "", days, (days == 1) ? "" : "s")
  414.  
  415. if (hours)
  416. ret += formatex(output[ret], len-ret, "%s%d hour%s", ret ? ", " : "", hours, (hours == 1) ? "" : "s")
  417.  
  418. if (minutes)
  419. ret += formatex(output[ret], len-ret, "%s%d minute%s", ret ? ", " : "", minutes, (minutes == 1) ? "" : "s")
  420.  
  421. return ret
  422. }
  423.  
  424. public cmdBanMenu(id, level, cid)
  425. {
  426. if (!cmd_access(id, level, cid, 1))
  427. return PLUGIN_HANDLED
  428.  
  429. g_menuOption[id] = 0
  430.  
  431. if (ArraySize(g_bantimes) > 0)
  432. {
  433. g_menuSettings[id] = ArrayGetCell(g_bantimes, g_menuOption[id]);
  434. }
  435. else
  436. {
  437. // should never happen, but failsafe
  438. g_menuSettings[id] = 0
  439. }
  440. displayBanMenu(id, g_menuPosition[id] = 0)
  441.  
  442. return PLUGIN_HANDLED
  443. }
  444.  
  445. /* Slap/Slay */
  446.  
  447. public actionSlapMenu(id, key)
  448. {
  449. switch (key)
  450. {
  451. case 7:
  452. {
  453. ++g_menuOption[id]
  454.  
  455. g_menuOption[id] %= ArraySize(g_slapsettings);
  456.  
  457. g_menuSettings[id] = ArrayGetCell(g_slapsettings, g_menuOption[id]);
  458.  
  459. displaySlapMenu(id, g_menuPosition[id]);
  460. }
  461. case 8: displaySlapMenu(id, ++g_menuPosition[id])
  462. case 9: displaySlapMenu(id, --g_menuPosition[id])
  463. default:
  464. {
  465. new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  466. new name2[32]
  467.  
  468. get_user_name(player, name2, 31)
  469.  
  470. if (!is_user_alive(player))
  471. {
  472. client_print(id, print_chat, "%L", id, "CANT_PERF_DEAD", name2)
  473. displaySlapMenu(id, g_menuPosition[id])
  474. return PLUGIN_HANDLED
  475. }
  476.  
  477. new authid[32], authid2[32], name[32]
  478.  
  479. get_user_authid(id, authid, 31)
  480. get_user_authid(player, authid2, 31)
  481. get_user_name(id, name, 31)
  482.  
  483. if (g_menuOption[id])
  484. {
  485. 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)
  486.  
  487. show_activity_key("ADMIN_SLAP_1", "ADMIN_SLAP_2", name, name2, g_menuSettings[id]);
  488. } else {
  489. log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)
  490.  
  491. show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", name, name2);
  492. }
  493.  
  494. if (g_menuOption[id])
  495. user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
  496. else
  497. user_kill(player)
  498.  
  499. displaySlapMenu(id, g_menuPosition[id])
  500. }
  501. }
  502.  
  503. return PLUGIN_HANDLED
  504. }
  505.  
  506. displaySlapMenu(id, pos)
  507. {
  508. if (pos < 0)
  509. return
  510.  
  511. get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  512.  
  513. new menuBody[512]
  514. new b = 0
  515. new i
  516. new name[32], team[4]
  517. new start = pos * 7
  518.  
  519. if (start >= g_menuPlayersNum[id])
  520. start = pos = g_menuPosition[id] = 0
  521.  
  522. new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "SLAP_SLAY_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  523. new end = start + 7
  524. new keys = MENU_KEY_0|MENU_KEY_8
  525.  
  526. if (end > g_menuPlayersNum[id])
  527. end = g_menuPlayersNum[id]
  528.  
  529. for (new a = start; a < end; ++a)
  530. {
  531. i = g_menuPlayers[id][a]
  532. get_user_name(i, name, 31)
  533.  
  534. if (g_cstrike)
  535. {
  536. if (cs_get_user_team(i) == CS_TEAM_T)
  537. {
  538. copy(team, 3, "TE")
  539. }
  540. else if (cs_get_user_team(i) == CS_TEAM_CT)
  541. {
  542. copy(team, 3, "CT")
  543. } else {
  544. get_user_team(i, team, 3)
  545. }
  546. } else {
  547. get_user_team(i, team, 3)
  548. }
  549.  
  550. if (!is_user_alive(i) || (access(i, ADMIN_IMMUNITY) && i != id))
  551. {
  552. ++b
  553.  
  554. if (g_coloredMenus)
  555. len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, team)
  556. else
  557. len += format(menuBody[len], 511-len, "#. %s %s^n", name, team)
  558. } else {
  559. keys |= (1<<b)
  560.  
  561. if (is_user_admin(i))
  562. len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s * %s^n", ++b, name, team)
  563. else
  564. len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
  565. }
  566. }
  567.  
  568. if (g_menuOption[id])
  569. len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id])
  570. else
  571. len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
  572.  
  573. if (end != g_menuPlayersNum[id])
  574. {
  575. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  576. keys |= MENU_KEY_9
  577. }
  578. else
  579. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  580.  
  581. show_menu(id, keys, menuBody, -1, "Slap/Slay Menu")
  582. }
  583.  
  584. public cmdSlapMenu(id, level, cid)
  585. {
  586. if (!cmd_access(id, level, cid, 1))
  587. return PLUGIN_HANDLED
  588.  
  589. g_menuOption[id] = 0
  590. if (ArraySize(g_slapsettings) > 0)
  591. {
  592. g_menuSettings[id] = ArrayGetCell(g_slapsettings, g_menuOption[id]);
  593. }
  594. else
  595. {
  596. // should never happen, but failsafe
  597. g_menuSettings[id] = 0
  598. }
  599.  
  600. displaySlapMenu(id, g_menuPosition[id] = 0)
  601.  
  602. return PLUGIN_HANDLED
  603. }
  604.  
  605. /* Kick */
  606.  
  607. public actionKickMenu(id, key)
  608. {
  609. switch (key)
  610. {
  611. case 8: displayKickMenu(id, ++g_menuPosition[id])
  612. case 9: displayKickMenu(id, --g_menuPosition[id])
  613. default:
  614. {
  615. new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
  616. new authid[32], authid2[32], name[32], name2[32]
  617.  
  618. get_user_authid(id, authid, 31)
  619. get_user_authid(player, authid2, 31)
  620. get_user_name(id, name, 31)
  621. get_user_name(player, name2, 31)
  622.  
  623. new userid2 = get_user_userid(player)
  624.  
  625. log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, userid2, authid2)
  626.  
  627. show_activity_key("ADMIN_KICK_1", "ADMIN_KICK_2", name, name2);
  628.  
  629.  
  630. server_cmd("kick #%d", userid2)
  631. server_exec()
  632.  
  633. displayKickMenu(id, g_menuPosition[id])
  634. }
  635. }
  636.  
  637. return PLUGIN_HANDLED
  638. }
  639.  
  640. displayKickMenu(id, pos)
  641. {
  642. if (pos < 0)
  643. return
  644.  
  645. get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  646.  
  647. new menuBody[512]
  648. new b = 0
  649. new i
  650. new name[32]
  651. new start = pos * 8
  652.  
  653. if (start >= g_menuPlayersNum[id])
  654. start = pos = g_menuPosition[id] = 0
  655.  
  656. new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "KICK_MENU", pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0)))
  657. new end = start + 8
  658. new keys = MENU_KEY_0
  659.  
  660. if (end > g_menuPlayersNum[id])
  661. end = g_menuPlayersNum[id]
  662.  
  663. for (new a = start; a < end; ++a)
  664. {
  665. i = g_menuPlayers[id][a]
  666. get_user_name(i, name, 31)
  667.  
  668. if (access(i, ADMIN_IMMUNITY) && i != id)
  669. {
  670. ++b
  671.  
  672. if (g_coloredMenus)
  673. len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
  674. else
  675. len += format(menuBody[len], 511-len, "#. %s^n", name)
  676. } else {
  677. keys |= (1<<b)
  678.  
  679. if (is_user_admin(i))
  680. len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
  681. else
  682. len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
  683. }
  684. }
  685.  
  686. if (end != g_menuPlayersNum[id])
  687. {
  688. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  689. keys |= MENU_KEY_9
  690. }
  691. else
  692. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  693.  
  694. show_menu(id, keys, menuBody, -1, "Kick Menu")
  695. }
  696.  
  697. public cmdKickMenu(id, level, cid)
  698. {
  699. if (cmd_access(id, level, cid, 1))
  700. displayKickMenu(id, g_menuPosition[id] = 0)
  701.  
  702. return PLUGIN_HANDLED
  703. }
  704.  
  705. /* Team menu */
  706.  
  707. public actionTeamMenu(id, key)
  708. {
  709. switch (key)
  710. {
  711. case 7:
  712. {
  713. g_menuOption[id] = (g_menuOption[id] + 1) % (g_cstrike ? 3 : 2);
  714. displayTeamMenu(id, g_menuPosition[id])
  715. }
  716. case 8: displayTeamMenu(id, ++g_menuPosition[id])
  717. case 9: displayTeamMenu(id, --g_menuPosition[id])
  718. default:
  719. {
  720. new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  721. new authid[32], authid2[32], name[32], name2[32]
  722.  
  723. get_user_name(player, name2, 31)
  724. get_user_authid(id, authid, 31)
  725. get_user_authid(player, authid2, 31)
  726. get_user_name(id, name, 31)
  727.  
  728. 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")
  729.  
  730. show_activity_key("ADMIN_TRANSF_1", "ADMIN_TRANSF_2", name, name2, g_CSTeamNames[g_menuOption[id] % 3]);
  731.  
  732. if (g_cstrike)
  733. {
  734. if (is_user_alive(player))
  735. {
  736. new deaths = cs_get_user_deaths(player)
  737. user_kill(player, 1)
  738. cs_set_user_deaths(player, deaths)
  739. }
  740. // This modulo math just aligns the option to the CsTeams-corresponding number
  741. cs_set_user_team(player, (g_menuOption[id] % 3) + 1)
  742. cs_reset_user_model(player)
  743. } else {
  744. new limit_setting = get_cvar_num("mp_limitteams")
  745.  
  746. set_cvar_num("mp_limitteams", 0)
  747. engclient_cmd(player, "jointeam", g_CSTeamNumbers[g_menuOption[id] % 2])
  748. engclient_cmd(player, "joinclass", "1")
  749. set_cvar_num("mp_limitteams", limit_setting)
  750. }
  751.  
  752. displayTeamMenu(id, g_menuPosition[id])
  753. }
  754. }
  755.  
  756. return PLUGIN_HANDLED
  757. }
  758.  
  759. displayTeamMenu(id, pos)
  760. {
  761. if (pos < 0)
  762. return
  763.  
  764. get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  765.  
  766. new menuBody[512]
  767. new b = 0
  768. new i, iteam
  769. new name[32], team[4]
  770. new start = pos * 7
  771.  
  772. if (start >= g_menuPlayersNum[id])
  773. start = pos = g_menuPosition[id] = 0
  774.  
  775. new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "TEAM_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  776. new end = start + 7
  777. new keys = MENU_KEY_0|MENU_KEY_8
  778.  
  779. if (end > g_menuPlayersNum[id])
  780. end = g_menuPlayersNum[id]
  781.  
  782. for (new a = start; a < end; ++a)
  783. {
  784. i = g_menuPlayers[id][a]
  785. get_user_name(i, name, 31)
  786.  
  787. if (g_cstrike)
  788. {
  789. iteam = _:cs_get_user_team(i)
  790.  
  791. if (iteam == 1)
  792. {
  793. copy(team, 3, "TE")
  794. }
  795. else if (iteam == 2)
  796. {
  797. copy(team, 3, "CT")
  798. }
  799. else if (iteam == 3)
  800. {
  801. copy(team, 3, "SPE");
  802. iteam = 6;
  803. } else {
  804. iteam = get_user_team(i, team, 3)
  805. }
  806. } else {
  807. iteam = get_user_team(i, team, 3)
  808. }
  809.  
  810. if ((iteam == g_CSTeamiNumbers[g_menuOption[id] % (g_cstrike ? 3 : 2)]) || (access(i, ADMIN_IMMUNITY) && i != id))
  811. {
  812. ++b
  813.  
  814. if (g_coloredMenus)
  815. len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, team)
  816. else
  817. len += format(menuBody[len], 511-len, "#. %s %s^n", name, team)
  818. } else {
  819. keys |= (1<<b)
  820.  
  821. if (is_user_admin(i))
  822. len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s * %s^n", ++b, name, team)
  823. else
  824. len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
  825. }
  826. }
  827.  
  828. len += format(menuBody[len], 511-len, "^n8. %L^n", id, "TRANSF_TO", g_CSTeamNames[g_menuOption[id] % (g_cstrike ? 3 : 2)])
  829.  
  830. if (end != g_menuPlayersNum[id])
  831. {
  832. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  833. keys |= MENU_KEY_9
  834. }
  835. else
  836. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  837.  
  838. show_menu(id, keys, menuBody, -1, "Team Menu")
  839. }
  840.  
  841. public cmdTeamMenu(id, level, cid)
  842. {
  843. if (!cmd_access(id, level, cid, 1))
  844. return PLUGIN_HANDLED
  845.  
  846. g_menuOption[id] = 0
  847.  
  848. displayTeamMenu(id, g_menuPosition[id] = 0)
  849.  
  850. return PLUGIN_HANDLED
  851. }
  852.  
  853. /* Client cmds menu */
  854.  
  855. public actionClcmdMenu(id, key)
  856. {
  857. switch (key)
  858. {
  859. case 7:
  860. {
  861. ++g_menuOption[id]
  862. g_menuOption[id] %= g_menuSelectNum[id]
  863. displayClcmdMenu(id, g_menuPosition[id])
  864. }
  865. case 8: displayClcmdMenu(id, ++g_menuPosition[id])
  866. case 9: displayClcmdMenu(id, --g_menuPosition[id])
  867. default:
  868. {
  869. new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  870. new flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1]
  871.  
  872. if (is_user_connected(player))
  873. {
  874. new command[512], authid[32], name[32], userid[32]
  875.  
  876. copy(command, charsmax(command), g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
  877. get_user_authid(player, authid, 31)
  878. get_user_name(player, name, 31)
  879. num_to_str(get_user_userid(player), userid, 31)
  880.  
  881. replace(command, charsmax(command), "%userid%", userid)
  882. replace(command, charsmax(command), "%authid%", authid)
  883. replace(command, charsmax(command), "%name%", name)
  884.  
  885. if (flags & 1)
  886. {
  887. server_cmd("%s", command)
  888. server_exec()
  889. } else if (flags & 2)
  890. client_cmd(id, "%s", command)
  891. else if (flags & 4)
  892. client_cmd(player, "%s", command)
  893. }
  894.  
  895. if (flags & 8)
  896. displayClcmdMenu(id, g_menuPosition[id])
  897. }
  898. }
  899.  
  900. return PLUGIN_HANDLED
  901. }
  902.  
  903. displayClcmdMenu(id, pos)
  904. {
  905. if (pos < 0)
  906. return
  907.  
  908. get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  909.  
  910. new menuBody[512]
  911. new b = 0
  912. new i
  913. new name[32]
  914. new start = pos * 7
  915.  
  916. if (start >= g_menuPlayersNum[id])
  917. start = pos = g_menuPosition[id] = 0
  918.  
  919. new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "CL_CMD_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  920. new end = start + 7
  921. new keys = MENU_KEY_0|MENU_KEY_8
  922.  
  923. if (end > g_menuPlayersNum[id])
  924. end = g_menuPlayersNum[id]
  925.  
  926. for (new a = start; a < end; ++a)
  927. {
  928. i = g_menuPlayers[id][a]
  929. get_user_name(i, name, 31)
  930.  
  931. if (!g_menuSelectNum[id] || (access(i, ADMIN_IMMUNITY) && i != id))
  932. {
  933. ++b
  934.  
  935. if (g_coloredMenus)
  936. len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
  937. else
  938. len += format(menuBody[len], 511-len, "#. %s^n", name)
  939. } else {
  940. keys |= (1<<b)
  941.  
  942. if (is_user_admin(i))
  943. len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
  944. else
  945. len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
  946. }
  947. }
  948.  
  949. if (g_menuSelectNum[id])
  950. len += format(menuBody[len], 511-len, "^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]])
  951. else
  952. len += format(menuBody[len], 511-len, "^n8. %L^n", id, "NO_CMDS")
  953.  
  954. if (end != g_menuPlayersNum[id])
  955. {
  956. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  957. keys |= MENU_KEY_9
  958. }
  959. else
  960. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  961.  
  962. show_menu(id, keys, menuBody, -1, "Client Cmds Menu")
  963. }
  964.  
  965. public cmdClcmdMenu(id, level, cid)
  966. {
  967. if (!cmd_access(id, level, cid, 1))
  968. return PLUGIN_HANDLED
  969.  
  970. g_menuSelectNum[id] = 0
  971.  
  972. for (new a = 0; a < g_clcmdNum; ++a)
  973. if (access(id, g_clcmdMisc[a][0]))
  974. g_menuSelect[id][g_menuSelectNum[id]++] = a
  975.  
  976. g_menuOption[id] = 0
  977.  
  978. displayClcmdMenu(id, g_menuPosition[id] = 0)
  979.  
  980. return PLUGIN_HANDLED
  981. }
  982.  
  983. load_settings(szFilename[])
  984. {
  985. if (!file_exists(szFilename))
  986. return 0
  987.  
  988. new text[256], szFlags[32], szAccess[32]
  989. new a, pos = 0
  990.  
  991. while (g_clcmdNum < MAX_CLCMDS && read_file(szFilename, pos++, text, 255, a))
  992. {
  993. if (text[0] == ';') continue
  994.  
  995. if (parse(text, g_clcmdName[g_clcmdNum], 31, g_clcmdCmd[g_clcmdNum], 63, szFlags, 31, szAccess, 31) > 3)
  996. {
  997. while (replace(g_clcmdCmd[g_clcmdNum], 63, "\'", "^""))
  998. {
  999. // do nothing
  1000. }
  1001.  
  1002. g_clcmdMisc[g_clcmdNum][1] = read_flags(szFlags)
  1003. g_clcmdMisc[g_clcmdNum][0] = read_flags(szAccess)
  1004. g_clcmdNum++
  1005. }
  1006. }
  1007.  
  1008. return 1
  1009. }
  1010. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  1011. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
  1012. */
  1013.  

Ezt átírnátok nekem arra, hogy ne írja az admin nevét?
mert pl
Kód:
log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")" 

Átírom ebben azt h
Kód:
log_amx("Cmd: ADMIN transfer ^"%s<%d><%s><>^" (team ^"%s^")" 
akkor is kiírja az admin nevét..

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: plmenu átírása
HozzászólásElküldve:2014.02.22. 09:09 
Offline
Fanatikus
Avatar

Csatlakozott:2013.03.23. 14:55
Hozzászólások:162
Megköszönt másnak: 2 alkalommal
Megköszönték neki: 27 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. log_amx("Cmd: ^"<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")", get_user_userid(id), authid, name2, get_user_userid(player), authid2, g_menuOption[id] ? "TERRORIST" : "CT")

_________________
Fehér lányra nézni fault,fehér lányhoz szólni technikai fault,fehér lányhoz érni,na azért lincselés jár!


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: plmenu átírása
HozzászólásElküldve:2014.02.22. 09:13 
Offline
Őskövület
Avatar

Csatlakozott:2012.02.27. 09:42
Hozzászólások:2588
Megköszönt másnak: 26 alkalommal
Megköszönték neki: 418 alkalommal
próbáld nem biztos, hogy jó
SMA Forráskód: [ Mindet kijelol ]
  1. /* AMX Mod X
  2. * Players Menu Plugin
  3. *
  4. * by the AMX Mod X Development Team
  5. * originally developed by OLO
  6. *
  7. * This file is part of AMX Mod X.
  8. *
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at
  13. * your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software Foundation,
  22. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. * In addition, as a special exception, the author gives permission to
  25. * link the code of this program with the Half-Life Game Engine ("HL
  26. * Engine") and Modified Game Libraries ("MODs") developed by Valve,
  27. * L.L.C ("Valve"). You must obey the GNU General Public License in all
  28. * respects for all of the code used other than the HL Engine and MODs
  29. * from Valve. If you modify this file, you may extend this exception
  30. * to your version of the file, but you are not obligated to do so. If
  31. * you do not wish to do so, delete this exception statement from your
  32. * version.
  33. */
  34.  
  35. #include <amxmodx>
  36. #include <amxmisc>
  37.  
  38. /** skip autoloading since it's optional */
  39. #define AMXMODX_NOAUTOLOAD
  40. #include <cstrike>
  41.  
  42. new g_menuPosition[33]
  43. new g_menuPlayers[33][32]
  44. new g_menuPlayersNum[33]
  45. new g_menuOption[33]
  46. new g_menuSettings[33]
  47.  
  48. new g_menuSelect[33][64]
  49. new g_menuSelectNum[33]
  50.  
  51. #define MAX_CLCMDS 24
  52.  
  53. new g_clcmdName[MAX_CLCMDS][32]
  54. new g_clcmdCmd[MAX_CLCMDS][64]
  55. new g_clcmdMisc[MAX_CLCMDS][2]
  56. new g_clcmdNum
  57.  
  58. new g_coloredMenus
  59. new g_cstrike = 0
  60.  
  61. new Array:g_bantimes;
  62. new Array:g_slapsettings;
  63.  
  64. new g_CSTeamNames[3][] = {
  65. "TERRORIST",
  66. "CT",
  67. "SPECTATOR"
  68. }
  69. new g_CSTeamNumbers[3][] = {
  70. "1",
  71. "2",
  72. "6"
  73. }
  74. new g_CSTeamiNumbers[3] = {
  75. 1,
  76. 2,
  77. 6
  78. }
  79.  
  80. new g_ban_player[33];
  81.  
  82.  
  83. public plugin_natives()
  84. {
  85. set_module_filter("module_filter")
  86. set_native_filter("native_filter")
  87. }
  88.  
  89. public plugin_init()
  90. {
  91. register_plugin("Players Menu", AMXX_VERSION_STR, "AMXX Dev Team")
  92. register_dictionary("common.txt")
  93. register_dictionary("admincmd.txt")
  94. register_dictionary("plmenu.txt")
  95.  
  96. register_clcmd("amx_kickmenu", "cmdKickMenu", ADMIN_KICK, "- displays kick menu")
  97. register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN, "- displays ban menu")
  98. register_clcmd("amx_slapmenu", "cmdSlapMenu", ADMIN_SLAY, "- displays slap/slay menu")
  99. register_clcmd("amx_teammenu", "cmdTeamMenu", ADMIN_LEVEL_A, "- displays team menu")
  100. register_clcmd("amx_clcmdmenu", "cmdClcmdMenu", ADMIN_LEVEL_A, "- displays client cmds menu")
  101. register_clcmd("amx_banreason", "CmdBanReason", ADMIN_BAN, "<reason>");
  102.  
  103. register_menucmd(register_menuid("Ban Menu"), 1023, "actionBanMenu")
  104. register_menucmd(register_menuid("Kick Menu"), 1023, "actionKickMenu")
  105. register_menucmd(register_menuid("Slap/Slay Menu"), 1023, "actionSlapMenu")
  106. register_menucmd(register_menuid("Team Menu"), 1023, "actionTeamMenu")
  107. register_menucmd(register_menuid("Client Cmds Menu"), 1023, "actionClcmdMenu")
  108.  
  109.  
  110. g_bantimes = ArrayCreate();
  111. // Load up the old default values
  112. ArrayPushCell(g_bantimes, 0);
  113. ArrayPushCell(g_bantimes, 5);
  114. ArrayPushCell(g_bantimes, 10);
  115. ArrayPushCell(g_bantimes, 15);
  116. ArrayPushCell(g_bantimes, 30);
  117. ArrayPushCell(g_bantimes, 45);
  118. ArrayPushCell(g_bantimes, 60);
  119.  
  120.  
  121. g_slapsettings = ArrayCreate();
  122. // Old default values
  123. ArrayPushCell(g_slapsettings, 0); // First option is ignored - it is slay
  124. ArrayPushCell(g_slapsettings, 0); // slap 0 damage
  125. ArrayPushCell(g_slapsettings, 1);
  126. ArrayPushCell(g_slapsettings, 5);
  127.  
  128.  
  129. register_srvcmd("amx_plmenu_bantimes", "plmenu_setbantimes");
  130. register_srvcmd("amx_plmenu_slapdmg", "plmenu_setslapdmg");
  131.  
  132. g_coloredMenus = colored_menus()
  133.  
  134. new clcmds_ini_file[64]
  135. get_configsdir(clcmds_ini_file, 63)
  136. format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file)
  137. load_settings(clcmds_ini_file)
  138.  
  139. if (module_exists("cstrike"))
  140. g_cstrike = 1
  141. }
  142. public plmenu_setbantimes()
  143. {
  144. new buff[32];
  145. new args = read_argc();
  146.  
  147. if (args <= 1)
  148. {
  149. server_print("usage: amx_plmenu_bantimes <time1> [time2] [time3] ...");
  150. server_print(" use time of 0 for permanent.");
  151.  
  152. return;
  153. }
  154.  
  155. ArrayClear(g_bantimes);
  156.  
  157. for (new i = 1; i < args; i++)
  158. {
  159. read_argv(i, buff, charsmax(buff));
  160.  
  161. ArrayPushCell(g_bantimes, str_to_num(buff));
  162.  
  163. }
  164.  
  165. }
  166. public plmenu_setslapdmg()
  167. {
  168. new buff[32];
  169. new args = read_argc();
  170.  
  171. if (args <= 1)
  172. {
  173. server_print("usage: amx_plmenu_slapdmg <dmg1> [dmg2] [dmg3] ...");
  174. server_print(" slay is automatically set for the first value.");
  175.  
  176. return;
  177. }
  178.  
  179. ArrayClear(g_slapsettings);
  180.  
  181. ArrayPushCell(g_slapsettings, 0); // compensate for slay
  182.  
  183. for (new i = 1; i < args; i++)
  184. {
  185. read_argv(i, buff, charsmax(buff));
  186.  
  187. ArrayPushCell(g_slapsettings, str_to_num(buff));
  188.  
  189. }
  190.  
  191. }
  192. public module_filter(const module[])
  193. {
  194. if (equali(module, "cstrike"))
  195. return PLUGIN_HANDLED
  196.  
  197. return PLUGIN_CONTINUE
  198. }
  199.  
  200. public native_filter(const name[], index, trap)
  201. {
  202. if (!trap)
  203. return PLUGIN_HANDLED
  204.  
  205. return PLUGIN_CONTINUE
  206. }
  207.  
  208. /* Ban menu */
  209.  
  210. public client_disconnect(id)
  211. {
  212. g_ban_player[id] = 0;
  213. }
  214.  
  215. public CmdBanReason(id)
  216. {
  217. new player = g_ban_player[id];
  218.  
  219. if( !player ) return PLUGIN_HANDLED;
  220.  
  221. new reason[128];
  222. read_args(reason, sizeof(reason) - 1);
  223. remove_quotes(reason);
  224.  
  225. new name[32], name2[32], authid[32], authid2[32]
  226.  
  227. get_user_name(player, name2, 31)
  228. get_user_authid(id, authid, 31)
  229. get_user_authid(player, authid2, 31)
  230. get_user_name(id, name, 31)
  231.  
  232. new userid2 = get_user_userid(player)
  233.  
  234. log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, g_menuSettings[id], reason)
  235.  
  236. if ( !equal("STEAM_0:", authid2, 8))
  237. {
  238. client_cmd(id, "amx_banip #%i %i ^"%s^"", userid2, g_menuSettings[id], reason);
  239. }
  240. else
  241. {
  242. client_cmd(id, "amx_ban #%i %i ^"%s^"", userid2, g_menuSettings[id], reason);
  243. }
  244.  
  245. server_exec()
  246.  
  247. g_ban_player[id] = 0;
  248.  
  249. displayBanMenu(id, g_menuPosition[id])
  250.  
  251. return PLUGIN_HANDLED;
  252. }
  253.  
  254. public actionBanMenu(id, key)
  255. {
  256. switch (key)
  257. {
  258. case 7:
  259. {
  260. /* BEGIN OF CHANGES BY MISTAGEE ADDED A FEW MORE OPTIONS */
  261.  
  262. ++g_menuOption[id]
  263. g_menuOption[id] %= ArraySize(g_bantimes);
  264.  
  265. g_menuSettings[id] = ArrayGetCell(g_bantimes, g_menuOption[id]);
  266.  
  267. displayBanMenu(id, g_menuPosition[id])
  268. }
  269. case 8: displayBanMenu(id, ++g_menuPosition[id])
  270. case 9: displayBanMenu(id, --g_menuPosition[id])
  271. default:
  272. {
  273. g_ban_player[id] = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  274.  
  275. client_cmd(id, "messagemode amx_banreason");
  276.  
  277. client_print(id, print_chat, "[AMXX] Type in the reason for banning this player.");
  278.  
  279.  
  280. /*new name[32], name2[32], authid[32], authid2[32]
  281.  
  282. get_user_name(player, name2, 31)
  283. get_user_authid(id, authid, 31)
  284. get_user_authid(player, authid2, 31)
  285. get_user_name(id, name, 31)
  286.  
  287. new userid2 = get_user_userid(player)
  288.  
  289. 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])
  290.  
  291. if (g_menuSettings[id]==0) // permanent
  292. {
  293. new maxpl = get_maxplayers();
  294. for (new i = 1; i <= maxpl; i++)
  295. {
  296. show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "PERM");
  297. }
  298. }
  299. else
  300. {
  301. new tempTime[32];
  302. formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]);
  303. new maxpl = get_maxplayers();
  304. for (new i = 1; i <= maxpl; i++)
  305. {
  306. show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "FOR_MIN", tempTime);
  307. }
  308. }
  309. // ---------- check for Steam ID added by MistaGee --------------------
  310. // IF AUTHID == 4294967295 OR VALVE_ID_LAN OR HLTV, BAN PER IP TO NOT BAN EVERYONE
  311.  
  312. if (equal("4294967295", authid2)
  313. || equal("HLTV", authid2)
  314. || equal("STEAM_ID_LAN", authid2)
  315. || equali("VALVE_ID_LAN", authid2))
  316. {
  317. // END OF MODIFICATIONS BY MISTAGEE
  318. server_cmd("amx_banip #%i %i ^"Banned From Menu^"", userid2, g_menuSettings[id]);
  319. }
  320. else
  321. {
  322. server_cmd("amx_ban #%i %i ^"Banned From Menu^"", userid2, g_menuSettings[id]);
  323. }
  324.  
  325. server_exec()
  326.  
  327. displayBanMenu(id, g_menuPosition[id])*/
  328. }
  329. }
  330.  
  331. return PLUGIN_HANDLED
  332. }
  333.  
  334. displayBanMenu(id, pos)
  335. {
  336. if (pos < 0)
  337. return
  338.  
  339. get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  340.  
  341. new menuBody[512]
  342. new b = 0
  343. new i
  344. new name[32]
  345. new start = pos * 7
  346.  
  347. if (start >= g_menuPlayersNum[id])
  348. start = pos = g_menuPosition[id] = 0
  349.  
  350. new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "BAN_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  351. new end = start + 7
  352. new keys = MENU_KEY_0|MENU_KEY_8
  353.  
  354. if (end > g_menuPlayersNum[id])
  355. end = g_menuPlayersNum[id]
  356.  
  357. for (new a = start; a < end; ++a)
  358. {
  359. i = g_menuPlayers[id][a]
  360. get_user_name(i, name, 31)
  361.  
  362. if (is_user_bot(i) || (access(i, ADMIN_IMMUNITY) && i != id))
  363. {
  364. ++b
  365.  
  366. if (g_coloredMenus)
  367. len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
  368. else
  369. len += format(menuBody[len], 511-len, "#. %s^n", name)
  370. } else {
  371. keys |= (1<<b)
  372.  
  373. if (is_user_admin(i))
  374. len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
  375. else
  376. len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
  377. }
  378. }
  379.  
  380. if (g_menuSettings[id])
  381. {
  382. new banLength[32]
  383. if (timeToString(g_menuSettings[id], banLength, 31))
  384. len += format(menuBody[len], 511-len, "^n8. Ban for %s^n", banLength)
  385. else
  386. len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id])
  387. }
  388. else
  389. len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM")
  390.  
  391. if (end != g_menuPlayersNum[id])
  392. {
  393. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  394. keys |= MENU_KEY_9
  395. }
  396. else
  397. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  398.  
  399. show_menu(id, keys, menuBody, -1, "Ban Menu")
  400. }
  401.  
  402. timeToString(minutes, output[], len)
  403. {
  404. new hours = minutes / 60;
  405. minutes %= 60;
  406.  
  407. new days = hours / 24;
  408. hours %= 24;
  409.  
  410. new ret
  411.  
  412. if (days)
  413. ret += formatex(output[ret], len-ret, "%s%d day%s", ret ? ", " : "", days, (days == 1) ? "" : "s")
  414.  
  415. if (hours)
  416. ret += formatex(output[ret], len-ret, "%s%d hour%s", ret ? ", " : "", hours, (hours == 1) ? "" : "s")
  417.  
  418. if (minutes)
  419. ret += formatex(output[ret], len-ret, "%s%d minute%s", ret ? ", " : "", minutes, (minutes == 1) ? "" : "s")
  420.  
  421. return ret
  422. }
  423.  
  424. public cmdBanMenu(id, level, cid)
  425. {
  426. if (!cmd_access(id, level, cid, 1))
  427. return PLUGIN_HANDLED
  428.  
  429. g_menuOption[id] = 0
  430.  
  431. if (ArraySize(g_bantimes) > 0)
  432. {
  433. g_menuSettings[id] = ArrayGetCell(g_bantimes, g_menuOption[id]);
  434. }
  435. else
  436. {
  437. // should never happen, but failsafe
  438. g_menuSettings[id] = 0
  439. }
  440. displayBanMenu(id, g_menuPosition[id] = 0)
  441.  
  442. return PLUGIN_HANDLED
  443. }
  444.  
  445. /* Slap/Slay */
  446.  
  447. public actionSlapMenu(id, key)
  448. {
  449. switch (key)
  450. {
  451. case 7:
  452. {
  453. ++g_menuOption[id]
  454.  
  455. g_menuOption[id] %= ArraySize(g_slapsettings);
  456.  
  457. g_menuSettings[id] = ArrayGetCell(g_slapsettings, g_menuOption[id]);
  458.  
  459. displaySlapMenu(id, g_menuPosition[id]);
  460. }
  461. case 8: displaySlapMenu(id, ++g_menuPosition[id])
  462. case 9: displaySlapMenu(id, --g_menuPosition[id])
  463. default:
  464. {
  465. new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  466. new name2[32]
  467.  
  468. get_user_name(player, name2, 31)
  469.  
  470. if (!is_user_alive(player))
  471. {
  472. client_print(id, print_chat, "%L", id, "CANT_PERF_DEAD", name2)
  473. displaySlapMenu(id, g_menuPosition[id])
  474. return PLUGIN_HANDLED
  475. }
  476.  
  477. new authid[32], authid2[32], name[32]
  478.  
  479. get_user_authid(id, authid, 31)
  480. get_user_authid(player, authid2, 31)
  481. get_user_name(id, name, 31)
  482.  
  483. if (g_menuOption[id])
  484. {
  485. 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)
  486. show_activity_key("", "ADMIN_SLAP_2", name2, g_menuSettings[id]);
  487. } else {
  488. log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)
  489.  
  490. show_activity_key("", "ADMIN_SLAY_2", name2);
  491. }
  492.  
  493. if (g_menuOption[id])
  494. user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
  495. else
  496. user_kill(player)
  497.  
  498. displaySlapMenu(id, g_menuPosition[id])
  499. }
  500. }
  501.  
  502. return PLUGIN_HANDLED
  503. }
  504.  
  505. displaySlapMenu(id, pos)
  506. {
  507. if (pos < 0)
  508. return
  509.  
  510. get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  511.  
  512. new menuBody[512]
  513. new b = 0
  514. new i
  515. new name[32], team[4]
  516. new start = pos * 7
  517.  
  518. if (start >= g_menuPlayersNum[id])
  519. start = pos = g_menuPosition[id] = 0
  520.  
  521. new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "SLAP_SLAY_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  522. new end = start + 7
  523. new keys = MENU_KEY_0|MENU_KEY_8
  524.  
  525. if (end > g_menuPlayersNum[id])
  526. end = g_menuPlayersNum[id]
  527.  
  528. for (new a = start; a < end; ++a)
  529. {
  530. i = g_menuPlayers[id][a]
  531. get_user_name(i, name, 31)
  532.  
  533. if (g_cstrike)
  534. {
  535. if (cs_get_user_team(i) == CS_TEAM_T)
  536. {
  537. copy(team, 3, "TE")
  538. }
  539. else if (cs_get_user_team(i) == CS_TEAM_CT)
  540. {
  541. copy(team, 3, "CT")
  542. } else {
  543. get_user_team(i, team, 3)
  544. }
  545. } else {
  546. get_user_team(i, team, 3)
  547. }
  548.  
  549. if (!is_user_alive(i) || (access(i, ADMIN_IMMUNITY) && i != id))
  550. {
  551. ++b
  552.  
  553. if (g_coloredMenus)
  554. len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, team)
  555. else
  556. len += format(menuBody[len], 511-len, "#. %s %s^n", name, team)
  557. } else {
  558. keys |= (1<<b)
  559.  
  560. if (is_user_admin(i))
  561. len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s * %s^n", ++b, name, team)
  562. else
  563. len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
  564. }
  565. }
  566.  
  567. if (g_menuOption[id])
  568. len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id])
  569. else
  570. len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
  571.  
  572. if (end != g_menuPlayersNum[id])
  573. {
  574. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  575. keys |= MENU_KEY_9
  576. }
  577. else
  578. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  579.  
  580. show_menu(id, keys, menuBody, -1, "Slap/Slay Menu")
  581. }
  582.  
  583. public cmdSlapMenu(id, level, cid)
  584. {
  585. if (!cmd_access(id, level, cid, 1))
  586. return PLUGIN_HANDLED
  587.  
  588. g_menuOption[id] = 0
  589. if (ArraySize(g_slapsettings) > 0)
  590. {
  591. g_menuSettings[id] = ArrayGetCell(g_slapsettings, g_menuOption[id]);
  592. }
  593. else
  594. {
  595. // should never happen, but failsafe
  596. g_menuSettings[id] = 0
  597. }
  598.  
  599. displaySlapMenu(id, g_menuPosition[id] = 0)
  600.  
  601. return PLUGIN_HANDLED
  602. }
  603.  
  604. /* Kick */
  605.  
  606. public actionKickMenu(id, key)
  607. {
  608. switch (key)
  609. {
  610. case 8: displayKickMenu(id, ++g_menuPosition[id])
  611. case 9: displayKickMenu(id, --g_menuPosition[id])
  612. default:
  613. {
  614. new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
  615. new authid[32], authid2[32], name[32], name2[32]
  616.  
  617. get_user_authid(id, authid, 31)
  618. get_user_authid(player, authid2, 31)
  619. get_user_name(id, name, 31)
  620. get_user_name(player, name2, 31)
  621.  
  622. new userid2 = get_user_userid(player)
  623.  
  624. log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, userid2, authid2)
  625.  
  626. show_activity_key("", "ADMIN_KICK_2", name2);
  627.  
  628.  
  629. server_cmd("kick #%d", userid2)
  630. server_exec()
  631.  
  632. displayKickMenu(id, g_menuPosition[id])
  633. }
  634. }
  635.  
  636. return PLUGIN_HANDLED
  637. }
  638.  
  639. displayKickMenu(id, pos)
  640. {
  641. if (pos < 0)
  642. return
  643.  
  644. get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  645.  
  646. new menuBody[512]
  647. new b = 0
  648. new i
  649. new name[32]
  650. new start = pos * 8
  651.  
  652. if (start >= g_menuPlayersNum[id])
  653. start = pos = g_menuPosition[id] = 0
  654.  
  655. new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "KICK_MENU", pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0)))
  656. new end = start + 8
  657. new keys = MENU_KEY_0
  658.  
  659. if (end > g_menuPlayersNum[id])
  660. end = g_menuPlayersNum[id]
  661.  
  662. for (new a = start; a < end; ++a)
  663. {
  664. i = g_menuPlayers[id][a]
  665. get_user_name(i, name, 31)
  666.  
  667. if (access(i, ADMIN_IMMUNITY) && i != id)
  668. {
  669. ++b
  670.  
  671. if (g_coloredMenus)
  672. len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
  673. else
  674. len += format(menuBody[len], 511-len, "#. %s^n", name)
  675. } else {
  676. keys |= (1<<b)
  677.  
  678. if (is_user_admin(i))
  679. len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
  680. else
  681. len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
  682. }
  683. }
  684.  
  685. if (end != g_menuPlayersNum[id])
  686. {
  687. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  688. keys |= MENU_KEY_9
  689. }
  690. else
  691. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  692.  
  693. show_menu(id, keys, menuBody, -1, "Kick Menu")
  694. }
  695.  
  696. public cmdKickMenu(id, level, cid)
  697. {
  698. if (cmd_access(id, level, cid, 1))
  699. displayKickMenu(id, g_menuPosition[id] = 0)
  700.  
  701. return PLUGIN_HANDLED
  702. }
  703.  
  704. /* Team menu */
  705.  
  706. public actionTeamMenu(id, key)
  707. {
  708. switch (key)
  709. {
  710. case 7:
  711. {
  712. g_menuOption[id] = (g_menuOption[id] + 1) % (g_cstrike ? 3 : 2);
  713. displayTeamMenu(id, g_menuPosition[id])
  714. }
  715. case 8: displayTeamMenu(id, ++g_menuPosition[id])
  716. case 9: displayTeamMenu(id, --g_menuPosition[id])
  717. default:
  718. {
  719. new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  720. new authid[32], authid2[32], name[32], name2[32]
  721.  
  722. get_user_name(player, name2, 31)
  723. get_user_authid(id, authid, 31)
  724. get_user_authid(player, authid2, 31)
  725. get_user_name(id, name, 31)
  726.  
  727. 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")
  728.  
  729. show_activity_key("", "ADMIN_TRANSF_2", name2, g_CSTeamNames[g_menuOption[id] % 3]);
  730.  
  731. if (g_cstrike)
  732. {
  733. if (is_user_alive(player))
  734. {
  735. new deaths = cs_get_user_deaths(player)
  736. user_kill(player, 1)
  737. cs_set_user_deaths(player, deaths)
  738. }
  739. // This modulo math just aligns the option to the CsTeams-corresponding number
  740. cs_set_user_team(player, (g_menuOption[id] % 3) + 1)
  741. cs_reset_user_model(player)
  742. } else {
  743. new limit_setting = get_cvar_num("mp_limitteams")
  744.  
  745. set_cvar_num("mp_limitteams", 0)
  746. engclient_cmd(player, "jointeam", g_CSTeamNumbers[g_menuOption[id] % 2])
  747. engclient_cmd(player, "joinclass", "1")
  748. set_cvar_num("mp_limitteams", limit_setting)
  749. }
  750.  
  751. displayTeamMenu(id, g_menuPosition[id])
  752. }
  753. }
  754.  
  755. return PLUGIN_HANDLED
  756. }
  757.  
  758. displayTeamMenu(id, pos)
  759. {
  760. if (pos < 0)
  761. return
  762.  
  763. get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  764.  
  765. new menuBody[512]
  766. new b = 0
  767. new i, iteam
  768. new name[32], team[4]
  769. new start = pos * 7
  770.  
  771. if (start >= g_menuPlayersNum[id])
  772. start = pos = g_menuPosition[id] = 0
  773.  
  774. new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "TEAM_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  775. new end = start + 7
  776. new keys = MENU_KEY_0|MENU_KEY_8
  777.  
  778. if (end > g_menuPlayersNum[id])
  779. end = g_menuPlayersNum[id]
  780.  
  781. for (new a = start; a < end; ++a)
  782. {
  783. i = g_menuPlayers[id][a]
  784. get_user_name(i, name, 31)
  785.  
  786. if (g_cstrike)
  787. {
  788. iteam = _:cs_get_user_team(i)
  789.  
  790. if (iteam == 1)
  791. {
  792. copy(team, 3, "TE")
  793. }
  794. else if (iteam == 2)
  795. {
  796. copy(team, 3, "CT")
  797. }
  798. else if (iteam == 3)
  799. {
  800. copy(team, 3, "SPE");
  801. iteam = 6;
  802. } else {
  803. iteam = get_user_team(i, team, 3)
  804. }
  805. } else {
  806. iteam = get_user_team(i, team, 3)
  807. }
  808.  
  809. if ((iteam == g_CSTeamiNumbers[g_menuOption[id] % (g_cstrike ? 3 : 2)]) || (access(i, ADMIN_IMMUNITY) && i != id))
  810. {
  811. ++b
  812.  
  813. if (g_coloredMenus)
  814. len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, team)
  815. else
  816. len += format(menuBody[len], 511-len, "#. %s %s^n", name, team)
  817. } else {
  818. keys |= (1<<b)
  819.  
  820. if (is_user_admin(i))
  821. len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s * %s^n", ++b, name, team)
  822. else
  823. len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
  824. }
  825. }
  826.  
  827. len += format(menuBody[len], 511-len, "^n8. %L^n", id, "TRANSF_TO", g_CSTeamNames[g_menuOption[id] % (g_cstrike ? 3 : 2)])
  828.  
  829. if (end != g_menuPlayersNum[id])
  830. {
  831. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  832. keys |= MENU_KEY_9
  833. }
  834. else
  835. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  836.  
  837. show_menu(id, keys, menuBody, -1, "Team Menu")
  838. }
  839.  
  840. public cmdTeamMenu(id, level, cid)
  841. {
  842. if (!cmd_access(id, level, cid, 1))
  843. return PLUGIN_HANDLED
  844.  
  845. g_menuOption[id] = 0
  846.  
  847. displayTeamMenu(id, g_menuPosition[id] = 0)
  848.  
  849. return PLUGIN_HANDLED
  850. }
  851.  
  852. /* Client cmds menu */
  853.  
  854. public actionClcmdMenu(id, key)
  855. {
  856. switch (key)
  857. {
  858. case 7:
  859. {
  860. ++g_menuOption[id]
  861. g_menuOption[id] %= g_menuSelectNum[id]
  862. displayClcmdMenu(id, g_menuPosition[id])
  863. }
  864. case 8: displayClcmdMenu(id, ++g_menuPosition[id])
  865. case 9: displayClcmdMenu(id, --g_menuPosition[id])
  866. default:
  867. {
  868. new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  869. new flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1]
  870.  
  871. if (is_user_connected(player))
  872. {
  873. new command[512], authid[32], name[32], userid[32]
  874.  
  875. copy(command, charsmax(command), g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
  876. get_user_authid(player, authid, 31)
  877. get_user_name(player, name, 31)
  878. num_to_str(get_user_userid(player), userid, 31)
  879.  
  880. replace(command, charsmax(command), "%userid%", userid)
  881. replace(command, charsmax(command), "%authid%", authid)
  882. replace(command, charsmax(command), "%name%", name)
  883.  
  884. if (flags & 1)
  885. {
  886. server_cmd("%s", command)
  887. server_exec()
  888. } else if (flags & 2)
  889. client_cmd(id, "%s", command)
  890. else if (flags & 4)
  891. client_cmd(player, "%s", command)
  892. }
  893.  
  894. if (flags & 8)
  895. displayClcmdMenu(id, g_menuPosition[id])
  896. }
  897. }
  898.  
  899. return PLUGIN_HANDLED
  900. }
  901.  
  902. displayClcmdMenu(id, pos)
  903. {
  904. if (pos < 0)
  905. return
  906.  
  907. get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  908.  
  909. new menuBody[512]
  910. new b = 0
  911. new i
  912. new name[32]
  913. new start = pos * 7
  914.  
  915. if (start >= g_menuPlayersNum[id])
  916. start = pos = g_menuPosition[id] = 0
  917.  
  918. new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "CL_CMD_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  919. new end = start + 7
  920. new keys = MENU_KEY_0|MENU_KEY_8
  921.  
  922. if (end > g_menuPlayersNum[id])
  923. end = g_menuPlayersNum[id]
  924.  
  925. for (new a = start; a < end; ++a)
  926. {
  927. i = g_menuPlayers[id][a]
  928. get_user_name(i, name, 31)
  929.  
  930. if (!g_menuSelectNum[id] || (access(i, ADMIN_IMMUNITY) && i != id))
  931. {
  932. ++b
  933.  
  934. if (g_coloredMenus)
  935. len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
  936. else
  937. len += format(menuBody[len], 511-len, "#. %s^n", name)
  938. } else {
  939. keys |= (1<<b)
  940.  
  941. if (is_user_admin(i))
  942. len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
  943. else
  944. len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
  945. }
  946. }
  947.  
  948. if (g_menuSelectNum[id])
  949. len += format(menuBody[len], 511-len, "^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]])
  950. else
  951. len += format(menuBody[len], 511-len, "^n8. %L^n", id, "NO_CMDS")
  952.  
  953. if (end != g_menuPlayersNum[id])
  954. {
  955. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  956. keys |= MENU_KEY_9
  957. }
  958. else
  959. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  960.  
  961. show_menu(id, keys, menuBody, -1, "Client Cmds Menu")
  962. }
  963.  
  964. public cmdClcmdMenu(id, level, cid)
  965. {
  966. if (!cmd_access(id, level, cid, 1))
  967. return PLUGIN_HANDLED
  968.  
  969. g_menuSelectNum[id] = 0
  970.  
  971. for (new a = 0; a < g_clcmdNum; ++a)
  972. if (access(id, g_clcmdMisc[a][0]))
  973. g_menuSelect[id][g_menuSelectNum[id]++] = a
  974.  
  975. g_menuOption[id] = 0
  976.  
  977. displayClcmdMenu(id, g_menuPosition[id] = 0)
  978.  
  979. return PLUGIN_HANDLED
  980. }
  981.  
  982. load_settings(szFilename[])
  983. {
  984. if (!file_exists(szFilename))
  985. return 0
  986.  
  987. new text[256], szFlags[32], szAccess[32]
  988. new a, pos = 0
  989.  
  990. while (g_clcmdNum < MAX_CLCMDS && read_file(szFilename, pos++, text, 255, a))
  991. {
  992. if (text[0] == ';') continue
  993.  
  994. if (parse(text, g_clcmdName[g_clcmdNum], 31, g_clcmdCmd[g_clcmdNum], 63, szFlags, 31, szAccess, 31) > 3)
  995. {
  996. while (replace(g_clcmdCmd[g_clcmdNum], 63, "\'", "^""))
  997. {
  998. // do nothing
  999. }
  1000.  
  1001. g_clcmdMisc[g_clcmdNum][1] = read_flags(szFlags)
  1002. g_clcmdMisc[g_clcmdNum][0] = read_flags(szAccess)
  1003. g_clcmdNum++
  1004. }
  1005. }
  1006.  
  1007. return 1
  1008. }
  1009. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  1010. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
  1011. */

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése: Rendezés 
Új téma nyitása Hozzászólás a témához  [3 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 23 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole