AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   menu bug (?) (https://forums.alliedmods.net/showthread.php?t=332447)

kww 05-13-2021 12:43

menu bug (?)
 
Hi! I have some code for menu, and it is working but only for 1 player at the same time.
I mean when menu opened by 2 or more people and someone exiting it, menu stops working for all players. It stops reacting to any keys pressed but keeps showing up. Thereafter when someone opens menu again it starts to work for everyone again until someone else tries to exit. How to fix it? (I hope you understand what I mean)

code

OrangePeel 05-13-2021 21:56

Re: menu bug (?)
 
Code:

public m(id)
{
    static szTitle[63]
    formatex(szTitle, charsmax(szTitle), "\rTitle")
    new menu = menu_create(szTitle, "mh")

    formatex(szTitle, charsmax(szTitle), "\yBhop \d[%s]", gBhop[id] ? "Enabled" : "Disabled")
    menu_additem(menu,  szTitle)
    menu_setprop(menu, MPROP_EXITNAME, "ExIt")
    menu_display(id, menu)
    return PLUGIN_HANDLED
}

public mh(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu)
        return PLUGIN_HANDLED
    }

    menu_destroy(menu)

    static szMsg[255]
    switch(item)
    {
        case 0:
        {
            gBhop[id] = !gBhop[id]
            formatex(szMsg, charsmax(szMsg), "Bhop %s!", gBhop[id] ? "enabled" : "disabled")
        }
    }
   
    set_dhudmessage(243, 180, 48, 0.06, 0.74, 0, 1.0, 1.0, 0.1, 2.0)
    show_dhudmessage(id, szMsg)
   
    m(id)
    return PLUGIN_HANDLED
}


Natsheh 05-14-2021 05:17

Re: menu bug (?)
 
szMsg[255] the array size is too big max limit is like 192 for chat message.

kww 05-14-2021 07:37

Re: menu bug (?)
 
Quote:

Originally Posted by Natsheh (Post 2746778)
szMsg[255] the array size is too big max limit is like 192 for chat message.

Oh, thanks for info. But here used director hud, not the chat

But what's causing this happen? I don't think this array is the problem (i just copied someone's code...)


All times are GMT -4. The time now is 16:30.

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