This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Open MENU on button N


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SaraAki
Member
Join Date: Nov 2022
Old 04-29-2024 , 08:50   Open MENU on button N
Reply With Quote #1

Who can help me to ajust this plugin to open menu when player press N?I tried with this but didnt work.
PHP Code:
register_clcmd("nightvision""cmdMenu"
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN_VERSION "2.1.2"
#define MAX_MENUS 20

enum
{
    
SECTION_DEFAULTS 0,
    
SECTION_SETTINGS,
    
SECTION_MENUITEMS
}

enum _:Settings
{
    
MENU_TITLE[128],
    
MENU_TITLE_PAGE[128],
    
MENU_PREFIX[32],
    
MENU_BACKK[32],
    
MENU_NEXT[32],
    
MENU_EXITT[32],
    
MENU_FLAG,
    
MENU_TEAM,
    
MENU_ALIVEONLY,
    
MENU_ITEMS_PER_PAGE,
    
MENU_REOPEN,
    
MENU_ITEM_FORMAT[64],
    
MENU_NOACCESS[160],
    
MENU_NOTEAM[160],
    
MENU_ALIVE[160],
    
MENU_DEAD[160],
    
MENU_SOUND[128]
}

enum _:Items
{
    
Name[64],
    
Command[64],
    
Flag[5],
    
Team,
    
bool:UseFunc,
    
Plugin[64],
    Function[
64]
}

new 
g_eDefaults[Settings],
    
g_eSettings[MAX_MENUS][Settings],
    
g_iTotalItems[MAX_MENUS],
    
g_szMap[32],
    
g_msgSayText

new Trie:g_tCommands,
    Array:
g_aMenuItems[MAX_MENUS]

new const 
g_szAll[] = "#all"
new const g_szItemField[] = "%item%"
new const g_szNameField[] = "%name%"
new const g_szUserIdField[] = "%userid%"
new const g_szBlankField[] = "#blank"
new const g_szTextField[] = "#text"
new const g_szPlayersField[] = "#addplayers"
new const g_szFunc[] = "do.func"
new const g_szAMXX[] = ".amxx"
new const g_szNewLine[2][] = { "%newline%""^n" }
new const 
g_szSayStuff[2][] = { "say ""say_team " }

public 
plugin_init()
{
    
register_plugin("Simple Menu"PLUGIN_VERSION"OciXCrom")
    
register_cvar("SimpleMenu"PLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
    
g_msgSayText get_user_msgid("SayText")
}

public 
plugin_precache()
{
    for(new 
iMAX_MENUSi++)
        
g_aMenuItems[i] = ArrayCreate(Items)

    
get_mapname(g_szMapcharsmax(g_szMap))
    
g_tCommands TrieCreate()
    
fileRead()
}

public 
plugin_end()
{
    for(new 
iMAX_MENUSi++)
        
ArrayDestroy(g_aMenuItems[i])

    
TrieDestroy(g_tCommands)
}

fileRead()
{
    new 
szConfigsName[256], szFilename[256]
    
get_configsdir(szConfigsNamecharsmax(szConfigsName))
    
formatex(szFilenamecharsmax(szFilename), "%s/SimpleMenu.ini"szConfigsName)
    new 
iFilePointer fopen(szFilename"rt")

    if(
iFilePointer)
    {
        new 
szData[256], szKey[128], szValue[128], szTeam[2], iSectioniSize
        
new eItem[Items], iMenuId = -1bool:blRead true

        
while(!feof(iFilePointer))
        {
            
fgets(iFilePointerszDatacharsmax(szData))
            
trim(szData)

            switch(
szData[0])
            {
                case 
EOS';': continue
                case 
'-':
                {
                    
iSize strlen(szData)

                    if(
szData[iSize 1] == '-')
                    {
                        
szData[0] = ' '
                        
szData[iSize 1] = ' '
                        
trim(szData)

                        if(
contain(szData"*") != -1)
                        {
                            
strtok(szDataszKeycharsmax(szKey), szValuecharsmax(szValue), '*')
                            
copy(szValuestrlen(szKey), g_szMap)
                            
blRead equal(szValueszKey) ? true false
                        
}
                        else
                            
blRead equal(szDatag_szAll) || equali(szDatag_szMap)
                    }
                    else continue
                }
                case 
'[':
                {
                    if(
szData[strlen(szData) - 1] == ']')
                    {
                        if(
containi(szData"default settings") != -1)
                            
iSection SECTION_DEFAULTS
                        
else if(containi(szData"new menu") != -1)
                        {
                            
iMenuId++

                            for(new 
isizeof(g_eDefaults); i++)
                                
g_eSettings[iMenuId][i] = g_eDefaults[i]
                        }
                        else if(
containi(szData"menu settings") != -1)
                        {
                            if(
iMenuId 0)
                                
iMenuId 0

                            iSection 
SECTION_SETTINGS
                        
}
                        else if(
containi(szData"menu items") != -1)
                        {
                            if(
iMenuId 0)
                                
iMenuId 0

                            iSection 
SECTION_MENUITEMS
                        
}
                    }
                    else continue
                }
                default:
                {
                    if(!
blRead)
                        continue

                    switch(
iSection)
                    {
                        case 
SECTION_DEFAULTS:
                        {
                            
strtok(szDataszKeycharsmax(szKey), szValuecharsmax(szValue), '=')
                            
trim(szKey); trim(szValue)

                            if(
szValue[0] == EOS)
                                continue

                            if(
equal(szKey"MENU_TITLE"))
                            {
                                if(
contain(szValueg_szNewLine[0]) != -1)
                                    
replace_all(szValuecharsmax(szValue), g_szNewLine[0], g_szNewLine[1])

                                
copy(g_eDefaults[MENU_TITLE], charsmax(g_eDefaults[MENU_TITLE]), szValue)
                            }
                            if(
equal(szKey"MENU_TITLE_PAGE"))
                            {
                                if(
contain(szValueg_szNewLine[0]) != -1)
                                    
replace_all(szValuecharsmax(szValue), g_szNewLine[0], g_szNewLine[1])

                                
copy(g_eDefaults[MENU_TITLE_PAGE], charsmax(g_eDefaults[MENU_TITLE_PAGE]), szValue)
                            }
                            else if(
equal(szKey"MENU_PREFIX"))
                                
copy(g_eDefaults[MENU_PREFIX], charsmax(g_eDefaults[MENU_PREFIX]), szValue)
                            else if(
equal(szKey"MENU_BACK"))
                                
copy(g_eDefaults[MENU_BACKK], charsmax(g_eDefaults[MENU_BACKK]), szValue)
                            else if(
equal(szKey"MENU_NEXT"))
                                
copy(g_eDefaults[MENU_NEXT], charsmax(g_eDefaults[MENU_NEXT]), szValue)
                            else if(
equal(szKey"MENU_EXIT"))
                                
copy(g_eDefaults[MENU_EXITT], charsmax(g_eDefaults[MENU_EXITT]), szValue)
                            else if(
equal(szKey"MENU_FLAG"))
                                
g_eDefaults[MENU_FLAG] = szValue[0] == '0' read_flags(szValue)
                            else if(
equal(szKey"MENU_TEAM"))
                                
g_eDefaults[MENU_TEAM] = clamp(str_to_num(szValue), 03)
                            else if(
equal(szKey"MENU_ALIVEONLY"))
                                
g_eDefaults[MENU_ALIVEONLY] = str_to_num(szValue)
                            else if(
equal(szKey"MENU_ITEMS_PER_PAGE"))
                                
g_eDefaults[MENU_ITEMS_PER_PAGE] = str_to_num(szValue)
                            else if(
equal(szKey"MENU_REOPEN"))
                                
g_eDefaults[MENU_REOPEN] = str_to_num(szValue)
                            else if(
equal(szKey"MENU_ITEM_FORMAT"))
                                
copy(g_eDefaults[MENU_ITEM_FORMAT], charsmax(g_eDefaults[MENU_ITEM_FORMAT]), szValue)
                            else if(
equal(szKey"MENU_NOACCESS"))
                                
copy(g_eDefaults[MENU_NOACCESS], charsmax(g_eDefaults[MENU_NOACCESS]), szValue)
                            else if(
equal(szKey"MENU_NOTEAM"))
                                
copy(g_eDefaults[MENU_NOTEAM], charsmax(g_eDefaults[MENU_NOTEAM]), szValue)
                            else if(
equal(szKey"MENU_ALIVE"))
                                
copy(g_eDefaults[MENU_ALIVE], charsmax(g_eDefaults[MENU_ALIVE]), szValue)
                            else if(
equal(szKey"MENU_DEAD"))
                                
copy(g_eDefaults[MENU_DEAD], charsmax(g_eDefaults[MENU_DEAD]), szValue)
                            else if(
equal(szKey"MENU_SOUND"))
                            {
                                
copy(g_eDefaults[MENU_SOUND], charsmax(g_eDefaults[MENU_SOUND]), szValue)
                                
precache_sound(szValue)
                            }
                        }
                        case 
SECTION_SETTINGS:
                        {
                            
strtok(szDataszKeycharsmax(szKey), szValuecharsmax(szValue), '=')
                            
trim(szKey); trim(szValue)

                            if(
szValue[0] == EOS)
                                continue

                            if(
equal(szKey"MENU_TITLE"))
                            {
                                if(
contain(szValueg_szNewLine[0]) != -1)
                                    
replace_all(szValuecharsmax(szValue), g_szNewLine[0], g_szNewLine[1])

                                
copy(g_eSettings[iMenuId][MENU_TITLE], charsmax(g_eSettings[][MENU_TITLE]), szValue)
                            }
                            if(
equal(szKey"MENU_TITLE_PAGE"))
                            {
                                if(
contain(szValueg_szNewLine[0]) != -1)
                                    
replace_all(szValuecharsmax(szValue), g_szNewLine[0], g_szNewLine[1])

                                
copy(g_eSettings[iMenuId][MENU_TITLE_PAGE], charsmax(g_eSettings[][MENU_TITLE_PAGE]), szValue)
                            }
                            else if(
equal(szKey"MENU_PREFIX"))
                                
copy(g_eSettings[iMenuId][MENU_PREFIX], charsmax(g_eSettings[][MENU_PREFIX]), szValue)
                            else if(
equal(szKey"MENU_BACK"))
                                
copy(g_eSettings[iMenuId][MENU_BACKK], charsmax(g_eSettings[][MENU_BACKK]), szValue)
                            else if(
equal(szKey"MENU_NEXT"))
                                
copy(g_eSettings[iMenuId][MENU_NEXT], charsmax(g_eSettings[][MENU_NEXT]), szValue)
                            else if(
equal(szKey"MENU_EXIT"))
                                
copy(g_eSettings[iMenuId][MENU_EXITT], charsmax(g_eSettings[][MENU_EXITT]), szValue)
                            else if(
equal(szKey"MENU_FLAG"))
                                
g_eSettings[iMenuId][MENU_FLAG] = szValue[0] == '0' read_flags(szValue)
                            else if(
equal(szKey"MENU_TEAM"))
                                
g_eSettings[iMenuId][MENU_TEAM] = clamp(str_to_num(szValue), 03)
                            else if(
equal(szKey"MENU_ALIVEONLY"))
                                
g_eSettings[iMenuId][MENU_ALIVEONLY] = str_to_num(szValue)
                            else if(
equal(szKey"MENU_ITEMS_PER_PAGE"))
                                
g_eSettings[iMenuId][MENU_ITEMS_PER_PAGE] = str_to_num(szValue)
                            else if(
equal(szKey"MENU_REOPEN"))
                                
g_eSettings[iMenuId][MENU_REOPEN] = str_to_num(szValue)
                            else if(
equal(szKey"MENU_OPEN"))
                            {
                                while(
szValue[0] != && strtok(szValueszKeycharsmax(szKey), szValuecharsmax(szValue), ','))
                                {
                                    
trim(szKey); trim(szValue)
                                    
register_clcmd(szKey"cmdMenu")
                                    
TrieSetCell(g_tCommandsszKeyiMenuId)
                                }
                            }
                            else if(
equal(szKey"MENU_ITEM_FORMAT"))
                                
copy(g_eSettings[iMenuId][MENU_ITEM_FORMAT], charsmax(g_eSettings[][MENU_ITEM_FORMAT]), szValue)
                            else if(
equal(szKey"MENU_NOACCESS"))
                                
copy(g_eSettings[iMenuId][MENU_NOACCESS], charsmax(g_eSettings[][MENU_NOACCESS]), szValue)
                            else if(
equal(szKey"MENU_NOTEAM"))
                                
copy(g_eSettings[iMenuId][MENU_NOTEAM], charsmax(g_eSettings[][MENU_NOTEAM]), szValue)
                            else if(
equal(szKey"MENU_ALIVE"))
                                
copy(g_eSettings[iMenuId][MENU_ALIVE], charsmax(g_eSettings[][MENU_ALIVE]), szValue)
                            else if(
equal(szKey"MENU_DEAD"))
                                
copy(g_eSettings[iMenuId][MENU_DEAD], charsmax(g_eSettings[][MENU_DEAD]), szValue)
                            else if(
equal(szKey"MENU_SOUND"))
                            {
                                
copy(g_eSettings[iMenuId][MENU_SOUND], charsmax(g_eSettings[][MENU_SOUND]), szValue)
                                
precache_sound(szValue)
                            }
                        }
                        case 
SECTION_MENUITEMS:
                        {
                            
parse(szDataeItem[Name], charsmax(eItem[Name]), eItem[Command], charsmax(eItem[Command]), eItem[Flag], charsmax(eItem[Flag]), szTeamcharsmax(szTeam))
                            
eItem[UseFunc] = bool:(equal(eItem[Command], g_szFunccharsmax(g_szFunc)))
                            
eItem[Team] = str_to_num(szTeam)

                            if(
eItem[UseFunc])
                            {
                                
replace(eItem[Command], charsmax(eItem[Command]), g_szFunc"")
                                
replace(eItem[Command], charsmax(eItem[Command]), "(""")
                                
replace(eItem[Command], charsmax(eItem[Command]), ")""")
                                
strtok(eItem[Command], eItem[Plugin], charsmax(eItem[Plugin]), eItem[Function], charsmax(eItem[Function]), ',')
                                
trim(eItem[Plugin]); trim(eItem[Function])

                                if(
contain(eItem[Plugin], g_szAMXX) == -1)
                                    
add(eItem[Plugin], charsmax(eItem[Plugin]), g_szAMXX)
                            }

                            
ArrayPushArray(g_aMenuItems[iMenuId], eItem)
                            
eItem[Flag][0] = EOS
                            szTeam
[0] = EOS
                            g_iTotalItems
[iMenuId]++
                        }
                    }
                }
            }
        }

        
fclose(iFilePointer)
    }
}

public 
cmdMenu(id)
{
    new 
szCommand[64], szArgs[32], iMenuId
    read_argv
(0szCommandcharsmax(szCommand))

    if(
equal(szCommand[0], g_szSayStuff[0], 3) || equal(szCommand[0], g_szSayStuff[1], 8))
    {
        
read_argv(1szArgscharsmax(szArgs))
        
remove_quotes(szArgs)
        
format(szCommandcharsmax(szCommand), "%s %s"szCommandszArgs)
    }

    if(
TrieGetCell(g_tCommandsszCommandiMenuId))
        
menuMain(idiMenuId)
    else
        return 
PLUGIN_CONTINUE

    
return PLUGIN_HANDLED
}

menuMain(idiMenuIdiPage 0)
{
    if(!
is_user_connected(id))
    {
        return 
PLUGIN_HANDLED
    
}

    if(
g_eSettings[iMenuId][MENU_FLAG] && !(get_user_flags(id) & g_eSettings[iMenuId][MENU_FLAG]))
    {
        
ColorChat(id"%s %s"g_eSettings[iMenuId][MENU_PREFIX], g_eSettings[iMenuId][MENU_NOACCESS])
        return 
PLUGIN_HANDLED
    
}

    if(!
get_team_access(idiMenuId))
    {
        
ColorChat(id"%s %s"g_eSettings[iMenuId][MENU_PREFIX], g_eSettings[iMenuId][MENU_NOTEAM])
        return 
PLUGIN_HANDLED
    
}

    if(!
get_alive_access(idiMenuId))
    {
        
ColorChat(id"%s %s"g_eSettings[iMenuId][MENU_PREFIX], g_eSettings[iMenuId][MENU_ALIVEONLY] == g_eSettings[iMenuId][MENU_ALIVE] : g_eSettings[iMenuId][MENU_DEAD])
        return 
PLUGIN_HANDLED
    
}

    if(
g_eSettings[iMenuId][MENU_SOUND][0] != EOS)
        
client_cmd(id"spk %s"g_eSettings[iMenuId][MENU_SOUND])

    new 
szItem[128], szData[20]
    new 
eItem[Items], iMenu menu_create(g_eSettings[iMenuId][MENU_TITLE], "handlerMain")

    for(new 
iiTeam get_user_team(id); g_iTotalItems[iMenuId]; i++)
    {
        
ArrayGetArray(g_aMenuItems[iMenuId], ieItem)

        if(
eItem[Team] && eItem[Team] != iTeam)
            continue
        else if(
equal(eItem[Name], g_szBlankField))
            
menu_addblank(iMenustr_to_num(eItem[Command]))
        else if(
equal(eItem[Name], g_szTextField))
            
menu_addtext(iMenueItem[Command], str_to_num(eItem[Flag]))
        else if(
equal(eItem[Name], g_szPlayersField))
        {
            new 
szName[32], iPlayers[32], iPnum
            get_players
(iPlayersiPnumget_flag(eItem[Flag], "c") ? "a" "")

            for(new 
jiPlayeriPnumj++)
            {
                
iPlayer iPlayers[j]

                if(
iPlayer == id)
                {
                    if(!
get_flag(eItem[Flag], "b"))
                        continue
                }
                else if(
get_user_flags(iPlayer) & ADMIN_IMMUNITY)
                {
                    if(
get_flag(eItem[Flag], "a"))
                        continue
                }

                
get_user_name(iPlayerszNamecharsmax(szName))
                
copy(szItemcharsmax(szItem), g_eSettings[iMenuId][MENU_ITEM_FORMAT])
                
replace_all(szItemcharsmax(szItem), g_szItemFieldszName)
                
formatex(szDatacharsmax(szData), "%i %i %i p"iMenuIdiget_user_userid(iPlayer))
                
menu_additem(iMenuszItemszData)
            }
        }
        else
        {
            
copy(szItemcharsmax(szItem), g_eSettings[iMenuId][MENU_ITEM_FORMAT])
            
replace_all(szItemcharsmax(szItem), g_szItemFieldeItem[Name])
            
formatex(szDatacharsmax(szData), "%i %i"iMenuIdi)
            
menu_additem(iMenuszItemszDataread_flags(eItem[Flag]))
        }
    }

    if(
menu_pages(iMenu) > 1)
    {
        new 
szTitle[256]
        
formatex(szTitlecharsmax(szTitle), "%s %s"g_eSettings[iMenuId][MENU_TITLE], g_eSettings[iMenuId][MENU_TITLE_PAGE])
        
menu_setprop(iMenuMPROP_TITLEszTitle)
    }

    
menu_setprop(iMenuMPROP_BACKNAMEg_eSettings[iMenuId][MENU_BACKK])
    
menu_setprop(iMenuMPROP_NEXTNAMEg_eSettings[iMenuId][MENU_NEXT])
    
menu_setprop(iMenuMPROP_EXITNAMEg_eSettings[iMenuId][MENU_EXITT])
    
menu_setprop(iMenuMPROP_PERPAGEg_eSettings[iMenuId][MENU_ITEMS_PER_PAGE])
    
menu_display(idiMenuiPage)
    return 
PLUGIN_HANDLED
}

public 
handlerMain(idiMenuiItem)
{
    if(
iItem == MENU_EXIT)
        goto @
DESTROY

    
new szData[20], szMenuId[3], szKey[3], szUserId[5], iMenuIdiKeyiUserIdiAccessiCallback
    menu_item_getinfo
(iMenuiItemiAccessszDatacharsmax(szData), .callback iCallback)
    
parse(szDataszMenuIdcharsmax(szMenuId), szKeycharsmax(szKey), szUserIdcharsmax(szUserId))

    
iMenuId str_to_num(szMenuId)
    
iKey str_to_num(szKey)
    
iUserId str_to_num(szUserId)

    if(
get_alive_access(idiMenuId) && get_team_access(idiMenuId))
    {
        new 
eItem[Items]
        
ArrayGetArray(g_aMenuItems[iMenuId], iKeyeItem)

        if(
szData[strlen(szData) - 1] == 'p')
        {
            new 
szCommand[64]
            
copy(szCommandcharsmax(szCommand), eItem[Command])

            if(
get_flag(szCommandg_szNameField))
            {
                new 
szName[32]
                
get_user_name(find_player("k"iUserId), szNamecharsmax(szName))
                
replace_all(szCommandcharsmax(szCommand), g_szNameFieldszName)
            }

            if(
get_flag(szCommandg_szUserIdField))
                
replace_all(szCommandcharsmax(szCommand), g_szUserIdFieldszUserId)

            
client_cmd(idszCommand)
        }
        else
        {
            if(
eItem[UseFunc])
            {
                
callfunc_begin(eItem[Function], eItem[Plugin])
                
callfunc_push_int(id)
                
callfunc_end()
            }
            else
                
client_cmd(ideItem[Command])
        }
    }

    if(
g_eSettings[iMenuId][MENU_REOPEN])
    {
        new 
iMenu2iPage
        player_menu_info
(idiMenu2iMenu2iPage)
        
menu_destroy(iMenu)
        
menuMain(idiMenuIdiPage)
        return 
PLUGIN_HANDLED
    
}

    @
DESTROY:
    
menu_destroy(iMenu)
    return 
PLUGIN_HANDLED
}

ColorChat(const id, const szInput[], any:...)
{
    new 
iPlayers[32], iCount 1
    
static szMessage[191]
    
vformat(szMessagecharsmax(szMessage), szInput3)

    
replace_all(szMessagecharsmax(szMessage), "!g""^4")
    
replace_all(szMessagecharsmax(szMessage), "!n""^1")
    
replace_all(szMessagecharsmax(szMessage), "!t""^3")

    if(
id)
        
iPlayers[0] = id
    
else
        
get_players(iPlayersiCount"ch")

    for(new 
iiCounti++)
    {
        if(
is_user_connected(iPlayers[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_iPlayers[i])
            
write_byte(iPlayers[i])
            
write_string(szMessage)
            
message_end()
        }
    }
}

bool:get_flag(szString[], const szFlag[])
    return (
contain(szStringszFlag) != -1) ? true false

bool
:get_alive_access(idiMenuId)
    return ((
g_eSettings[iMenuId][MENU_ALIVEONLY] == && !is_user_alive(id)) || (g_eSettings[iMenuId][MENU_ALIVEONLY] == && is_user_alive(id))) ? false true

bool
:get_team_access(idiMenuId)
    return (!
g_eSettings[iMenuId][MENU_TEAM] || g_eSettings[iMenuId][MENU_TEAM] == get_user_team(id)) 
SaraAki is online now
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-29-2024 , 12:05   Re: Open MENU on button N
Reply With Quote #2

Debug your code.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
JocAnis
Veteran Member
Join Date: Jun 2010
Old 04-29-2024 , 12:07   Re: Open MENU on button N
Reply With Quote #3

put "register_clcmd("nightvision", "cmdMenu") " in plugin_init() and tell us the results?
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
SaraAki
Member
Join Date: Nov 2022
Old 04-29-2024 , 13:45   Re: Open MENU on button N
Reply With Quote #4

No error in debug,and yes i try register_clcmd("nightvision", "cmdMenu") but nothing happend when i press N.
SaraAki is online now
metal_upa
Senior Member
Join Date: Jun 2016
Old 04-30-2024 , 03:43   Re: Open MENU on button N
Reply With Quote #5

Quote:
Originally Posted by SaraAki View Post
No error in debug,and yes i try register_clcmd("nightvision", "cmdMenu") but nothing happend when i press N.
Of course it not work because it need at least 2 arguments.

Something like:
PHP Code:
public plugin_init()
{
    
register_clcmd("nightvision""OnDummyMenu");
}

public 
OnDummyMenu(id)
{
    
menuMain(id0); //this is sthe problem
    
return PLUGIN_HANDLED//block original NVG

metal_upa is offline
SaraAki
Member
Join Date: Nov 2022
Old 04-30-2024 , 13:52   Re: Open MENU on button N
Reply With Quote #6

THANKS.Working.But,can you help me with next situation:Originaly,when i open the menu,and pick any options from menu,command is done but menu stays open on the screen.I want menu to close when player choose any menu options.
SaraAki is online now
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-30-2024 , 22:53   Re: Open MENU on button N
Reply With Quote #7

That menu system already closes the menu when you select an option. If it's still showing then you show it to them again so you need to not do that.

P.S. also note that it is impossible to know what button is being pressed so if someone has a different bind for that command then "pressing N" will not open this menu.
__________________

Last edited by fysiks; 04-30-2024 at 22:54.
fysiks is offline
metal_upa
Senior Member
Join Date: Jun 2016
Old 05-01-2024 , 03:27   Re: Open MENU on button N
Reply With Quote #8

Quote:
Originally Posted by SaraAki View Post
THANKS.Working.But,can you help me with next situation:Originaly,when i open the menu,and pick any options from menu,command is done but menu stays open on the screen.I want menu to close when player choose any menu options.
If you review the code, you will find this:
PHP Code:
    if(g_eSettings[iMenuId][MENU_REOPEN])
    {
        new 
iMenu2iPage
        player_menu_info
(idiMenu2iMenu2iPage)
        
menu_destroy(iMenu)
        
menuMain(idiMenuIdiPage)
        return 
PLUGIN_HANDLED
    

There must be a setting file for this menu system, maybe its .ini file. Search for "reopen" related. then disable it.
metal_upa is offline
SaraAki
Member
Join Date: Nov 2022
Old 05-01-2024 , 05:42   Re: Open MENU on button N
Reply With Quote #9

Thank you
PHP Code:
fysiks 
,also
PHP Code:
metal_upa 
one more time you helped me it was in .ini file,now is ok.
SaraAki is online now
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode