hlmod.hu

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



Jelenlévő felhasználók

Jelenleg 343 felhasználó van jelen :: 3 regisztrált, 0 rejtett és 340 vendég

A legtöbb felhasználó (2761 fő) 2025.01.09. 20:06-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot], Google [Bot], Majestic-12 [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  [10 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Plugin commands kivétele!
HozzászólásElküldve:2013.04.17. 18:43 
Offline
Jómunkásember
Avatar

Csatlakozott:2013.03.07. 18:39
Hozzászólások:352
Megköszönt másnak: 3 alkalommal
Megköszönték neki: 38 alkalommal
Sziasztok!
Hogyan tudnám kivenni az admin menüből, hogy ne legyen ott a 'Plugin Commands' -ot?
A 'plugin cvars' az kéne hogy ott maradjon, mert az fontos :)
Előre is köszönöm a válaszokat!


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Plugin commands kivétele!
HozzászólásElküldve:2013.04.17. 18:52 
Offline
Őstag
Avatar

Csatlakozott:2010.04.16. 16:50
Hozzászólások:1342
Megköszönt másnak: 42 alkalommal
Megköszönték neki: 58 alkalommal
menufront.sma és megkeresed ezt a sort
SMA Forráskód: [ Mindet kijelol ]
  1. AddMenuLang("SERVER_COM", "amx_cmdmenu", get_clcmd_flags("amx_cmdmenu", flags) ? flags : ADMIN_MENU, "Commands Menu")

És elé rakol
SMA Forráskód: [ Mindet kijelol ]
  1. //
jelet és utána ujra leforditod majd a régit felülírod ! :D

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Plugin commands kivétele!
HozzászólásElküldve:2013.04.17. 18:55 
Offline
Jómunkásember
Avatar

Csatlakozott:2013.03.07. 18:39
Hozzászólások:352
Megköszönt másnak: 3 alkalommal
Megköszönték neki: 38 alkalommal
Bemásolnál egy teljesen alap menufront.sma -t?
Előre is köszi.xd


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Plugin commands kivétele!
HozzászólásElküldve:2013.04.17. 18:57 
Offline
Őstag
Avatar

Csatlakozott:2010.04.16. 16:50
Hozzászólások:1342
Megköszönt másnak: 42 alkalommal
Megköszönték neki: 58 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #define MAXMENUS 128
  5. #define STRINGSIZE 32
  6. #define STRINGLENGTH STRINGSIZE - 1
  7. #define MENUITEMSPERPAGE 8
  8. //#define MENUS_NUMBER 16
  9.  
  10. new g_menuPosition[33]
  11. new g_menusNumber = 0
  12. new g_menuBody[MAXMENUS][STRINGSIZE]
  13. new bool:g_menuBodyPhrase[MAXMENUS]
  14. new g_menuCmd[MAXMENUS][STRINGSIZE]
  15. new g_menuAccess[MAXMENUS]
  16. new g_menuPlugin[MAXMENUS][STRINGSIZE]
  17.  
  18. new g_coloredMenus
  19.  
  20. new g_clientMenuPosition[33]
  21. new g_clientMenusNumber = 0
  22. new g_clientMenuBody[MAXMENUS][STRINGSIZE]
  23. new bool:g_clientMenuBodyPhrase[MAXMENUS]
  24. new g_clientMenuCmd[MAXMENUS][STRINGSIZE]
  25. new g_clientMenuAccess[MAXMENUS]
  26. new g_clientMenuPlugin[MAXMENUS][STRINGSIZE]
  27.  
  28. // menuBody: Text that will be shown for this item in menu
  29. // menuCmd: Command that should be executed to start menu
  30. // menuAccess: Access required for menu
  31. // menuPlugin: The exact case-insensitive name of plugin holding the menu command
  32. public AddMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
  33. {
  34. if (g_menusNumber + 1 == MAXMENUS)
  35. {
  36. log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
  37. return
  38. }
  39.  
  40. copy(g_menuBody[g_menusNumber], STRINGLENGTH, menuBody)
  41. g_menuBodyPhrase[g_menusNumber] = false
  42.  
  43. copy(g_menuCmd[g_menusNumber], STRINGLENGTH, menuCmd)
  44. g_menuAccess[g_menusNumber] = menuAccess
  45.  
  46. copy(g_menuPlugin[g_menusNumber], STRINGLENGTH, menuPlugin)
  47.  
  48. g_menusNumber++
  49. server_print("Menu item %d added to Menus Front-End: ^"%s^" from plugin ^"%s^"", g_menusNumber, menuBody, menuPlugin)
  50. }
  51.  
  52. public AddMenuLang(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
  53. {
  54. if (g_menusNumber + 1 == MAXMENUS)
  55. {
  56. log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
  57. return
  58. }
  59.  
  60. copy(g_menuBody[g_menusNumber], STRINGLENGTH, menuBody)
  61. g_menuBodyPhrase[g_menusNumber] = true
  62.  
  63. copy(g_menuCmd[g_menusNumber], STRINGLENGTH, menuCmd)
  64. g_menuAccess[g_menusNumber] = menuAccess
  65.  
  66. copy(g_menuPlugin[g_menusNumber], STRINGLENGTH, menuPlugin)
  67. g_menusNumber++
  68.  
  69. //server_print("Menu item %d added to Menus Front-End: ^"%s^" (LANG) from plugin ^"%s^"", g_menusNumber, menuBody, menuPlugin)
  70. }
  71.  
  72. public AddClientMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
  73. {
  74. if (g_clientMenusNumber + 1 == MAXMENUS)
  75. {
  76. log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
  77. return
  78. }
  79.  
  80. copy(g_clientMenuBody[g_clientMenusNumber], STRINGLENGTH, menuBody)
  81. g_clientMenuBodyPhrase[g_clientMenusNumber] = false
  82.  
  83. copy(g_clientMenuCmd[g_clientMenusNumber], STRINGLENGTH, menuCmd)
  84. g_clientMenuAccess[g_clientMenusNumber] = menuAccess
  85.  
  86. copy(g_clientMenuPlugin[g_clientMenusNumber], STRINGLENGTH, menuPlugin)
  87.  
  88. g_clientMenusNumber++
  89. server_print("Client menu item %d added to Client Menus Front-End: ^"%s^" from plugin ^"%s^"", g_clientMenusNumber, menuBody, menuPlugin)
  90. }
  91.  
  92. AddDefaultMenus()
  93. {
  94. new flags;
  95. AddMenuLang("KICK_PLAYER", "amx_kickmenu", get_clcmd_flags("amx_kickmenu", flags) ? flags : ADMIN_KICK , "Players Menu")
  96. AddMenuLang("BAN_PLAYER", "amx_banmenu", get_clcmd_flags("amx_banmenu", flags) ? flags : ADMIN_BAN, "Players Menu")
  97. AddMenuLang("SLAP_SLAY", "amx_slapmenu", get_clcmd_flags("amx_slapmenu", flags) ? flags : ADMIN_SLAY, "Players Menu")
  98. AddMenuLang("TEAM_PLAYER", "amx_teammenu", get_clcmd_flags("amx_teammenu", flags) ? flags : ADMIN_LEVEL_A, "Players Menu")
  99. AddMenuLang("CHANGEL", "amx_mapmenu", get_clcmd_flags("amx_mapmenu", flags) ? flags : ADMIN_MAP, "Maps Menu")
  100. AddMenuLang("VOTE_MAPS", "amx_votemapmenu", get_clcmd_flags("amx_votemapmenu", flags) ? flags : ADMIN_VOTE, "Maps Menu")
  101. AddMenuLang("SPECH_STUFF", "amx_speechmenu", get_clcmd_flags("amx_speechmenu", flags) ? flags : ADMIN_MENU, "Commands Menu")
  102. AddMenuLang("CLIENT_COM", "amx_clcmdmenu", get_clcmd_flags("amx_clcmdmenu", flags) ? flags : ADMIN_LEVEL_A, "Players Menu")
  103. // AddMenuLang("SERVER_COM", "amx_cmdmenu", get_clcmd_flags("amx_cmdmenu", flags) ? flags : ADMIN_MENU, "Commands Menu")
  104. AddMenuLang("CVARS_SET", "amx_cvarmenu", get_clcmd_flags("amx_cvarmenu", flags) ? flags : ADMIN_CVAR, "Commands Menu")
  105. AddMenuLang("CONFIG", "amx_cfgmenu", get_clcmd_flags("amx_cfgmenu", flags) ? flags : ADMIN_MENU, "Commands Menu")
  106. AddMenuLang("LANG_SET", "amx_langmenu", get_clcmd_flags("amx_langmenu", flags) ? flags : ADMIN_CFG, "Multi-Lingual System")
  107. AddMenuLang("STATS_SET", "amx_statscfgmenu", get_clcmd_flags("amx_statscfgmenu", flags) ? flags : ADMIN_CFG, "Stats Configuration")
  108. AddMenuLang("PAUSE_PLUG", "amx_pausecfgmenu", get_clcmd_flags("amx_pausecfgmenu", flags) ? flags : ADMIN_CFG, "Pause Plugins")
  109. AddMenuLang("RES_WEAP", "amx_restmenu", get_clcmd_flags("amx_restmenu", flags) ? flags : ADMIN_CFG, "Restrict Weapons")
  110. AddMenuLang("TELE_PLAYER", "amx_teleportmenu", get_clcmd_flags("amx_teleportmenu", flags) ? flags : ADMIN_CFG, "Teleport Menu")
  111. }
  112. stock bool:get_clcmd_flags(const search_command[], &flags)
  113. {
  114. new count = get_clcmdsnum(-1);
  115. static cmd[128];
  116. static info[1];
  117. new _flags;
  118.  
  119. for (new i = 0; i < count; i++)
  120. {
  121. get_clcmd(i, cmd, charsmax(cmd), _flags, info, charsmax(info), -1);
  122.  
  123. if (strcmp(cmd, search_command) == 0)
  124. {
  125. flags = _flags;
  126. return true;
  127. }
  128. }
  129.  
  130. return false;
  131. }
  132. public actionMenu(id, key)
  133. {
  134. switch (key)
  135. {
  136. case 8: displayMenu(id, ++g_menuPosition[id])
  137. case 9: displayMenu(id, --g_menuPosition[id])
  138. default: client_cmd(id, "%s", g_menuCmd[g_menuPosition[id] * 8 + key])
  139. }
  140.  
  141. return PLUGIN_HANDLED
  142. }
  143.  
  144. public clientActionMenu(id, key)
  145. {
  146. switch (key)
  147. {
  148. case 8: clientDisplayMenu(id, ++g_clientMenuPosition[id])
  149. case 9: clientDisplayMenu(id, --g_clientMenuPosition[id])
  150. default: client_cmd(id, "%s", g_clientMenuCmd[g_clientMenuPosition[id] * 8 + key])
  151. }
  152.  
  153. return PLUGIN_HANDLED
  154. }
  155.  
  156. displayMenu(id, pos)
  157. {
  158. if (pos < 0)
  159. return
  160.  
  161. new menuBody[512]
  162. new b = 0
  163. new start = pos * MENUITEMSPERPAGE
  164.  
  165. if (start >= g_menusNumber) // MENUS_NUMBER
  166. start = pos = g_menuPosition[id] = 0
  167.  
  168. new len = format(menuBody, 511,
  169.  
  170. g_coloredMenus ? "\yAMX Mod X Menu\R%d/%d^n\w^n" : "AMX Mod X Menu %d/%d^n^n" , pos + 1, (g_menusNumber / MENUITEMSPERPAGE) + (((g_menusNumber % MENUITEMSPERPAGE) > 0) ? 1 : 0))
  171.  
  172. new end = start + MENUITEMSPERPAGE
  173. new keys = MENU_KEY_0
  174.  
  175. if (end > g_menusNumber) // MENUS_NUMBER
  176. end = g_menusNumber // MENUS_NUMBER
  177.  
  178. for (new a = start; a < end; ++a)
  179. {
  180. if ( access(id, g_menuAccess[a]) &&
  181. ((is_plugin_loaded(g_menuPlugin[a]) != -1) || // search plugins for registered name
  182. (is_plugin_loaded(g_menuPlugin[a], true) != -1))) // search plugins for filename
  183. {
  184. keys |= (1<<b)
  185.  
  186. if (g_menuBodyPhrase[a])
  187. len += format(menuBody[len], 511-len, "%d. %L^n", ++b, id, g_menuBody[a])
  188. else
  189. len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_menuBody[a])
  190. } else {
  191. ++b
  192.  
  193. if (g_coloredMenus)
  194. {
  195. if (g_menuBodyPhrase[a])
  196. len += format(menuBody[len], 511-len, "\d%d. %L^n\w", b, id, g_menuBody[a])
  197. else
  198. len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, g_menuBody[a])
  199. } else {
  200. if (g_menuBodyPhrase[a])
  201. len += format(menuBody[len], 511-len, "#. %L^n", id, g_menuBody[a])
  202. else
  203. len += format(menuBody[len], 511-len, "#. %s^n", g_menuBody[a])
  204. }
  205. }
  206. }
  207.  
  208. if (end != g_menusNumber) // MENUS_NUMBER
  209. {
  210. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  211. keys |= MENU_KEY_9
  212. } else {
  213. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  214. }
  215.  
  216. show_menu(id, keys, menuBody)
  217. }
  218.  
  219. clientDisplayMenu(id, pos)
  220. {
  221. if (pos < 0)
  222. return
  223.  
  224. new menuBody[512]
  225. new b = 0
  226. new start = pos * MENUITEMSPERPAGE
  227.  
  228. if (start >= g_clientMenusNumber) // MENUS_NUMBER
  229. start = pos = g_clientMenuPosition[id] = 0
  230.  
  231. new len = format(menuBody, 511, g_coloredMenus ? "\yAMX Mod X Client Menu\R%d/%d^n\w^n" : "AMX Mod X Client Menu %d/%d^n^n" , pos + 1, (g_clientMenusNumber / MENUITEMSPERPAGE) + (((g_clientMenusNumber % MENUITEMSPERPAGE) > 0) ? 1 : 0))
  232.  
  233. new end = start + MENUITEMSPERPAGE
  234. new keys = MENU_KEY_0
  235.  
  236. if (end > g_clientMenusNumber) // MENUS_NUMBER
  237. end = g_clientMenusNumber // MENUS_NUMBER
  238.  
  239. for (new a = start; a < end; ++a)
  240. {
  241. if ( access(id, g_clientMenuAccess[a]) &&
  242. ((is_plugin_loaded(g_clientMenuPlugin[a]) != -1) || // search plugins for registered name
  243. (is_plugin_loaded(g_clientMenuPlugin[a], true) != -1))) // search plugins for file name
  244. {
  245. keys |= (1<<b)
  246.  
  247. if (g_clientMenuBodyPhrase[a])
  248. len += format(menuBody[len], 511-len, "%d. %L^n", ++b, id, g_clientMenuBody[a])
  249. else
  250. len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_clientMenuBody[a])
  251. } else {
  252. ++b
  253.  
  254. if (g_coloredMenus)
  255. {
  256. if (g_clientMenuBodyPhrase[a])
  257. len += format(menuBody[len], 511-len, "\d%d. %L^n\w", b, id, g_clientMenuBody[a])
  258. else
  259. len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, g_clientMenuBody[a])
  260. } else {
  261. if (g_clientMenuBodyPhrase[a])
  262. len += format(menuBody[len], 511-len, "#. %L^n", id, g_clientMenuBody[a])
  263. else
  264. len += format(menuBody[len], 511-len, "#. %s^n", g_clientMenuBody[a])
  265. }
  266. }
  267. }
  268.  
  269. if (end != g_clientMenusNumber) // MENUS_NUMBER
  270. {
  271. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  272. keys |= MENU_KEY_9
  273. }
  274. else {
  275. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  276. }
  277.  
  278. show_menu(id, keys, menuBody)
  279. }
  280.  
  281. public cmdMenu(id, level, cid)
  282. {
  283. if (cmd_access(id, level, cid, 1))
  284. displayMenu(id, g_menuPosition[id] = 0)
  285.  
  286. return PLUGIN_HANDLED
  287. }
  288. public clientCmdMenu(id, level, cid)
  289. {
  290. if (cmd_access(id, level, cid, 1))
  291. clientDisplayMenu(id, g_clientMenuPosition[id] = 0)
  292.  
  293. return PLUGIN_HANDLED
  294. }
  295.  
  296. public addmenuitem_cmd(id, level, cid)
  297. {
  298. if (!cmd_access(id, level, cid, 5))
  299. return PLUGIN_HANDLED
  300.  
  301. // AddMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
  302. new menuBody[STRINGSIZE], menuCmd[STRINGSIZE], flags[STRINGSIZE], menuAccess = 0, menuPlugin[STRINGSIZE]
  303. read_argv(1, menuBody, STRINGLENGTH)
  304. read_argv(2, menuCmd, STRINGLENGTH)
  305. read_argv(3, flags, STRINGLENGTH)
  306. menuAccess = read_flags(flags)
  307. read_argv(4, menuPlugin, STRINGLENGTH)
  308.  
  309. AddMenu(menuBody, menuCmd, menuAccess, menuPlugin)
  310.  
  311. return PLUGIN_HANDLED
  312. }
  313.  
  314. public addclientmenuitem_cmd(id, level, cid)
  315. {
  316. if (!cmd_access(id, level, cid, 5))
  317. return PLUGIN_HANDLED
  318.  
  319. // AddMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
  320. new menuBody[STRINGSIZE], menuCmd[STRINGSIZE], flags[STRINGSIZE], menuAccess = 0, menuPlugin[STRINGSIZE]
  321. read_argv(1, menuBody, STRINGLENGTH)
  322. read_argv(2, menuCmd, STRINGLENGTH)
  323. read_argv(3, flags, STRINGLENGTH)
  324. menuAccess = read_flags(flags)
  325. read_argv(4, menuPlugin, STRINGLENGTH)
  326.  
  327. AddClientMenu(menuBody, menuCmd, menuAccess, menuPlugin)
  328.  
  329. return PLUGIN_HANDLED
  330. }
  331.  
  332. public plugin_init()
  333. {
  334. register_plugin("Menus Front-End", AMXX_VERSION_STR, "AMXX Dev Team")
  335. register_dictionary("menufront.txt")
  336. register_dictionary("common.txt")
  337.  
  338. register_menucmd(register_menuid("AMX Mod X Menu"), 1023, "actionMenu")
  339. register_menucmd(register_menuid("AMX Mod X Client Menu"), 1023, "clientActionMenu")
  340. register_clcmd("amxmodmenu", "cmdMenu", ADMIN_MENU, "- displays menus")
  341. register_clcmd("amx_menu", "clientCmdMenu", 0, "- displays menus available to client")
  342.  
  343. register_srvcmd("amx_addmenuitem", "addmenuitem_cmd", 0, "<menu text> <menu command> <access flags> <plugin name | plugin filename> - Add a menu item to Menus Front-End")
  344. register_srvcmd("amx_addclientmenuitem", "addclientmenuitem_cmd", 0, "<menu text> <menu command> <access flags> <plugin name | plugin filename> - Add a menu item to Client Menus Front-End")
  345.  
  346. g_coloredMenus = colored_menus()
  347.  
  348.  
  349. }
  350. public plugin_cfg()
  351. {
  352. AddDefaultMenus()
  353.  
  354. new configs[128]
  355. get_configsdir(configs, 127)
  356. server_cmd("exec %s/custommenuitems.cfg", configs)
  357. }
  358.  

Tessék, ezt már nyomhatod is a fordítóba mert kivettem a menüt elvileg :D

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Plugin commands kivétele!
HozzászólásElküldve:2013.04.17. 19:23 
Offline
Jómunkásember
Avatar

Csatlakozott:2013.03.07. 18:39
Hozzászólások:352
Megköszönt másnak: 3 alkalommal
Megköszönték neki: 38 alkalommal
Te a 'Szerver parancsokat' vetted ki, nem a plugin commandsot.xDDD
A 'Plugin Commandsot' kitudnád venni?


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Plugin commands kivétele!
HozzászólásElküldve:2013.04.17. 19:43 
Offline
Őstag
Avatar

Csatlakozott:2010.04.16. 16:50
Hozzászólások:1342
Megköszönt másnak: 42 alkalommal
Megköszönték neki: 58 alkalommal
jah télleg, bocsi !
Az a pluginmenu.sma ban van !
Tessék itt van, ezt is csak fordísd és rakhatod be !
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4.  
  5.  
  6. new DisabledCallback;
  7. new EnabledCallback;
  8.  
  9. // pcvar that the client is currently modifying
  10. new CurrentCvar[33];
  11.  
  12. // Name of the cvar being modified
  13. new CurrentCvarName[33][32];
  14.  
  15. // Plugin ID that the client is modifying
  16. new CurrentPlid[33];
  17.  
  18. // Page that the client is currently on
  19. new CurrentPage[33];
  20.  
  21. // Menu function ID that the client is in
  22. new CurrentMenuFunction[33] = { -1,... };
  23.  
  24. new CurrentCommand[33][32];
  25. new cvarmenu_cmdid;
  26. new cmdmenu_cmdid;
  27.  
  28. new ExplicitPlugin[33];
  29.  
  30. public plugin_init()
  31. {
  32. register_plugin("Plugin Menu",AMXX_VERSION_STR,"AMXX Dev Team");
  33.  
  34. register_dictionary("common.txt");
  35. register_dictionary("pausecfg.txt"); // Needed for PAUSE_COULDNT_FIND
  36.  
  37. cvarmenu_cmdid=register_clcmd("amx_plugincvarmenu", "CvarMenuCommand", ADMIN_CVAR, " - displays the plugin cvar menu");
  38. cmdmenu_cmdid=register_clcmd("amx_plugincmdmenu", "CommandMenuCommand", ADMIN_MENU, " - displays the plugin command menu");
  39.  
  40. register_clcmd("amx_changecvar","CommandChangeCvar");
  41. register_clcmd("amx_executecmd","CommandExecuteCommand");
  42.  
  43. // Register global menu callbacks.
  44. DisabledCallback=menu_makecallback("AlwaysDisableCallback");
  45. EnabledCallback=menu_makecallback("AlwaysEnableCallback");
  46. }
  47.  
  48. // Add these menus to the amxmodmenu
  49. public plugin_cfg()
  50. {
  51. set_task(0.1, "addToMenuFront");
  52. }
  53. public addToMenuFront()
  54. {
  55. new PluginFileName[64];
  56.  
  57. get_plugin(-1, PluginFileName, charsmax(PluginFileName));
  58. new cvarflags;
  59. new cmdflags;
  60. new garbage[1];
  61. new cmd[32];
  62.  
  63. get_concmd(cmdmenu_cmdid, cmd, charsmax(cmd), cmdflags, garbage, charsmax(garbage), -1);
  64.  
  65. if (strcmp(cmd, "amx_plugincmdmenu") != 0)
  66. {
  67. // this should never happen, but just incase!
  68. cmdflags = ADMIN_MENU;
  69. }
  70. get_concmd(cvarmenu_cmdid, cmd, charsmax(cmd), cvarflags, garbage, charsmax(garbage), -1);
  71.  
  72. if (strcmp(cmd, "amx_plugincvarmenu") != 0)
  73. {
  74. // this should never happen, but just incase!
  75. cvarflags = ADMIN_CVAR;
  76. }
  77.  
  78. AddMenuItem("Plugin Cvars", "amx_plugincvarmenu", cvarflags, PluginFileName);
  79. // AddMenuItem("Plugin Commands", "amx_plugincmdmenu", cmdflags, PluginFileName);
  80. }
  81.  
  82. // Reset all fields for each client as they connect.
  83. public client_connect(id)
  84. {
  85. CurrentCvar[id]=0;
  86. CurrentPlid[id]=0;
  87. CurrentMenuFunction[id]=-1;
  88. CurrentCvarName[id][0]=0;
  89. CurrentCommand[id][0]=0;
  90. ExplicitPlugin[id]=-1;
  91.  
  92. }
  93.  
  94. /**
  95.  * Creates a plugin list menu.
  96.  *
  97.  * @param MenuText The text to display as the title.
  98.  * @param Handler The function to call when an item is selected.
  99.  * @param Command The function to pass to the handler. It will be passed as "PLID Command".
  100.  * @param Callback Function to call for each plugin to be listed. Displays a number next to it (how many cvars, etc.)
  101.  */
  102. stock DisplayPluginMenu(id,const MenuText[], const Handler[], const Command[], const Callback[])
  103. {
  104. new Menu=menu_create(MenuText,Handler);
  105.  
  106.  
  107. new PluginState[32];
  108. new PluginName[64];
  109. new func=get_func_id(Callback);
  110. new tally;
  111. new PluginCmd[64];
  112. new MenuText[64];
  113. for (new i=0, max=get_pluginsnum();
  114. i<max;
  115. i++)
  116. {
  117. if (callfunc_begin_i(func,-1)==1)
  118. {
  119. callfunc_push_int(i); // push the plid
  120. if ((tally=callfunc_end())>0)
  121. {
  122. get_plugin(i,"",0,PluginName,sizeof(PluginName)-1,"",0,"",0,PluginState,sizeof(PluginState)-1);
  123.  
  124. // Command syntax is: "# Function", # being plugin ID, function being public function to call.
  125. formatex(PluginCmd,sizeof(PluginCmd)-1,"%d %s",i,Command);
  126. formatex(MenuText,sizeof(MenuText)-1,"%s - %d",PluginName,tally);
  127. // If the plugin is running, add this as an activated menu item.
  128. if (strcmp(PluginState,"running",true)==0 ||
  129. strcmp(PluginState,"debug", true)==0)
  130. {
  131. menu_additem(Menu,MenuText,PluginCmd,EnabledCallback);
  132. }
  133. else
  134. {
  135. menu_additem(Menu,MenuText,"",_,DisabledCallback);
  136. }
  137. }
  138. }
  139. }
  140.  
  141. menu_setprop(Menu,MPROP_NUMBER_COLOR,"\y");
  142. menu_setprop(Menu,MPROP_EXIT,MEXIT_ALL);
  143. menu_display(id,Menu,0);
  144.  
  145. }
  146.  
  147. /**
  148.  * Byrefs the plugin id of a target plugin (passed by argv(1)), but only if it's valid.
  149.  *
  150.  * @param id id of the display messages to upon failure.
  151.  * @param plid Variable to byref the plugin id.
  152.  * @return True on successful lookup, false on failure.
  153.  */
  154. stock bool:GetPlidForValidPlugins(id, &plid)
  155. {
  156. // If arguments have been passed, then we were given
  157. // a specific plugin to examine.
  158. if (read_argc()>1)
  159. {
  160. // Yes, we were provided a plugin.
  161. new TargetPlugin[64];
  162. read_argv(1,TargetPlugin,sizeof(TargetPlugin)-1);
  163.  
  164. new BufferName[64];
  165. new BufferFile[64];
  166. new BufferState[64];
  167. // Scan for the plugin ID.
  168. for (new i=0, max=get_pluginsnum();
  169. i<max;
  170. i++)
  171. {
  172. get_plugin(i,BufferFile,sizeof(BufferFile)-1,BufferName,sizeof(BufferName)-1,"",0,"",0,BufferState,sizeof(BufferState)-1);
  173.  
  174. if (strcmp(BufferFile,TargetPlugin,true) != 0||
  175. strcmp(BufferName,TargetPlugin,true) != 0)
  176. {
  177. // We have a match.
  178.  
  179. // Check the status of the plugin. If it's anything other than "running" or "debug" fail.
  180. if (strcmp(BufferState,"running") != 0 &&
  181. strcmp(BufferState,"debug") != 0)
  182. {
  183. // TODO: ML This
  184. console_print(id,"Plugin ^"%s^" is not running.",BufferFile);
  185. // Return a failed state.
  186. return false;
  187. }
  188. plid=i;
  189. break;
  190. }
  191. }
  192.  
  193. // If the plugin was not found, then tell them there was an error.
  194. if (plid==-1)
  195. {
  196. console_print(id, "%L", id, "PAUSE_COULDNT_FIND", TargetPlugin);
  197.  
  198. // return a failure state
  199. return false;
  200. }
  201. }
  202.  
  203. return true;
  204. }
  205.  
  206. /**
  207.  * Returns the number of cvars available for a plugin by plid. (Callback for the plugin menu.)
  208.  *
  209.  * @return number of cvars in the plugin.
  210.  */
  211. public GetNumberOfCvarsForPlid(plid)
  212. {
  213. new count=0;
  214. new CvarPlid;
  215. for (new i=0, max=get_plugins_cvarsnum();
  216. i<max;
  217. i++)
  218. {
  219. get_plugins_cvar(i, "", 0,_, CvarPlid, _);
  220.  
  221. if (CvarPlid==plid)
  222. {
  223. count++;
  224. }
  225. }
  226.  
  227. return count;
  228. }
  229. /**
  230.  * Returns the number of commands available for a plugin by plid. (Callback for the plugin menu.)
  231.  *
  232.  * @return Number of valid commands in the plugin.
  233.  */
  234. public GetNumberOfCmdsForPlid(plid)
  235. {
  236. new count=0;
  237.  
  238. for (new i=0, max=get_concmdsnum(-1,-1);
  239. i<max;
  240. i++)
  241. {
  242. if (get_concmd_plid(i,-1,-1)==plid)
  243. {
  244. count++;
  245. }
  246. }
  247.  
  248. return count;
  249. }
  250.  
  251. /**
  252.  * Whether or not the client has access to modify this cvar.
  253.  *
  254.  * @param id The admin id.
  255.  * @param Cvar The name of the cvar to be checked.
  256.  * @return True if the client has access, false otherwise.
  257.  */
  258. stock bool:CanIModifyCvar(id, const Cvar[])
  259. {
  260. new UserFlags=get_user_flags(id);
  261. // If the user has rcon access don't bother checking anything.
  262. if (UserFlags & ADMIN_RCON)
  263. {
  264. return true;
  265. }
  266.  
  267. // If the cvar is "sv_password" (somehow), then check access.
  268. if (equali(Cvar,"sv_password") && UserFlags & ADMIN_PASSWORD)
  269. {
  270. return true;
  271. }
  272.  
  273. // Check to see if the cvar is flagged as protected.
  274. if (get_cvar_flags(Cvar) & FCVAR_PROTECTED)
  275. {
  276. // non-rcon user trying to modify a protected cvar.
  277. return false;
  278. }
  279.  
  280. // All known checks done, they can change this cvar if they
  281. // were able to open the menu.
  282. return true;
  283. }
  284.  
  285. /**
  286.  * Simple function to ensure that a menu item is always disabled.
  287.  *
  288.  * All parameters are dummy, nothing is used.
  289.  */
  290. public AlwaysDisableCallback(playerid, menuid, itemid)
  291. {
  292. return ITEM_DISABLED;
  293. }
  294. /**
  295.  * Simple function to ensure that a menu item is always enabled.
  296.  *
  297.  * All parameters are dummy, nothing is used.
  298.  */
  299. public AlwaysEnableCallback(playerid, menuid, itemid)
  300. {
  301. return ITEM_ENABLED;
  302. }
  303. /**
  304.  * Handler for the plugin menu.
  305.  *
  306.  * @param id The client selecting an item.
  307.  * @param menu The menu handle.
  308.  * @param item The item number that was selected.
  309.  */
  310. public PluginMenuSelection(id, menu, item)
  311. {
  312. if (item==MENU_EXIT)
  313. {
  314. menu_destroy(menu);
  315. }
  316. if (item<0)
  317. {
  318. return PLUGIN_HANDLED;
  319. }
  320.  
  321. new Command[64];
  322. new Dummy[1];
  323.  
  324. // All of the commands set for each item is the public
  325. // function that we want to call after the item is selected.
  326. // The parameters are: function(idPlayer,itemnumber)
  327. // Note the menu is destroyed BEFORE the command
  328. // gets executed.
  329. // The command retrieved is in the format: "PLID Command"
  330. menu_item_getinfo(menu, item, Dummy[0], Command, sizeof(Command)-1,Dummy,0,Dummy[0]);
  331.  
  332.  
  333. new plid=str_to_num(Command);
  334. new Function[32];
  335.  
  336. for (new i=0;i<sizeof(Command)-1;i++)
  337. {
  338. if (Command[i]==' ')
  339. {
  340. // we're at the break. move up one space.
  341. i++;
  342. copy(Function,sizeof(Function)-1,Command[i]);
  343. break;
  344. }
  345. }
  346.  
  347. menu_destroy(menu);
  348.  
  349. new funcid=get_func_id(Function);
  350. if (funcid != -1 && callfunc_begin_i(funcid)==1)
  351. {
  352. CurrentPage[id]=0;
  353. CurrentPlid[id]=plid;
  354. CurrentMenuFunction[id]=funcid;
  355. callfunc_push_int(id);
  356. callfunc_push_int(plid);
  357. callfunc_push_int(0);
  358. callfunc_end();
  359.  
  360. }
  361. return PLUGIN_HANDLED;
  362. }
  363.  
  364. /**
  365.  * The command to change a cvar has been called.
  366.  *
  367.  * @param id The client who is changing the cvar.
  368.  */
  369. public CommandChangeCvar(id)
  370. {
  371. // All access checks are done before this command is called.
  372. // So if the client has no pcvar pointer in his array slot
  373. // then just ignore the command.
  374. if (CurrentCvar[id]==0)
  375. {
  376. return PLUGIN_CONTINUE;
  377. }
  378.  
  379. new Args[256];
  380.  
  381. read_args(Args,sizeof(Args)-1);
  382.  
  383. remove_quotes(Args);
  384.  
  385. if (equali(Args,"!cancel",7))
  386. {
  387. // The client didn't want to change this cvar.
  388. client_print(id,print_chat,"[AMXX] Cvar not changed.");
  389. }
  390. else
  391. {
  392. // Changed to set_cvar_* for 1.76 tests
  393.  
  394. new pointer=CurrentCvar[id];
  395. set_pcvar_string(CurrentCvar[id],Args);
  396.  
  397. client_print(id,print_chat,"[AMXX] Cvar ^"%s^" changed to ^"%s^"",CurrentCvarName[id],Args);
  398.  
  399. // Copy of admincmd's global output.
  400.  
  401. new Name[32];
  402. new AuthID[40];
  403.  
  404. get_user_name(id,Name,sizeof(Name)-1);
  405. get_user_authid(id,AuthID,sizeof(AuthID)-1);
  406.  
  407. log_amx("Cmd: ^"%s<%d><%s><>^" set cvar (name ^"%s^") (value ^"%s^")", Name, get_user_userid(id), AuthID, CurrentCvarName[id], Args);
  408.  
  409.  
  410. new cvar_val[64];
  411. new maxpl = get_maxplayers();
  412. for (new i = 1; i <= maxpl; i++)
  413. {
  414. if (is_user_connected(i) && !is_user_bot(i))
  415. {
  416. if (get_pcvar_flags(pointer) & FCVAR_PROTECTED || equali(Args, "rcon_password"))
  417. {
  418. formatex(cvar_val, charsmax(cvar_val), "*** %L ***", i, "PROTECTED");
  419. }
  420. else
  421. {
  422. copy(cvar_val, charsmax(cvar_val), Args);
  423. }
  424. show_activity_id(i, id, Name, "%L", i, "SET_CVAR_TO", "", CurrentCvarName[id], cvar_val);
  425. }
  426. }
  427. console_print(id, "[AMXX] %L", id, "CVAR_CHANGED", CurrentCvarName[id], Args);
  428.  
  429. }
  430.  
  431. // Now redraw the menu for the client
  432. if (CurrentMenuFunction[id]!=-1 && callfunc_begin_i(CurrentMenuFunction[id])==1)
  433. {
  434. callfunc_push_int(id);
  435. callfunc_push_int(CurrentPlid[id]);
  436. callfunc_push_int(CurrentPage[id]);
  437. callfunc_end();
  438. }
  439.  
  440. return PLUGIN_HANDLED;
  441. }
  442.  
  443. /**
  444.  * Process a selection from the cvar menu.
  445.  *
  446.  * @param id The client who chose an item.
  447.  * @param menu The menu handle.
  448.  * @param item The item that has been selected.
  449.  */
  450. public CvarMenuSelection(id, menu, item)
  451. {
  452.  
  453. if (item==MENU_EXIT)
  454. {
  455. menu_destroy(menu);
  456.  
  457. if (ExplicitPlugin[id]==-1)
  458. {
  459. client_cmd(id,"amx_plugincvarmenu");
  460. }
  461. return PLUGIN_HANDLED;
  462. }
  463. else if (item==MENU_BACK)
  464. {
  465. --CurrentPage[id];
  466. client_print(id,print_chat,"MENU_BACK");
  467. return PLUGIN_HANDLED;
  468. }
  469. else if (item==MENU_MORE)
  470. {
  471. ++CurrentPage[id];
  472. client_print(id,print_chat,"MENU_MORE");
  473. return PLUGIN_HANDLED;
  474. }
  475. else
  476. {
  477. new CvarName[64];
  478. new Command[32];
  479. new Dummy[1];
  480. // pcvar pointer is stored in command, extract the name of the cvar from the name field.
  481. menu_item_getinfo(menu, item, Dummy[0], Command, sizeof(Command)-1,CvarName,sizeof(CvarName)-1,Dummy[0]);
  482.  
  483. CurrentCvar[id]=str_to_num(Command);
  484.  
  485. if (CurrentCvar[id]==0) // This should never happen, but just incase..
  486. {
  487. client_print(id,print_chat,"[AMXX] There was an error extracting the cvar pointer. (Name=^"%s^")",CvarName);
  488. return PLUGIN_HANDLED;
  489. }
  490. // TODO: ML this
  491.  
  492. // Scan up "CvarName" and stop at the first space
  493. for (new i=0;i<sizeof(CvarName)-1;i++)
  494. {
  495. if (CvarName[i]==' ')
  496. {
  497. CvarName[i]='^0';
  498. break;
  499. }
  500. }
  501. copy(CurrentCvarName[id],sizeof(CurrentCvarName[])-1,CvarName);
  502. client_print(id,print_chat,"[AMXX] Type in the new value for %s, or !cancel to cancel.",CvarName);
  503. client_cmd(id,"messagemode amx_changecvar");
  504.  
  505. menu_destroy(menu);
  506. return PLUGIN_HANDLED;
  507. }
  508.  
  509. return 0;
  510. }
  511. /**
  512.  * Displays the cvar menu to a client.
  513.  *
  514.  * @param id id of the client.
  515.  * @param plid Plugin ID to display cvars from.
  516.  * @param page Page of the menu to start at.
  517.  */
  518. public DisplayCvarMenu(id, plid, page)
  519. {
  520. new PluginName[32];
  521. new MenuTitle[64];
  522. get_plugin(plid,"",0,PluginName,sizeof(PluginName)-1,"",0,"",0,"",0);
  523.  
  524. formatex(MenuTitle,sizeof(MenuTitle)-1,"%s Cvars:",PluginName);
  525.  
  526. new Menu=menu_create(MenuTitle,"CvarMenuSelection");
  527.  
  528. new Cvar[64];
  529. new CvarPlid;
  530. new CvarText[64];
  531. new CvarData[32];
  532. new CvarPtr;
  533.  
  534. for (new i=0, max=get_plugins_cvarsnum();
  535. i<max;
  536. i++)
  537. {
  538. get_plugins_cvar(i, Cvar, sizeof(Cvar),_, CvarPlid, CvarPtr);
  539.  
  540. if (CvarPlid==plid)
  541. {
  542. if (CanIModifyCvar(id,Cvar))
  543. {
  544. get_pcvar_string(CvarPtr,CvarData,sizeof(CvarData)-1);
  545. formatex(CvarText,sizeof(CvarText)-1,"%s - %s",Cvar,CvarData);
  546.  
  547. // Now store the pcvar data in Cvar
  548. num_to_str(CvarPtr,Cvar,sizeof(Cvar)-1);
  549. menu_additem(Menu,CvarText,Cvar,_,EnabledCallback);
  550. }
  551. else
  552. {
  553. menu_additem(Menu,Cvar,"",_,DisabledCallback);
  554. }
  555.  
  556. }
  557. }
  558.  
  559. menu_setprop(Menu,MPROP_EXIT,MEXIT_ALL);
  560. menu_setprop(Menu,MPROP_NUMBER_COLOR,"\y");
  561. menu_display(id,Menu,page);
  562.  
  563. }
  564. /**
  565.  * Process the "amx_plugincvarmenu" command.
  566.  *
  567.  * @param id id of the client that is calling the command.
  568.  * @param level Access level required by the command.
  569.  * @param cid Command ID.
  570.  */
  571. public CvarMenuCommand(id, level, cid)
  572. {
  573. if (!cmd_access(id,level,cid,0))
  574. {
  575. return PLUGIN_HANDLED;
  576. }
  577.  
  578. // This is which plugin to display. -1 means display all plugins in a list.
  579. new plid=-1;
  580.  
  581. if (GetPlidForValidPlugins(id,plid)!=true)
  582. {
  583. // If GetPlidForValidPlugins returns false then it failed to find the plugin.
  584. return PLUGIN_HANDLED;
  585. }
  586.  
  587. // Check if we were passed a specific plugin to display or not.
  588. if (plid==-1)
  589. {
  590. ExplicitPlugin[id]=-1;
  591. // We need to display a list of the plugins, instead of a specific plugin.
  592. DisplayPluginMenu(id,"Plugin Cvar Menu:", "PluginMenuSelection","DisplayCvarMenu","GetNumberOfCvarsForPlid");
  593. }
  594. else
  595. {
  596. ExplicitPlugin[id]=plid;
  597. CurrentPlid[id]=plid;
  598. CurrentPage[id]=0;
  599. DisplayCvarMenu(id,plid,0);
  600. }
  601. return PLUGIN_HANDLED;
  602. }
  603. /**
  604.  * Handler for the menu that displays a single command ("Execute with no params", etc).
  605.  *
  606.  * @param id Id of the client.
  607.  * @param menu Menu handle.
  608.  * @param item Item that was selected.
  609.  */
  610. public SpecificCommandHandler(id,menu,item)
  611. {
  612. // Exit was called, return to the previous menu.
  613. if (item<0)
  614. {
  615. if (CurrentMenuFunction[id]!=-1 && callfunc_begin_i(CurrentMenuFunction[id])==1)
  616. {
  617. callfunc_push_int(id);
  618. callfunc_push_int(CurrentPlid[id]);
  619. callfunc_push_int(CurrentPage[id]);
  620. callfunc_end();
  621. }
  622. menu_destroy(menu);
  623.  
  624. return PLUGIN_HANDLED;
  625. }
  626.  
  627. new Dummy[1];
  628. if (item==0) // "With params"
  629. {
  630. menu_item_getinfo(menu, item, Dummy[0], CurrentCommand[id], sizeof(CurrentCommand[])-1,"",0,Dummy[0]);
  631. if (CurrentCommand[id][0]==0) // This should never happen, but just incase..
  632. {
  633. client_print(id,print_chat,"[AMXX] There was an error extracting the command name.");
  634. return PLUGIN_HANDLED;
  635. }
  636. // TODO: ML this
  637.  
  638. client_print(id,print_chat,"[AMXX] Type in the parameters for %s, or !cancel to cancel.",CurrentCommand[id]);
  639. client_cmd(id,"messagemode amx_executecmd");
  640.  
  641. menu_destroy(menu);
  642.  
  643. return PLUGIN_HANDLED; // Don't return to original menu immediately!
  644. }
  645. else if (item==1) // "No params"
  646. {
  647. menu_item_getinfo(menu, item, Dummy[0], CurrentCommand[id], sizeof(CurrentCommand[])-1,"",0,Dummy[0]);
  648. if (CurrentCommand[id][0]==0) // This should never happen, but just incase..
  649. {
  650. client_print(id,print_chat,"[AMXX] There was an error extracting the command name.");
  651. return PLUGIN_HANDLED;
  652. }
  653. // TODO: ML this
  654.  
  655. // Now redraw the menu for the client BEFORE the command is executed, incase
  656. // that menu brings up a menu of its own.
  657. if (CurrentMenuFunction[id]!=-1 && callfunc_begin_i(CurrentMenuFunction[id])==1)
  658. {
  659. callfunc_push_int(id);
  660. callfunc_push_int(CurrentPlid[id]);
  661. callfunc_push_int(CurrentPage[id]);
  662. callfunc_end();
  663. }
  664. menu_destroy(menu);
  665.  
  666. client_cmd(id,"%s",CurrentCommand[id]);
  667. client_print(id,print_chat,"[AMXX] Command ^"%s^" executed with no parameters",CurrentCommand[id]);
  668.  
  669. return PLUGIN_HANDLED;
  670. }
  671.  
  672. // We should never get here, but just incase..
  673. menu_destroy(menu);
  674.  
  675. return PLUGIN_HANDLED;
  676. }
  677.  
  678. /**
  679.  * Generates and displays a menu to the client for a specific command.
  680.  *
  681.  * @param id The client to display the menu to.
  682.  * @param cid The command id to display.
  683.  */
  684. stock DisplaySpecificCommand(id,cid)
  685. {
  686. new CommandName[64];
  687. new CommandDesc[128];
  688. new CommandTitle[256];
  689. new CommandAccess;
  690. new Menu;
  691.  
  692. get_concmd(cid,CommandName,sizeof(CommandName)-1,CommandAccess, CommandDesc,sizeof(CommandDesc)-1, -1, -1);
  693.  
  694. if (CommandDesc[0]!='^0')
  695. {
  696. formatex(CommandTitle,sizeof(CommandTitle)-1,"%s^n%s",CommandName,CommandDesc);
  697. Menu=menu_create(CommandTitle,"SpecificCommandHandler");
  698. }
  699. else
  700. {
  701. Menu=menu_create(CommandName,"SpecificCommandHandler");
  702. }
  703. menu_additem(Menu,"Execute with parameters.",CommandName,_,EnabledCallback);
  704. menu_additem(Menu,"Execute with no parameters.",CommandName,_,EnabledCallback);
  705.  
  706. menu_setprop(Menu,MPROP_NUMBER_COLOR,"\y");
  707. menu_display(id,Menu,0);
  708. }
  709.  
  710. /**
  711.  * Handles the executed command (via "amx_executecmd").
  712.  *
  713.  * @param id The id of the client who executed this.
  714.  */
  715. public CommandExecuteCommand(id)
  716. {
  717. // If they had no command stored, then just ignore it entirely.
  718. if (CurrentCommand[id][0]=='^0')
  719. {
  720. return PLUGIN_CONTINUE;
  721. }
  722.  
  723. new Args[256];
  724.  
  725. read_args(Args,sizeof(Args)-1);
  726.  
  727. remove_quotes(Args);
  728.  
  729. if (equali(Args,"!cancel",7))
  730. {
  731. // The client didn't want to execute this command.
  732. client_print(id,print_chat,"[AMXX] Command not executed.");
  733.  
  734. // Now redraw the menu for the client
  735. if (CurrentMenuFunction[id]!=-1 && callfunc_begin_i(CurrentMenuFunction[id])==1)
  736. {
  737. callfunc_push_int(id);
  738. callfunc_push_int(CurrentPlid[id]);
  739. callfunc_push_int(CurrentPage[id]);
  740. callfunc_end();
  741. }
  742.  
  743. }
  744. else
  745. {
  746. // TODO: ML
  747. client_print(id,print_chat,"[AMXX] Command ^"%s^" executed with ^"%s^"",CurrentCommand[id],Args);
  748.  
  749. // Now redraw the menu for the client
  750. if (CurrentMenuFunction[id]!=-1 && callfunc_begin_i(CurrentMenuFunction[id])==1)
  751. {
  752. callfunc_push_int(id);
  753. callfunc_push_int(CurrentPlid[id]);
  754. callfunc_push_int(CurrentPage[id]);
  755. callfunc_end();
  756. }
  757.  
  758. // Execute the command on the client.
  759. client_cmd(id,"%s %s",CurrentCommand[id],Args);
  760. }
  761.  
  762.  
  763. return PLUGIN_HANDLED;
  764.  
  765. }
  766.  
  767. /**
  768.  * Handle a specific selection from the command menu.
  769.  *
  770.  * @param id id of the client who made the selection.
  771.  * @param menu The menu handle.
  772.  * @param item The item that was selected.
  773.  */
  774. public CommandMenuSelection(id, menu, item)
  775. {
  776.  
  777. if (item==MENU_EXIT)
  778. {
  779. menu_destroy(menu);
  780.  
  781. // If the player did not explicitly specify a plugin, return them to the
  782. // plugin selection menu.
  783.  
  784. if (ExplicitPlugin[id]==-1)
  785. {
  786. client_cmd(id,"amx_plugincmdmenu");
  787. }
  788. return PLUGIN_HANDLED;
  789. }
  790. else if (item==MENU_BACK)
  791. {
  792. --CurrentPage[id];
  793. client_print(id,print_chat,"MENU_BACK");
  794. return PLUGIN_HANDLED;
  795. }
  796. else if (item==MENU_MORE)
  797. {
  798. ++CurrentPage[id];
  799. client_print(id,print_chat,"MENU_MORE");
  800. return PLUGIN_HANDLED;
  801. }
  802. else
  803. {
  804. new Command[32];
  805. new Dummy[1];
  806. // pcvar pointer is stored in command, extract the name of the cvar from the name field.
  807. menu_item_getinfo(menu, item, Dummy[0], Command, sizeof(Command)-1,"",0,Dummy[0]);
  808.  
  809. menu_destroy(menu);
  810.  
  811. DisplaySpecificCommand(id,str_to_num(Command));
  812. return PLUGIN_HANDLED;
  813. }
  814.  
  815. return 0;
  816. }
  817. /**
  818.  * This blocks "say" and "say_team" commands.
  819.  * Other commands that shouldn't be displayed (eg: amxauth<stuff>) should be filtered out already.
  820.  *
  821.  * @param Command The command that is being checked.
  822.  */
  823. stock bool:IsDisplayableCmd(const Command[])
  824. {
  825. // Block "say" and "say_team"
  826. if (equal(Command,"say",3))
  827. {
  828. return false;
  829. }
  830.  
  831. return true;
  832. }
  833. /**
  834.  * Displays a command list for the specified plugin.
  835.  *
  836.  * @param id Id of the client that's being displayed to.
  837.  * @param plid Plugin ID of the plugin that is to be displayed.
  838.  * @param page The page to start at.
  839.  */
  840. public DisplayCmdMenu(id, plid, page)
  841. {
  842. new PluginName[32];
  843. new MenuTitle[64];
  844. get_plugin(plid,"",0,PluginName,sizeof(PluginName)-1,"",0,"",0,"",0);
  845.  
  846. formatex(MenuTitle,sizeof(MenuTitle)-1,"%s Commands:",PluginName);
  847.  
  848. new Menu=menu_create(MenuTitle,"CommandMenuSelection");
  849.  
  850. new Command[64];
  851. new CidString[32];
  852. new CommandAccess;
  853. new userflags=get_user_flags(id);
  854. new bool:isadmin=bool:is_user_admin(id);
  855.  
  856.  
  857. for (new i=0, max=get_concmdsnum(-1,-1);
  858. i<max;
  859. i++)
  860. {
  861. if (get_concmd_plid(i,-1,-1)==plid)
  862. {
  863. get_concmd(i,Command,sizeof(Command)-1,CommandAccess, "",0, -1, -1);
  864.  
  865. if (IsDisplayableCmd(Command))
  866. {
  867. if ( userflags & CommandAccess ||
  868. (CommandAccess==ADMIN_ADMIN && isadmin) ||
  869. CommandAccess==ADMIN_USER ||
  870. CommandAccess==ADMIN_ALL)
  871. {
  872. num_to_str(i,CidString,sizeof(CidString)-1);
  873. menu_additem(Menu,Command,CidString,0,EnabledCallback);
  874. }
  875. else
  876. {
  877. menu_additem(Menu,Command,"",0,DisabledCallback);
  878. }
  879. }
  880. }
  881. }
  882. menu_setprop(Menu,MPROP_NUMBER_COLOR,"\y");
  883. menu_display(id,Menu,page);
  884.  
  885. }
  886. /**
  887.  * Handles the "amx_plugincmdmenu" command.
  888.  *
  889.  * @param id Id of the client that's being checked.
  890.  * @param level Access level of the command.
  891.  * @param cid Command ID of the command that was executed.
  892.  */
  893. public CommandMenuCommand(id, level, cid)
  894. {
  895. if (!cmd_access(id,level,cid,0))
  896. {
  897. return PLUGIN_HANDLED;
  898. }
  899.  
  900. // This is which plugin to display. -1 means display all plugins in a list.
  901. new plid=-1;
  902.  
  903. if (GetPlidForValidPlugins(id,plid)!=true)
  904. {
  905. // If GetPlidForValidPlugins returns false then it failed to find the plugin.
  906. return PLUGIN_HANDLED;
  907. }
  908.  
  909. // Check if we were passed a specific plugin to display or not.
  910. if (plid==-1)
  911. {
  912. // We need to display a list of the plugins, instead of a specific plugin.
  913. ExplicitPlugin[id]=-1;
  914. DisplayPluginMenu(id,"Plugin Command Menu:", "PluginMenuSelection","DisplayCmdMenu","GetNumberOfCmdsForPlid");
  915. }
  916. else
  917. {
  918. ExplicitPlugin[id]=plid;
  919. CurrentPlid[id]=plid;
  920. CurrentPage[id]=0;
  921. DisplayCmdMenu(id,plid,0);
  922. }
  923. return PLUGIN_HANDLED;
  924. }
  925.  

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Plugin commands kivétele!
HozzászólásElküldve:2013.04.17. 19:43 
Offline
Jómunkásember
Avatar

Csatlakozott:2013.03.07. 18:39
Hozzászólások:352
Megköszönt másnak: 3 alkalommal
Megköszönték neki: 38 alkalommal
Ennek a pluginnak mi az alap neve?


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Plugin commands kivétele!
HozzászólásElküldve:2013.04.17. 19:45 
Offline
Őskövület
Avatar

Csatlakozott:2012.03.22. 18:22
Hozzászólások:2978
Megköszönt másnak: 118 alkalommal
Megköszönték neki: 368 alkalommal
Plugin Menu

_________________
Blasenkampfwagen

https://discord.gg/uBYnNnZP
GTA:PURSUIT MTA


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Plugin commands kivétele!
HozzászólásElküldve:2013.04.17. 19:46 
Offline
Őstag
Avatar

Csatlakozott:2010.04.16. 16:50
Hozzászólások:1342
Megköszönt másnak: 42 alkalommal
Megköszönték neki: 58 alkalommal
alap menufront, tessék !
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #define MAXMENUS 128
  5. #define STRINGSIZE 32
  6. #define STRINGLENGTH STRINGSIZE - 1
  7. #define MENUITEMSPERPAGE 8
  8. //#define MENUS_NUMBER 16
  9.  
  10. new g_menuPosition[33]
  11. new g_menusNumber = 0
  12. new g_menuBody[MAXMENUS][STRINGSIZE]
  13. new bool:g_menuBodyPhrase[MAXMENUS]
  14. new g_menuCmd[MAXMENUS][STRINGSIZE]
  15. new g_menuAccess[MAXMENUS]
  16. new g_menuPlugin[MAXMENUS][STRINGSIZE]
  17.  
  18. new g_coloredMenus
  19.  
  20. new g_clientMenuPosition[33]
  21. new g_clientMenusNumber = 0
  22. new g_clientMenuBody[MAXMENUS][STRINGSIZE]
  23. new bool:g_clientMenuBodyPhrase[MAXMENUS]
  24. new g_clientMenuCmd[MAXMENUS][STRINGSIZE]
  25. new g_clientMenuAccess[MAXMENUS]
  26. new g_clientMenuPlugin[MAXMENUS][STRINGSIZE]
  27.  
  28. // menuBody: Text that will be shown for this item in menu
  29. // menuCmd: Command that should be executed to start menu
  30. // menuAccess: Access required for menu
  31. // menuPlugin: The exact case-insensitive name of plugin holding the menu command
  32. public AddMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
  33. {
  34. if (g_menusNumber + 1 == MAXMENUS)
  35. {
  36. log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
  37. return
  38. }
  39.  
  40. copy(g_menuBody[g_menusNumber], STRINGLENGTH, menuBody)
  41. g_menuBodyPhrase[g_menusNumber] = false
  42.  
  43. copy(g_menuCmd[g_menusNumber], STRINGLENGTH, menuCmd)
  44. g_menuAccess[g_menusNumber] = menuAccess
  45.  
  46. copy(g_menuPlugin[g_menusNumber], STRINGLENGTH, menuPlugin)
  47.  
  48. g_menusNumber++
  49. server_print("Menu item %d added to Menus Front-End: ^"%s^" from plugin ^"%s^"", g_menusNumber, menuBody, menuPlugin)
  50. }
  51.  
  52. public AddMenuLang(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
  53. {
  54. if (g_menusNumber + 1 == MAXMENUS)
  55. {
  56. log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
  57. return
  58. }
  59.  
  60. copy(g_menuBody[g_menusNumber], STRINGLENGTH, menuBody)
  61. g_menuBodyPhrase[g_menusNumber] = true
  62.  
  63. copy(g_menuCmd[g_menusNumber], STRINGLENGTH, menuCmd)
  64. g_menuAccess[g_menusNumber] = menuAccess
  65.  
  66. copy(g_menuPlugin[g_menusNumber], STRINGLENGTH, menuPlugin)
  67. g_menusNumber++
  68.  
  69. //server_print("Menu item %d added to Menus Front-End: ^"%s^" (LANG) from plugin ^"%s^"", g_menusNumber, menuBody, menuPlugin)
  70. }
  71.  
  72. public AddClientMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
  73. {
  74. if (g_clientMenusNumber + 1 == MAXMENUS)
  75. {
  76. log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
  77. return
  78. }
  79.  
  80. copy(g_clientMenuBody[g_clientMenusNumber], STRINGLENGTH, menuBody)
  81. g_clientMenuBodyPhrase[g_clientMenusNumber] = false
  82.  
  83. copy(g_clientMenuCmd[g_clientMenusNumber], STRINGLENGTH, menuCmd)
  84. g_clientMenuAccess[g_clientMenusNumber] = menuAccess
  85.  
  86. copy(g_clientMenuPlugin[g_clientMenusNumber], STRINGLENGTH, menuPlugin)
  87.  
  88. g_clientMenusNumber++
  89. server_print("Client menu item %d added to Client Menus Front-End: ^"%s^" from plugin ^"%s^"", g_clientMenusNumber, menuBody, menuPlugin)
  90. }
  91.  
  92. AddDefaultMenus()
  93. {
  94. new flags;
  95. AddMenuLang("KICK_PLAYER", "amx_kickmenu", get_clcmd_flags("amx_kickmenu", flags) ? flags : ADMIN_KICK , "Players Menu")
  96. AddMenuLang("BAN_PLAYER", "amx_banmenu", get_clcmd_flags("amx_banmenu", flags) ? flags : ADMIN_BAN, "Players Menu")
  97. AddMenuLang("SLAP_SLAY", "amx_slapmenu", get_clcmd_flags("amx_slapmenu", flags) ? flags : ADMIN_SLAY, "Players Menu")
  98. AddMenuLang("TEAM_PLAYER", "amx_teammenu", get_clcmd_flags("amx_teammenu", flags) ? flags : ADMIN_LEVEL_A, "Players Menu")
  99. AddMenuLang("CHANGEL", "amx_mapmenu", get_clcmd_flags("amx_mapmenu", flags) ? flags : ADMIN_MAP, "Maps Menu")
  100. AddMenuLang("VOTE_MAPS", "amx_votemapmenu", get_clcmd_flags("amx_votemapmenu", flags) ? flags : ADMIN_VOTE, "Maps Menu")
  101. AddMenuLang("SPECH_STUFF", "amx_speechmenu", get_clcmd_flags("amx_speechmenu", flags) ? flags : ADMIN_MENU, "Commands Menu")
  102. AddMenuLang("CLIENT_COM", "amx_clcmdmenu", get_clcmd_flags("amx_clcmdmenu", flags) ? flags : ADMIN_LEVEL_A, "Players Menu")
  103. AddMenuLang("SERVER_COM", "amx_cmdmenu", get_clcmd_flags("amx_cmdmenu", flags) ? flags : ADMIN_MENU, "Commands Menu")
  104. AddMenuLang("CVARS_SET", "amx_cvarmenu", get_clcmd_flags("amx_cvarmenu", flags) ? flags : ADMIN_CVAR, "Commands Menu")
  105. AddMenuLang("CONFIG", "amx_cfgmenu", get_clcmd_flags("amx_cfgmenu", flags) ? flags : ADMIN_MENU, "Commands Menu")
  106. AddMenuLang("LANG_SET", "amx_langmenu", get_clcmd_flags("amx_langmenu", flags) ? flags : ADMIN_CFG, "Multi-Lingual System")
  107. AddMenuLang("STATS_SET", "amx_statscfgmenu", get_clcmd_flags("amx_statscfgmenu", flags) ? flags : ADMIN_CFG, "Stats Configuration")
  108. AddMenuLang("PAUSE_PLUG", "amx_pausecfgmenu", get_clcmd_flags("amx_pausecfgmenu", flags) ? flags : ADMIN_CFG, "Pause Plugins")
  109. AddMenuLang("RES_WEAP", "amx_restmenu", get_clcmd_flags("amx_restmenu", flags) ? flags : ADMIN_CFG, "Restrict Weapons")
  110. AddMenuLang("TELE_PLAYER", "amx_teleportmenu", get_clcmd_flags("amx_teleportmenu", flags) ? flags : ADMIN_CFG, "Teleport Menu")
  111. }
  112. stock bool:get_clcmd_flags(const search_command[], &flags)
  113. {
  114. new count = get_clcmdsnum(-1);
  115. static cmd[128];
  116. static info[1];
  117. new _flags;
  118.  
  119. for (new i = 0; i < count; i++)
  120. {
  121. get_clcmd(i, cmd, charsmax(cmd), _flags, info, charsmax(info), -1);
  122.  
  123. if (strcmp(cmd, search_command) == 0)
  124. {
  125. flags = _flags;
  126. return true;
  127. }
  128. }
  129.  
  130. return false;
  131. }
  132. public actionMenu(id, key)
  133. {
  134. switch (key)
  135. {
  136. case 8: displayMenu(id, ++g_menuPosition[id])
  137. case 9: displayMenu(id, --g_menuPosition[id])
  138. default: client_cmd(id, "%s", g_menuCmd[g_menuPosition[id] * 8 + key])
  139. }
  140.  
  141. return PLUGIN_HANDLED
  142. }
  143.  
  144. public clientActionMenu(id, key)
  145. {
  146. switch (key)
  147. {
  148. case 8: clientDisplayMenu(id, ++g_clientMenuPosition[id])
  149. case 9: clientDisplayMenu(id, --g_clientMenuPosition[id])
  150. default: client_cmd(id, "%s", g_clientMenuCmd[g_clientMenuPosition[id] * 8 + key])
  151. }
  152.  
  153. return PLUGIN_HANDLED
  154. }
  155.  
  156. displayMenu(id, pos)
  157. {
  158. if (pos < 0)
  159. return
  160.  
  161. new menuBody[512]
  162. new b = 0
  163. new start = pos * MENUITEMSPERPAGE
  164.  
  165. if (start >= g_menusNumber) // MENUS_NUMBER
  166. start = pos = g_menuPosition[id] = 0
  167.  
  168. new len = format(menuBody, 511,
  169.  
  170. g_coloredMenus ? "\yAMX Mod X Menu\R%d/%d^n\w^n" : "AMX Mod X Menu %d/%d^n^n" , pos + 1, (g_menusNumber / MENUITEMSPERPAGE) + (((g_menusNumber % MENUITEMSPERPAGE) > 0) ? 1 : 0))
  171.  
  172. new end = start + MENUITEMSPERPAGE
  173. new keys = MENU_KEY_0
  174.  
  175. if (end > g_menusNumber) // MENUS_NUMBER
  176. end = g_menusNumber // MENUS_NUMBER
  177.  
  178. for (new a = start; a < end; ++a)
  179. {
  180. if ( access(id, g_menuAccess[a]) &&
  181. ((is_plugin_loaded(g_menuPlugin[a]) != -1) || // search plugins for registered name
  182. (is_plugin_loaded(g_menuPlugin[a], true) != -1))) // search plugins for filename
  183. {
  184. keys |= (1<<b)
  185.  
  186. if (g_menuBodyPhrase[a])
  187. len += format(menuBody[len], 511-len, "%d. %L^n", ++b, id, g_menuBody[a])
  188. else
  189. len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_menuBody[a])
  190. } else {
  191. ++b
  192.  
  193. if (g_coloredMenus)
  194. {
  195. if (g_menuBodyPhrase[a])
  196. len += format(menuBody[len], 511-len, "\d%d. %L^n\w", b, id, g_menuBody[a])
  197. else
  198. len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, g_menuBody[a])
  199. } else {
  200. if (g_menuBodyPhrase[a])
  201. len += format(menuBody[len], 511-len, "#. %L^n", id, g_menuBody[a])
  202. else
  203. len += format(menuBody[len], 511-len, "#. %s^n", g_menuBody[a])
  204. }
  205. }
  206. }
  207.  
  208. if (end != g_menusNumber) // MENUS_NUMBER
  209. {
  210. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  211. keys |= MENU_KEY_9
  212. } else {
  213. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  214. }
  215.  
  216. show_menu(id, keys, menuBody)
  217. }
  218.  
  219. clientDisplayMenu(id, pos)
  220. {
  221. if (pos < 0)
  222. return
  223.  
  224. new menuBody[512]
  225. new b = 0
  226. new start = pos * MENUITEMSPERPAGE
  227.  
  228. if (start >= g_clientMenusNumber) // MENUS_NUMBER
  229. start = pos = g_clientMenuPosition[id] = 0
  230.  
  231. new len = format(menuBody, 511, g_coloredMenus ? "\yAMX Mod X Client Menu\R%d/%d^n\w^n" : "AMX Mod X Client Menu %d/%d^n^n" , pos + 1, (g_clientMenusNumber / MENUITEMSPERPAGE) + (((g_clientMenusNumber % MENUITEMSPERPAGE) > 0) ? 1 : 0))
  232.  
  233. new end = start + MENUITEMSPERPAGE
  234. new keys = MENU_KEY_0
  235.  
  236. if (end > g_clientMenusNumber) // MENUS_NUMBER
  237. end = g_clientMenusNumber // MENUS_NUMBER
  238.  
  239. for (new a = start; a < end; ++a)
  240. {
  241. if ( access(id, g_clientMenuAccess[a]) &&
  242. ((is_plugin_loaded(g_clientMenuPlugin[a]) != -1) || // search plugins for registered name
  243. (is_plugin_loaded(g_clientMenuPlugin[a], true) != -1))) // search plugins for file name
  244. {
  245. keys |= (1<<b)
  246.  
  247. if (g_clientMenuBodyPhrase[a])
  248. len += format(menuBody[len], 511-len, "%d. %L^n", ++b, id, g_clientMenuBody[a])
  249. else
  250. len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_clientMenuBody[a])
  251. } else {
  252. ++b
  253.  
  254. if (g_coloredMenus)
  255. {
  256. if (g_clientMenuBodyPhrase[a])
  257. len += format(menuBody[len], 511-len, "\d%d. %L^n\w", b, id, g_clientMenuBody[a])
  258. else
  259. len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, g_clientMenuBody[a])
  260. } else {
  261. if (g_clientMenuBodyPhrase[a])
  262. len += format(menuBody[len], 511-len, "#. %L^n", id, g_clientMenuBody[a])
  263. else
  264. len += format(menuBody[len], 511-len, "#. %s^n", g_clientMenuBody[a])
  265. }
  266. }
  267. }
  268.  
  269. if (end != g_clientMenusNumber) // MENUS_NUMBER
  270. {
  271. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
  272. keys |= MENU_KEY_9
  273. }
  274. else {
  275. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
  276. }
  277.  
  278. show_menu(id, keys, menuBody)
  279. }
  280.  
  281. public cmdMenu(id, level, cid)
  282. {
  283. if (cmd_access(id, level, cid, 1))
  284. displayMenu(id, g_menuPosition[id] = 0)
  285.  
  286. return PLUGIN_HANDLED
  287. }
  288. public clientCmdMenu(id, level, cid)
  289. {
  290. if (cmd_access(id, level, cid, 1))
  291. clientDisplayMenu(id, g_clientMenuPosition[id] = 0)
  292.  
  293. return PLUGIN_HANDLED
  294. }
  295.  
  296. public addmenuitem_cmd(id, level, cid)
  297. {
  298. if (!cmd_access(id, level, cid, 5))
  299. return PLUGIN_HANDLED
  300.  
  301. // AddMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
  302. new menuBody[STRINGSIZE], menuCmd[STRINGSIZE], flags[STRINGSIZE], menuAccess = 0, menuPlugin[STRINGSIZE]
  303. read_argv(1, menuBody, STRINGLENGTH)
  304. read_argv(2, menuCmd, STRINGLENGTH)
  305. read_argv(3, flags, STRINGLENGTH)
  306. menuAccess = read_flags(flags)
  307. read_argv(4, menuPlugin, STRINGLENGTH)
  308.  
  309. AddMenu(menuBody, menuCmd, menuAccess, menuPlugin)
  310.  
  311. return PLUGIN_HANDLED
  312. }
  313.  
  314. public addclientmenuitem_cmd(id, level, cid)
  315. {
  316. if (!cmd_access(id, level, cid, 5))
  317. return PLUGIN_HANDLED
  318.  
  319. // AddMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
  320. new menuBody[STRINGSIZE], menuCmd[STRINGSIZE], flags[STRINGSIZE], menuAccess = 0, menuPlugin[STRINGSIZE]
  321. read_argv(1, menuBody, STRINGLENGTH)
  322. read_argv(2, menuCmd, STRINGLENGTH)
  323. read_argv(3, flags, STRINGLENGTH)
  324. menuAccess = read_flags(flags)
  325. read_argv(4, menuPlugin, STRINGLENGTH)
  326.  
  327. AddClientMenu(menuBody, menuCmd, menuAccess, menuPlugin)
  328.  
  329. return PLUGIN_HANDLED
  330. }
  331.  
  332. public plugin_init()
  333. {
  334. register_plugin("Menus Front-End", AMXX_VERSION_STR, "AMXX Dev Team")
  335. register_dictionary("menufront.txt")
  336. register_dictionary("common.txt")
  337.  
  338. register_menucmd(register_menuid("AMX Mod X Menu"), 1023, "actionMenu")
  339. register_menucmd(register_menuid("AMX Mod X Client Menu"), 1023, "clientActionMenu")
  340. register_clcmd("amxmodmenu", "cmdMenu", ADMIN_MENU, "- displays menus")
  341. register_clcmd("amx_menu", "clientCmdMenu", 0, "- displays menus available to client")
  342.  
  343. register_srvcmd("amx_addmenuitem", "addmenuitem_cmd", 0, "<menu text> <menu command> <access flags> <plugin name | plugin filename> - Add a menu item to Menus Front-End")
  344. register_srvcmd("amx_addclientmenuitem", "addclientmenuitem_cmd", 0, "<menu text> <menu command> <access flags> <plugin name | plugin filename> - Add a menu item to Client Menus Front-End")
  345.  
  346. g_coloredMenus = colored_menus()
  347.  
  348.  
  349. }
  350. public plugin_cfg()
  351. {
  352. AddDefaultMenus()
  353.  
  354. new configs[128]
  355. get_configsdir(configs, 127)
  356. server_cmd("exec %s/custommenuitems.cfg", configs)
  357. }
  358.  

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Plugin commands kivétele!
HozzászólásElküldve:2013.04.17. 19:56 
Offline
Jómunkásember
Avatar

Csatlakozott:2013.03.07. 18:39
Hozzászólások:352
Megköszönt másnak: 3 alkalommal
Megköszönték neki: 38 alkalommal
Köszi mindenki.
Működik!


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  [10 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 28 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