menu_item_getinfo function problem
In "my" version of CSDM (latest version called as 2.1.3c) I'm using couple of menus to let the user/admin change setting via them.
One of such menus is CSDM Settings Menu. This is the part of code to invoke/use it: Code:
public plugin_init() It was working for sure with AMXMODX 1.8.0 version, but it stopped probably with 1.8.2 (for both - CS1.6/CZERO). It looks like the function "menu_item_getinfo" started working a bit different way, beacuse if I'm shorting the name of my command "csdm_sett_menu" to for example "csdm_smenu" (in all paces of above code) it works again. The change of the string length of "command" didn't help even if I doubled it. Dunno if this is the bug in the function "menu_item_getinfo" or I should rewrite some of my plugins to get them working again. But what about the compatibility with oldest AMXX versions? |
Re: menu_item_getinfo function problem
KWo
Valve blocked it so will show Server tried to send invalid command:"csdm_sett_menu " But there is other methods but its not allowed EDIT: You can't use client_cmd to make the users do somethin' |
Re: menu_item_getinfo function problem
There is no reason to send the client a command to open a menu. Just show them the menu.
|
Re: menu_item_getinfo function problem
The same command is used if the user/admin wants to open that menu just after typing the command in the console.
Actually it's nothing else like extended the functionality BAILOPAN wrote in his csdm_main original plugins: Code:
public use_csdm_menu(id, menu, item) [EDIT] Even couple of default amxx plugins is using client_cmd to do something on clients. [/EDIT] |
Re: menu_item_getinfo function problem
CSDM and official plugins are old. They would need to be cleaned up a bit. Using client_cmd is not a proper way to call internal functions. Call them directly as suggested fysiks. If you want to simulate a player entering the command in the console, then you might take a look to the new natives in 1.8.3, amxclient_cmd(), which is basically like engclient_cmd(), but notify plugins which hook the command.
|
Re: menu_item_getinfo function problem
Quote:
gonna give an example of client_cmd(id,"say test") with a custom chat plugin that ditches cs chat and prints all messages to clients with a prefix |
Re: menu_item_getinfo function problem
Quote:
|
Re: menu_item_getinfo function problem
After analizing a bit more the code of CSDM2 plugins, I think I know the reason why it was written as client commands. The main plugin (csdm_main) registers the Main CSDM menu. But items to that menu can be added also from other plugins with their commands/functions. These items might be also some submenus. These plugins might be loaded or it's possible it will not be loaded (depanding of the configuration on the server). So it cannot be hardcoded in the main plugin which menu should be displayed (because other commands to open other menus are unknown for the main plugin). That was the point of the modular structure of CSDM2. The only way (at least that time it was written) was to use client command and ask the main plugin to run the command (if exists) on the client (admin/user). Do You have guys a good example how it was solved in other modular plugins/mods?
|
Re: menu_item_getinfo function problem
With AMXX 1.8.3, you could use amxclient_cmd.
Or It's possible if I understand well, to create dynamic natives in main plugin, like on each sub-plugins, you need to register the menu e.g. CSDM_RegisterMenu ; and the main plugin would be notified about that and can build the CSDM menu. Something like that. |
Re: menu_item_getinfo function problem
The menu is build on the initialisation with the function menu_create.
Code:
public plugin_init() In the main plugin there are some natives, like: Code:
public plugin_natives() |
All times are GMT -4. The time now is 02:10. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.