AddMenuItem_call
- Синтаксис
-
stock AddMenuItem_call(const MENU_TEXT[], const MENU_CMD[], const MENU_ACCESS, const MENU_PLUGIN[], const bool:ADD_TO_CLIENT_MENU) { new pluginid = is_plugin_loaded("Menus Front-End"); if (pluginid == -1) { log_amx("Can't add menu item ^"%s^" from plugin ^"%s^" to menu set because the Menus Front-End plugin itself is not loaded!", MENU_TEXT, MENU_PLUGIN); return; // Menus Front-End doesn't exist, return. } new filename[64], b[1]; get_plugin(pluginid, filename, charsmax(filename), b, charsmax(b), b, charsmax(b), b, charsmax(b), b, charsmax(b)); new status = callfunc_begin(ADD_TO_CLIENT_MENU ? "AddClientMenu" : "AddMenu", filename); new bool:failed = true; switch (status) { case 1: { failed = false; } case 0: { log_amx("Run time error! (AddMenuItem_call failed)"); } case -2: { log_amx("Function not found! (AddMenuItem_call failed)"); } case -1: { log_amx("Plugin not found! (AddMenuItem_call failed)"); } } if (failed) { return; } // Item text callfunc_push_str(MENU_TEXT); // Cmd callfunc_push_str(MENU_CMD); // Access callfunc_push_int(MENU_ACCESS); // Menu exists in this plugin callfunc_push_str(MENU_PLUGIN); callfunc_end(); }
Переменная | Описание |
---|---|
MENU_TEXT |
Item text that will be displayed in the menu |
MENU_CMD |
Command that will be executed on the client |
MENU_ACCESS |
Admin access required for menu command |
MENU_PLUGIN |
Case-insensitive name or filename of plugin providing the menu command |
ADD_TO_CLIENT_MENU |
If true adds command to client menu, false adds to admin menu |
- Описание
- Helper function used by AddMenuItem() and AddClientMenuItem()
- Возвращает
- Функция ничего не возвращает