diff --git a/amxmodx/newmenus.cpp b/amxmodx/newmenus.cpp index 6d6e225c..99243de6 100755 --- a/amxmodx/newmenus.cpp +++ b/amxmodx/newmenus.cpp @@ -1006,6 +1006,20 @@ static cell AMX_NATIVE_CALL menu_item_setcall(AMX *amx, cell *params) return 1; } +static cell AMX_NATIVE_CALL menu_item_setaccess(AMX *amx, cell *params) +{ + GETMENU(params[1]); + + menuitem *pItem = pMenu->GetMenuItem(static_cast(params[2])); + + if (!pItem) + return 0; + + pItem->access = params[3]; + + return 1; +} + static cell AMX_NATIVE_CALL menu_setprop(AMX *amx, cell *params) { GETMENU(params[1]); @@ -1237,6 +1251,7 @@ AMX_NATIVE_INFO g_NewMenuNatives[] = {"menu_item_getinfo", menu_item_getinfo}, {"menu_makecallback", menu_makecallback}, {"menu_item_setcall", menu_item_setcall}, + {"menu_item_setaccess", menu_item_setaccess}, {"menu_item_setcmd", menu_item_setcmd}, {"menu_item_setname", menu_item_setname}, {"menu_destroy", menu_destroy}, diff --git a/plugins/include/newmenus.inc b/plugins/include/newmenus.inc index 79a88f7b..8a68dfe6 100644 --- a/plugins/include/newmenus.inc +++ b/plugins/include/newmenus.inc @@ -257,6 +257,17 @@ native menu_item_setcmd(menu, item, const info[]); */ native menu_item_setcall(menu, item, callback=-1); +/** + * Sets an item's access. + * + * @param menu Menu resource identifier. + * @param item Item identifier. + * @param access New access required by the player for access to the item. + * @return 1 on success, 0 on failure. + * @error Invalid menu resource. + */ +native menu_item_setaccess(menu, item, access=0); + /** * Destroys a menu. Player menus will be cancelled (although may still linger * on the HUD), and future attempts to access the menu resource will result in