Raised This Month: $32 Target: $400
 8% 

Top in menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Point
Junior Member
Join Date: Oct 2014
Old 05-23-2019 , 11:29   Top in menu
Reply With Quote #1

Hello! Can some help me with this? I have a top menu and what i need is another menu with more info for each player in the top
PHP Code:
    while(SQL_MoreResults(query))
    {
        
SQL_ReadResult(query0szName31);

        
num_to_str(iPositionszPositioncharsmax(szPosition));
        
        if(
iPosition == 1)
        {
            
formatex(szDatacharsmax(szData), "#%i - %s"iPositionszName);
            
menu_additem(g_TopszDataszPosition);
            
            if(
id == 0) return;    
        } else {
            
formatex(szDatacharsmax(szData), "#%i - %s"iPositionszName);
            
menu_additem(g_TopszDataszPosition);
        }
        ++
iPosition;
        
        
SQL_NextRow(query);
    }
    
    
menu_setprop(g_TopMPROP_NEXTNAME"Next");
    
menu_setprop(g_TopMPROP_BACKNAME"Previous");
    
menu_setprop(g_TopMPROP_EXITNAME"Exit");

PHP Code:
public TopMenu_Handler(idmenuiditem)
{
    if(!
is_user_connected(id) || item == MENU_EXIT)
        return 
PLUGIN_HANDLED;
        
    
menu_display(idg_Top);
    
    return 
PLUGIN_HANDLED;

What i've tried to do is
PHP Code:
    while(SQL_MoreResults(query))
    {
        
SQL_ReadResult(query0szName31);

        
num_to_str(iPositionszPositioncharsmax(szPosition));
        
        if(
iPosition == 1)
        {
            
formatex(szDatacharsmax(szData), "#%i - %s"iPositionszName);
            
menu_additem(g_TopszDataszPosition);
                        
                         
// here
                    
g_InfoTop menu_create(title"TopInfoMenu_Handler");
                    
formatex(szDatacharsmax(szData), "STEAMID - "szauthid);
                        
formatex(szDatacharsmax(szData), "NICK - "szname);


            if(
id == 0) return;    
        } else {
            
formatex(szDatacharsmax(szData), "#%i - %s"iPositionszName);
            
menu_additem(g_TopszDataszPosition);

                        
g_InfoTop menu_create(title"TopInfoMenu_Handler");
                    
formatex(szDatacharsmax(szData), "STEAMID - "szauthid);
                        
formatex(szDatacharsmax(szData), "NICK - "szname);

        }
        ++
iPosition;
        
        
SQL_NextRow(query);
    }
    
    
menu_setprop(g_TopMPROP_NEXTNAME"Next");
    
menu_setprop(g_TopMPROP_BACKNAME"Previous");
    
menu_setprop(g_TopMPROP_EXITNAME"Exit"); 
The problem is i don't know how to make it display for each case.
Point is offline
AmXDusT
Member
Join Date: Feb 2019
Location: Italy / Albania
Old 05-24-2019 , 09:51   Re: Top in menu
Reply With Quote #2

Hi,
PHP Code:
if(iPosition == 1

    
formatex(szDatacharsmax(szData), "#%i - %s"iPositionszName); 
    
menu_additem(g_TopszDataszPosition); 
             
    if(
id == 0) return;     
} else { 
     
formatex(szDatacharsmax(szData), "#%i - %s"iPositionszName); 
     
menu_additem(g_TopszDataszPosition); 

Can be written like this to avoid the same things being repeated:
PHP Code:
formatex(szDatacharsmax(szData), "#%i - %s"iPositionszName); 
menu_additem(g_TopszDataszPosition); 
if(
iPosition == && id == 0) return; 

You should also create the new menu ( g_InfoTop = menu_create(title, "TopInfoMenu_Handler"); ) on another place, maybe where the topMenu is being created.


By what I'm understanding, your current normal menu shows just nick and you want it to show steamid too for new one? Do you want to create the other menu that it shows nick/steamid when you click on the player in the first menu?
AmXDusT is offline
Point
Junior Member
Join Date: Oct 2014
Old 05-24-2019 , 14:56   Re: Top in menu
Reply With Quote #3

Quote:
Can be written like this to avoid the same things being repeated:
PHP Code:
formatex(szDatacharsmax(szData), "#%i - %s"iPositionszName);  
menu_additem(g_TopszDataszPosition);  
if(
iPosition == && id == 0) return; 
Thanks but i'm using the first position to display something different. These are just examples

Quote:
You should also create the new menu ( g_InfoTop = menu_create(title, "TopInfoMenu_Handler"); ) on another place, maybe where the topMenu is being created.
I need to read the results from tables so.. where else could i place it?
EDIT: Sorry, misunderstood. i'll test that
EDIT2: Nope.. it doesn't work

Quote:
Do you want to create the other menu that it shows nick/steamid when you click on the player in the first menu?
Exactly
PHP Code:
public TopMenu_Handler(idmenuiditem

    if(!
is_user_connected(id) || item == MENU_EXIT
        return 
PLUGIN_HANDLED
         
    
menu_display(idg_TopInfo); 
     
    return 
PLUGIN_HANDLED

^ This way it just displays the last person's info that entered the top. I don't know how to display it for each case, each player. Thank you for your reply

Last edited by Point; 05-24-2019 at 18:04. Reason: typo
Point is offline
AmXDusT
Member
Join Date: Feb 2019
Location: Italy / Albania
Old 05-24-2019 , 20:13   Re: Top in menu
Reply With Quote #4

You can create the menu somewhere else, if g_infoTop is a global variable, tho you can create the variable and the whole menu in the first menu handler (you don't really need it to be global var)

Here's how I'd make it:
you can create a variable, szInfo[60] where to save both nick and steamid, and pass it on the menu_additem as the third parameter (as the szPosition I dont think you need it). on the new menu handler, get the menu info and parse it to get nick and steamid and show it on the menu.

PHP Code:
        //create a variable szInfo[60] before the loop
        
if(iPosition == 1
        { 
            
formatex(szDatacharsmax(szData), "#%i - %s"iPositionszName); 
            
                         
                         
// here 
            
formatex(szInfocharsmax(szInfo), "%s %s"szNameszauthid)
            
menu_additem(g_TopszDataszInfo); 

            if(
id == 0) return;     
        } else { 
            
formatex(szDatacharsmax(szData), "#%i - %s"iPositionszName); 
      
            
formatex(szInfocharsmax(szInfo), "%s %s"szNameszauthid)
            
menu_additem(g_TopszDataszInfo); 

        } 
handler
PHP Code:
public TopMenu_Handler(idmenuiditem

    if(!
is_user_connected(id) || item == MENU_EXIT
        return 
PLUGIN_HANDLED
    new 
dummyszInfo[60], argName[32], argAuthid[27]     
    
menu_item_getinfo(menuiditemdummyszInfocharsmax(szInfo), __dummy)
    
parse(szInfoargNamecharsmax(argName), argAuthidcharsmax(argAuthid))
    
menu_additem(g_TopInfoargName)
    
menu_additem(g_TopInfoargAuthid)

     
    
menu_display(idg_TopInfo); 
    return 
PLUGIN_HANDLED

EDIT:
you can actually save menu's text (szName) directly from menu_item_getinfo:
PHP Code:
        if(iPosition == 1
        { 
            
formatex(szDatacharsmax(szData), "#%i - %s"iPositionszName); 
            
                         
                         
// here 

            
menu_additem(g_TopszDataszauthid); 

            if(
id == 0) return;     
        } else { 
            
formatex(szDatacharsmax(szData), "#%i - %s"iPositionszName); 
      
            
menu_additem(g_TopszDataszauthid); 

        } 
handler
PHP Code:
public TopMenu_Handler(idmenuiditem

    if(!
is_user_connected(id) || item == MENU_EXIT
        return 
PLUGIN_HANDLED
    
//SIZE = size of szauthid earlier
    
new dummyargName[32], argAuthid[SIZE]     
    
menu_item_getinfo(menuiditemdummyargAuthidcharsmax(argAuthid), argNamecharsmax(argName), dummy)
    
menu_additem(g_TopInfoargName)
    
menu_additem(g_TopInfoargAuthid)

     
    
menu_display(idg_TopInfo); 
    return 
PLUGIN_HANDLED


Last edited by AmXDusT; 05-24-2019 at 20:22.
AmXDusT is offline
Point
Junior Member
Join Date: Oct 2014
Old 05-26-2019 , 19:54   Re: Top in menu
Reply With Quote #5

I couldn't get it to work right. I don't need this anymore but anyway thanks for the help.
Point 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 12:09.


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