Raised This Month: $ Target: $400
 0% 

Bug exit button


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
niqo
Senior Member
Join Date: Feb 2010
Location: Argentina
Old 03-02-2014 , 17:32   Bug exit button
Reply With Quote #1

When pressing the exit button is called 'CreateTurret' rather than simply closing the menu as it should.

PHP Code:
public menuBuyTurret(idsentryid)
{
    new 
menu menu_create("TIPO DE TORRETA: ""menuBuyTurretH")
    new 
cb menu_makecallback("menuBuyTurretCb")
    new 
szFormat[64]
    
    for(new 
1_:e_TurretsTypei++)
    {
        
formatex(szFormat63"%s \r[ \y%d\w ORO\r ]"gszTurretsName[e_TurretsType:i], gTurretsPriceData[e_TurretsType:i][0])
        
menu_additem(menuszFormat__cb)
    }
    
    
gimenuSentryId[id] = sentryid
    
    menu_setprop
(menuMPROP_EXITNAME"SALIR")
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
    
    return 
PLUGIN_CONTINUE
}
public 
menuBuyTurretCb(idmenuitem)
{
    for(new 
1_:e_TurretsTypei++)
        if(
td_get_user_info(idPLAYER_GOLD) < gTurretsPriceData[e_TurretsType:i][0] && item == i-1)
            return 
ITEM_DISABLED
    
return ITEM_ENABLED
}

public 
menuBuyTurretH(idmenutypeitem)
{
    if(
item == MENU_EXIT)
    {
        
gimenuSentryId[id] = 0
        menu_destroy
(menu)
        return 
PLUGIN_HANDLED
    
}
    
    
CreateTurret(idgimenuSentryId[id], type)
    
    return 
PLUGIN_HANDLED

__________________
niqo is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-02-2014 , 18:12   Re: Bug exit button
Reply With Quote #2

Code:
/* ...  * The handler function should be prototyped as:  *  * public <function>(id, menu, item)  *  id     - Client the menu is being acted upon.  *  menu   - Menu resource identifier.  *  item   - Item the client selected.  If less than 0, the menu was  *           cancelled and the item is a status code.  menu_display  *           should never be called immediately if the item is a status  *           code, for re-entrancy reasons.  *  * The handler function should always return PLUGIN_HANDLED to block  * any old menu handlers from potentially feeding on the menu, unless  * that is the desired functionality. ... */

For some unexplained reason your menu handler has 4 parameters.
__________________

Last edited by Black Rose; 03-02-2014 at 18:13.
Black Rose is offline
niqo
Senior Member
Join Date: Feb 2010
Location: Argentina
Old 03-02-2014 , 19:20   Re: Bug exit button
Reply With Quote #3

omg i'm stupid, thank you for pointing out my mistake!

solved
__________________

Last edited by niqo; 03-02-2014 at 19:22.
niqo is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-03-2014 , 01:07   Re: Bug exit button
Reply With Quote #4

Also note that fisrt menu item index is 0 and bot 1 as you seems to believe.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
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 00:08.


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