AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with formatex (https://forums.alliedmods.net/showthread.php?t=184869)

Bilal Pro 05-09-2012 17:00

Help with formatex
 
Hello there,

How am i able to make the buttons able to press only when the bool has set true for example
if the bool is set false you cant press the button, if its true you can. I tryed this:

PHP Code:

    new szText[555 char]
    
formatex(szTextcharsmax(szText), "\rtest")
    new 
menu menu_create(szText"Menuhandler")
    
    
formatex(szTextcharsmax(szText), "Secret Phrase \d#1")
    
menu_additem(menuszText"1"HasAchievement[id]) 

Edit: im trying to edit the pacces, that you only can acces the button if the bool is set true, else not

rak 05-09-2012 19:28

Re: Help with formatex
 
use callback

Bugsy 05-09-2012 21:02

Re: Help with formatex
 
Like this, and for another example you can look at my BombSite Lock plugin.
PHP Code:

public ShowMenuid )
{
    new 
iMenu menu_create"A Menu" "MenuHandler" );
    new 
iCallBack menu_makecallback"MenuCallBack" );
    
    
menu_additemiMenu "Item1" , .callback iCallBack );
    
menu_additemiMenu "Item2" , .callback iCallBack );
    
    
menu_displayid iMenu );
    
    return 
PLUGIN_HANDLED;
}

public 
MenuHandlerid iMenu iItem )
{

}

public 
MenuCallBackid iMenu iItem )
{    
    return 
HasAchievementid ] ? ITEM_ENABLED ITEM_DISABLED;



Bilal Pro 05-10-2012 09:15

Re: Help with formatex
 
Thanks


All times are GMT -4. The time now is 00:22.

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