Raised This Month: $ Target: $400
 0% 

Unknown fault


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 03-26-2011 , 18:49   Unknown fault
Reply With Quote #1

I don't really know where the fault is, with the edited one, if I press any key, nothing happens. I just added \r, \w before the numbers and changed the header of menu:

Original:

PHP Code:
public ShowExtraMenuidpos )
{
    if( 
pos ) return

    new 
i0nStartnEndnLennKeys = (1<<9)
    new 
szMenuBody[512]

    
nStart pos MAX_DISPLAY

    
if( nStart >= MO_MAX_EXTRA )
        
nStart pos g_nMenuPosition[id-1] = 0

    nLen 
formatszMenuBody511"\yExtras Menu:\R%d/2^n\w^n"pos )

    
nEnd nStart MAX_DISPLAY
    
if( nEnd MO_MAX_EXTRA nEnd MO_MAX_EXTRA

    
for( nStartnEndi++ )
    {
        
nKeys |= (1<<j++)
        
nLen += formatszMenuBody[nLen], (511-nLen), "%d. %s^n"jg_szExtraMenuTxt[i] )
    }

    if( 
nEnd != MO_MAX_EXTRA )
    {
        
formatszMenuBody[nLen], (511-nLen), "^n9. More...^n0. Back" )
        
nKeys |= (1<<8)
    }
    else 
formatszMenuBody[nLen], (511-nLen), "^n0. Back" )

    
show_menuidnKeysszMenuBody, -)
    return

Edited:

PHP Code:
public ShowExtraMenuidpos )
{
    if( 
pos ) return

    new 
i0nStartnEndnLennKeys = (1<<9)
    new 
szMenuBody[512]

    
nStart pos MAX_DISPLAY

    
if( nStart >= MO_MAX_EXTRA )
        
nStart pos g_nMenuPosition[id-1] = 0

    nLen 
formatszMenuBody511"\yExtra Menu: %d/2^n\w^n^n"pos )

    
nEnd nStart MAX_DISPLAY
    
if( nEnd MO_MAX_EXTRA nEnd MO_MAX_EXTRA

    
for( nStartnEndi++ )
    {
        
nKeys |= (1<<j++)
        
nLen += formatszMenuBody[nLen], (511-nLen), "\r%d. \w%s^n"jg_szExtraMenuTxt[i] )
    }

    if( 
nEnd != MO_MAX_EXTRA )
    {
        
formatszMenuBody[nLen], (511-nLen), "^n\r9. \wMore...^n\r0. \wBack" )
        
nKeys |= (1<<8)
    }
    else 
formatszMenuBody[nLen], (511-nLen), "^n\r0. \wBack" )

    
show_menuidnKeysszMenuBody, -)
    return

bibu is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-26-2011 , 18:54   Re: Unknown fault
Reply With Quote #2

The colors may be interfering with the format args.
Try this:
PHP Code:
nLen += formatszMenuBody[nLen], (511-nLen), "%s%d. %s%s^n""\r"j"\w"g_szExtraMenuTxt[i] ) 
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 03-26-2011 , 18:59   Re: Unknown fault
Reply With Quote #3

When you change header of menu, you must also change it in plugin_init:
PHP Code:
register_menucmd(register_menuidHEADER ), .....) 
__________________
Impossible is Nothing
Sylwester is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 03-27-2011 , 06:05   Re: Unknown fault
Reply With Quote #4

Quote:
Originally Posted by Sylwester View Post
When you change header of menu, you must also change it in plugin_init:
PHP Code:
register_menucmd(register_menuidHEADER ), .....) 
Exactly, forgot this.

@Exolent:

Is your line with format better, then I will replace it with yours. Though I think both do the same.

Thanks for both!
bibu is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-27-2011 , 06:29   Re: Unknown fault
Reply With Quote #5

Quote:
Originally Posted by bibu View Post
@Exolent:

Is your line with format better, then I will replace it with yours. Though I think both do the same.

Thanks for both!
If it's just a matter of putting \w inside or outside of the unformatted string, it shouldn't matter at all, except in some situations i can't remember if you use web compiler, but i don't know if xolent's way would fix it. You can stick with your way, w/e.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 03-27-2011 , 11:51   Re: Unknown fault
Reply With Quote #6

Alright, thanks.
bibu is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 03-30-2011 , 14:52   Re: Unknown fault
Reply With Quote #7

Somehow, still the same:

PHP Code:
register_menucmd(register_menuid("Extras:"),            1023"ExtraMenuCmd" )

public 
ExtraMenuCmdidkey )
{
    
// Track which Option was chosen
    
g_nMenuOption[id-1] = g_nMenuPosition[id-1] * MAX_DISPLAY key

    
switch( key )
    {
        case 
8:
        {
            
// User Selected "More..." Option
            
ShowExtraMenuid, ++g_nMenuPosition[id-1] )
        }
        case 
9:
        {
            
// User Chose to go Back to Previous Menu
            
if( g_nMenuPosition[id-1] )
            {
                
ShowExtraMenuid, --g_nMenuPosition[id-1] )
            }else
            {
                
ShowMainMenuid )
            }
        }
        default: 
ShowPlayerMenuidg_nMenuPosition[id-1] = )
    }
    return 
PLUGIN_HANDLED
}

public 
ShowExtraMenuidpos )
{
    if( 
pos ) return

    new 
i0nStartnEndnLennKeys = (1<<9)
    new 
szMenuBody[512]

    
nStart pos MAX_DISPLAY

    
if( nStart >= MO_MAX_EXTRA )
        
nStart pos g_nMenuPosition[id-1] = 0

    nLen 
formatszMenuBody511"\yExtras: %d/2^n\w^n^n"pos )

    
nEnd nStart MAX_DISPLAY
    
if( nEnd MO_MAX_EXTRA nEnd MO_MAX_EXTRA

    
for( nStartnEndi++ )
    {
        
nKeys |= (1<<j++)
        
//nLen += format( szMenuBody[nLen], (511-nLen), "\r%d. \w%s^n", j, g_szExtraMenuTxt[i] )
    
nLen += formatszMenuBody[nLen], (511-nLen), "%s%d. %s%s^n""\r"j"\w"g_szExtraMenuTxt[i] )
    }

    if( 
nEnd != MO_MAX_EXTRA )
    {
        
formatszMenuBody[nLen], (511-nLen), "^n\r9. \wMore...^n\r0. \wBack" )
        
nKeys |= (1<<8)
    }
    else 
formatszMenuBody[nLen], (511-nLen), "^n\r0. \wBack" )

    
show_menuidnKeysszMenuBody, -)
    return

bibu is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-30-2011 , 18:27   Re: Unknown fault
Reply With Quote #8

Remove "\y" or use the title section of show_menu(.title="Extras:")
__________________
fysiks is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 03-31-2011 , 11:37   Re: Unknown fault
Reply With Quote #9

If I remove "\y", title is white. Didn't understand your second method.
bibu is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-31-2011 , 17:47   Re: Unknown fault
Reply With Quote #10

PHP Code:
register_menucmd(register_menuid("Extras:"),            1023"ExtraMenuCmd" 

PHP Code:
register_menucmd(register_menuid("\yExtras:"),            1023"ExtraMenuCmd" 
OR

PHP Code:
show_menuidnKeysszMenuBody, -

PHP Code:
show_menuidnKeysszMenuBody, -1"Extras:" 
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 14:36.


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