AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Auto-paginate doesn't work? (https://forums.alliedmods.net/showthread.php?t=153678)

bibu 03-27-2011 12:57

Auto-paginate doesn't work?
 
I've made the menu like that:

PHP Code:

new TotalReasonsGlobal 7
new const reasons_global[][64] =
{
    
"Camping",
    
"Spamming",
    
"Insulting",
    
"Bad Behaving",
    
"High Ping",
    
"Racism",
    
"Cheating"


PHP Code:

public GlobalreasonMenu(id)
{
    new 
ReasonmenuTemp[64]
    
formatex(Temp,63"\rChoose reason:")
    
    
Reasonmenu menu_create(Temp"globalban_reason_handler")
    new 
key[6]
    
    for(new 
iTotalReasonsGlobali++)
    {
        
num_to_str(ikeysizeof(key)-1)
        
menu_additem(Reasonmenureasons_global[i], key0)
    }
    
menu_display(idReasonmenu)
    return 
PLUGIN_HANDLED


This shows me just 6 items. Cheating isn't in the list.

.Dare Devil. 03-27-2011 13:24

Re: Auto-paginate doesn't work?
 
new key[6]
to
new key[7]

fysiks 03-27-2011 13:29

Re: Auto-paginate doesn't work?
 
Quote:

Originally Posted by .Dare Devil. (Post 1440229)
new key[6]
to
new key[7]

That won't change anything. In fact, he could even use new key[3]

EDIT:

All seven options show up on one page for me with this test plugin (note the change of TotalReasonsGlobal; this way you won't need to change the number when adding or removing options from reasons_global):

PHP Code:

#include <amxmodx>

new const reasons_global[][64] =
{
    
"Camping",
    
"Spamming",
    
"Insulting",
    
"Bad Behaving",
    
"High Ping",
    
"Racism",
    
"Cheating"
}
new 
TotalReasonsGlobal sizeof(reasons_global)

public 
plugin_init()
{
    
register_clcmd("say test""GlobalreasonMenu")
}

public 
GlobalreasonMenu(id)
{
    new 
ReasonmenuTemp[64]
    
formatex(Temp,63"\rChoose reason:")

    
Reasonmenu menu_create(Temp"globalban_reason_handler")
    new 
key[3]

    for(new 
iTotalReasonsGlobali++)
    {
        
num_to_str(ikeysizeof(key)-1)
        
menu_additem(Reasonmenureasons_global[i], key0)
    }
    
menu_display(idReasonmenu)
    return 
PLUGIN_HANDLED
}

public 
globalban_reason_handler(idmenuitem)
{
    
client_print(0print_chat"Option selected")



.Dare Devil. 03-27-2011 13:42

Re: Auto-paginate doesn't work?
 
Quote:

Originally Posted by fysiks (Post 1440234)
That won't change anything. In fact, he could even use new key[3]

I dont know about nohting in this menu style ..
Sorry my bad.

I was thinking if there are key[6] and 7 menu items then may by must key[7] too. lol

fysiks 03-27-2011 13:47

Re: Auto-paginate doesn't work?
 
Quote:

Originally Posted by .Dare Devil. (Post 1440246)
I was thinking if there are key[6] and 7 menu items then may by must key[7] too. lol

Nope. The variable "key" is just a string to contian a number in string format: "1", "9", "10", etc.

Everything seems to work fine for me. See code above.

bibu 03-27-2011 14:04

Re: Auto-paginate doesn't work?
 
Somehow, it works now. :/

fysiks 03-27-2011 14:21

Re: Auto-paginate doesn't work?
 
Quote:

Originally Posted by bibu (Post 1440259)
Somehow, it works now. :/

Yeah, I've had that happen sometimes. I usually found that I forgot to put the newest .amxx file in the folder or it didn't actually compile (I wasn't watching the compiler output when compiling).

bibu 03-27-2011 15:19

Re: Auto-paginate doesn't work?
 
Quote:

Originally Posted by fysiks (Post 1440272)
Yeah, I've had that happen sometimes. I usually found that I forgot to put the newest .amxx file in the folder or it didn't actually compile (I wasn't watching the compiler output when compiling).

Hehe, yeah. :oops::mrgreen:

Wow, that's cool with "sizeof", will replace it with that. Otherwise, there isn't something to change right? And, I do not really know what new key then stands for, I thought that Dare Devil is right.


All times are GMT -4. The time now is 14:38.

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