Raised This Month: $ Target: $400
 0% 

(req) menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 03-13-2012 , 02:02   (req) menu
Reply With Quote #1

i readed some tutorials, but cant understand

if you know how to make a menu that i want, please just write the code, thanks|

i need this:

\r[ \wMenu Title \r]

\r01.\wItem 1
\r02.\wItem 2
\r03.\wItem 3
\r04.\wItem 4
\r05.\wItem 5

\r06.\wPlugin Info
\r0.\wExit

when player choose item 1, a URL to my site with item1MOTD will open
when player choose item 2, a URL to my site with item2MOTD will open and same to 3,4,5


when player choose an item the url is like this:
<html><head><meta http-equiv=^"Refresh^" content=^"2;url=http://mysite_ITEM1.com"></head><body bgcolor='#000000'><center><img src='http://www.mysite.com/loading.gif'></center></body></html>

<html><head><meta http-equiv=^"Refresh^" content=^"2;url=http://mysite_ITEM2.com"></head><body bgcolor='#000000'><center><img src='http://www.mysite.com/loading.gif'></center></body></html>

AND SAME TO 2/3/4/5

when player choose 'Plugin Info', then this plugin will print the text in chat (colorchat | ^x03Plugin by Author. ^x04 visit ^x01 blablabla.com | ^x03Special thanks to YOU for helping.)


AND, to open this MENU, player need to write '/mymenu' (just an example...)
after pressing an item (1/2/3/4/5) , the url to my MOTD will open, but the menu still opened, to not write '/mymenu' again...

IF POSSIBLE, player can write '/menuITEM1' = url blablablaMENU1.com will open | '/menuITEM2' = url blablablaMENU2.com .... etc...

I will very glad if YOU HELP, thanks and GOOD LUCK!

SORRY for my english...

Last edited by bazhenov93; 03-13-2012 at 02:16.
bazhenov93 is offline
CeDeee
Member
Join Date: Dec 2011
Old 03-13-2012 , 19:16   Re: (req) menu
Reply With Quote #2

Tomorrow I'll do it for you
CeDeee is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-13-2012 , 19:46   Re: (req) menu
Reply With Quote #3

Ok, try this. It requires Connor's colorchat.inc to compile.

PHP Code:
#include <amxmodx>
#include <colorchat> // Requires: http://forums.alliedmods.net/showpost.php?p=1417992&postcount=90

new const g_szHTMLformat[] = "<html><head><meta http-equiv=^"Refresh^" content=^"2;url=http://mysite_ITEM%d.com^" /></head><body bgcolor=^"#000000^"><center><img src=^"http://www.mysite.com/loading.gif^" /></center></body></html>";
new const g_szPluginInfo[] = "(colorchat | ^x03Plugin by Author. ^x04 visit ^x01 blablabla.com | ^x03Special thanks to YOU for helping.)"
new g_pMenu;

public 
plugin_init()
{
    
register_plugin("Custom Menu""0.1""Ford Prefect");
    
register_clcmd("say /mymenu""cmdMyMenu");
    
    
g_pMenu menu_create("\r[ \wMenu Title \r]""handleMyMenu");
    new 
szBuffer[12];
    for( new 
05i++ )
    {
        
formatex(szBuffercharsmax(szBuffer), "Item %d"i+1);
        
menu_additem(g_pMenuszBuffer"");
        
formatex(szBuffercharsmax(szBuffer), "say menuitem%d"i+1);
        
register_clcmd(szBuffer"cmdOneURL");
    }
    
menu_additem(g_pMenu"Plugin Info""");
    
menu_setprop(g_pMenuMPROP_EXITMEXIT_ALL);
}

public 
cmdMyMenu(id)
{
    
menu_display(idg_pMenu);
}

public 
handleMyMenu(idmenuitem)
{
    if( 
item == MENU_EXIT )
        return;
    
    switch( 
item )
    {
        case 
0..4:
        {
            
// MOTD
            
static szURL[230];
            
formatex(szURLcharsmax(szURL), g_szHTMLformatitem+1);
            
show_motd(idszURL);
            
cmdMyMenu(id);
        }
        case 
5:
        {
            
// Plugin Info
            
client_print_color(id_g_szPluginInfo);
            
cmdMyMenu(id)
        }
    }
    return;
}

public 
cmdOneURL(id)
{
    new 
szArg[12];
    static 
szURL[230];
    
    
read_argv(1szArgcharsmax(szArg));
    
formatex(szURLcharsmax(szURL), g_szHTMLformatszArg[8] - '0');
    
show_motd(idszURL);

__________________
fysiks is offline
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 03-14-2012 , 17:32   Re: (req) menu
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
Ok, try this. It requires Connor's colorchat.inc to compile.

PHP Code:
#include <amxmodx>
#include <colorchat> // Requires: http://forums.alliedmods.net/showpost.php?p=1417992&postcount=90

new const g_szHTMLformat[] = "<html><head><meta http-equiv=^"Refresh^" content=^"2;url=http://mysite_ITEM%d.com^" /></head><body bgcolor=^"#000000^"><center><img src=^"http://www.mysite.com/loading.gif^" /></center></body></html>";
new const g_szPluginInfo[] = "(colorchat | ^x03Plugin by Author. ^x04 visit ^x01 blablabla.com | ^x03Special thanks to YOU for helping.)"
new g_pMenu;

public 
plugin_init()
{
    
register_plugin("Custom Menu""0.1""Ford Prefect");
    
register_clcmd("say /mymenu""cmdMyMenu");
    
    
g_pMenu menu_create("\r[ \wMenu Title \r]""handleMyMenu");
    new 
szBuffer[12];
    for( new 
05i++ )
    {
        
formatex(szBuffercharsmax(szBuffer), "Item %d"i+1);
        
menu_additem(g_pMenuszBuffer"");
        
formatex(szBuffercharsmax(szBuffer), "say menuitem%d"i+1);
        
register_clcmd(szBuffer"cmdOneURL");
    }
    
menu_additem(g_pMenu"Plugin Info""");
    
menu_setprop(g_pMenuMPROP_EXITMEXIT_ALL);
}

public 
cmdMyMenu(id)
{
    
menu_display(idg_pMenu);
}

public 
handleMyMenu(idmenuitem)
{
    if( 
item == MENU_EXIT )
        return;
    
    switch( 
item )
    {
        case 
0..4:
        {
            
// MOTD
            
static szURL[230];
            
formatex(szURLcharsmax(szURL), g_szHTMLformatitem+1);
            
show_motd(idszURL);
            
cmdMyMenu(id);
        }
        case 
5:
        {
            
// Plugin Info
            
client_print_color(id_g_szPluginInfo);
            
cmdMyMenu(id)
        }
    }
    return;
}

public 
cmdOneURL(id)
{
    new 
szArg[12];
    static 
szURL[230];
    
    
read_argv(1szArgcharsmax(szArg));
    
formatex(szURLcharsmax(szURL), g_szHTMLformatszArg[8] - '0');
    
show_motd(idszURL);

yes it work fine, but how to add items?

1. menu title 1
2. menu title 2
3. menu title 3
4. menu title 3
5. menu title 4

and can't understand the redirect to motd.

menu title 1 = mysite.com/1.html
menu title 2 = mysite.com/2.html
menu title 3 = mysite.com/3.html
menu title 4 = mysite.com/4.html
menu title 5 = mysite.com/5.html
bazhenov93 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-14-2012 , 23:52   Re: (req) menu
Reply With Quote #5

Ok, so I made it a little more user friendly for you. You just need to edit what you see in quotes starting after the "You should customize stuff here." Note, however, that I did not implement the chat commands in this one because another method must be used when customizability is allowed.

PHP Code:
#include <amxmodx>
#include <colorchat> // Requires: http://forums.alliedmods.net/showpost.php?p=1417992&postcount=90

new g_szHTMLformat[250] = "<html><head><meta http-equiv=^"Refresh^" content=^"2;url=%s%s^" /></head><body bgcolor=^"#000000^"><center><img src=^"%s%s^" /></center></body></html>";

// You should customize stuff here.
new const g_szPluginInfo[] = "(colorchat | ^x03Plugin by Author. ^x04 visit ^x01 blablabla.com | ^x03Special thanks to YOU for helping.)";
new const 
g_szDomain[] = "http://www.mysite.com/";  // You must have the last slash here.

// This shows up as the menu options
new const g_szMenuItems[][] = {
    
"Item 1",
    
"Item 2",
    
"Item 3",
    
"Item 4",
    
"Item 5"
};

// This is the webpage it goes to at the domain site (e.g. The first one will go do http://www.mysite.com/1.html)
new const g_szWebpages[][] = {
    
"1.html",
    
"2.html",
    
"3.html",
    
"4.html",
    
"5.html"
};

// This is the thing that will be registered in chat (e.g. say /item1 will be equivalent to choosing option 1.  No spaces.  Each item must be unique.
new const g_szClientCmd[][] = {
    
"item1",
    
"item2",
    
"item3",
    
"item4",
    
"item5"
};
    
new const 
g_szImage[] = "loading.gif";
// End Customization

new g_pMenu;

public 
plugin_init()
{
    
register_plugin("Custom Menu""0.1""Ford Prefect");
    
register_clcmd("say /mymenu""cmdMyMenu");
    
    
format(g_szHTMLformatcharsmax(g_szHTMLformat), g_szHTMLformatg_szDomain"%s"g_szDomaing_szImage);
    
    
g_pMenu menu_create("\r[ \wMenu Title \r]""handleMyMenu");
    for( new 
05i++ )
    {
        
menu_additem(g_pMenug_szMenuItems[i], "");
    }
    
menu_additem(g_pMenu"Plugin Info""");
    
menu_setprop(g_pMenuMPROP_EXITMEXIT_ALL);
}

public 
cmdMyMenu(id)
{
    
menu_display(idg_pMenu);
}

public 
handleMyMenu(idmenuitem)
{
    if( 
item == MENU_EXIT )
        return;
    
    switch( 
item )
    {
        case 
0..4:
        {
            
// MOTD
            
static szURL[250];
            
formatex(szURLcharsmax(szURL), g_szHTMLformatg_szWebpages[item]);
            
show_motd(idszURL);
            
cmdMyMenu(id);
        }
        case 
5:
        {
            
// Plugin Info
            
client_print_color(id_g_szPluginInfo);
            
cmdMyMenu(id)
        }
    }
    return;

__________________
fysiks is offline
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 03-15-2012 , 08:26   Re: (req) menu
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
Ok, so I made it a little more user friendly for you. You just need to edit what you see in quotes starting after the "You should customize stuff here." Note, however, that I did not implement the chat commands in this one because another method must be used when customizability is allowed.
thankYOU very much! you helped, this plugin work perfect...
bazhenov93 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 09:33.


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