Raised This Month: $ Target: $400
 0% 

Gamemenu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rainin
Member
Join Date: Apr 2011
Location: Estonia
Old 11-21-2011 , 10:46   Gamemenu
Reply With Quote #1

Hi,
so i'm trying to a gamemenu, that if you press M (chooseteam) button there will open a menu. So i would want to block all the chooseteam vgui menus and that stuff.

What i hace made so far.
PHP Code:
public public_init()
{
   
register_message(get_user_msgid("ShowMenu"), "MessageShowMenu");
   
register_message(get_user_msgid("VGUIMenu"), "MessageVGUIMenu");
   
register_clcmd"chooseteam","menu");
}
//Other
public MessageShowMenu(iMsgIDiDestiReceiver)
{
    new const 
Team_Select[] = "#Team_Select";
    
    new 
szMenu[sizeof(Team_Select)];
    
get_msg_arg_string(4szMenucharsmax(szMenu));
    
    if(!
equal(szMenuTeam_Select))
    {
         return 
PLUGIN_CONTINUE;
    }
    
    
// reset CS menu code
    
set_pdata_int(iReceiverm_iMenuCode0);
    
    
// show your own menu
    
    
return PLUGIN_HANDLED;
}

public 
MessageVGUIMenu(iMsgIDiDestiReceiver)
{
    if(
get_msg_arg_int(1) != 2)
    {
        return 
PLUGIN_CONTINUE;
    }
    
    
// show your own menu
    
    
return PLUGIN_HANDLED;
}

// Servermenu
/////////////////////////////////////////
public menu(id)
{
    new 
menu menu_create("\rGecses.eu Menu:""menu_handler");
    
    
menu_additem(menu"\wTeenused""1"0);
    
menu_additem(menu"\wReeglid""2"0);
    
menu_additem(menu"\wVipmenu""3"0);
    
menu_additem(menu"\wRaadio""4"0);
    
menu_additem(menu"\wDrShop""5"0);
    
menu_additem(menu"\wRespawn""6"0);

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}

public 
menu_handler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], iName[64];
    new 
accescallback;
    
menu_item_getinfo(menuitemaccesdata,5iName63callback);
        
    new 
key str_to_num(data);

    switch(
key)
    {
        case 
1:
        {
        
client_cmd(id"say /teenused");
        }
        case 
2:
        {
            
client_cmd(id"say /reeglid");
        }
        case 
3:
        {
            
client_cmd(id"say /vipmenu");
        }
        case 
4:
        {
            
client_cmd(id"say /raadio");
        
menu_destroy(menu);
            return 
PLUGIN_HANDLED;
        }
        case 
5:
        {
            
client_cmd(id"say /drshop");
        
menu_destroy(menu);
            return 
PLUGIN_HANDLED;
        }
          
        case 
6:
        {
            
fnRevivePlayer(id);
        
menu_destroy(menu);
            return 
PLUGIN_HANDLED;
        }
    }

    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;

If someone could help, that would be awesome!

Edit: Oh and i have a problem with the menu aswell, if i press any button it doesnt open the other menu that it should.

Last edited by rainin; 11-21-2011 at 10:48.
rainin is offline
Send a message via MSN to rainin
enjoi.
Veteran Member
Join Date: Mar 2011
Old 11-21-2011 , 16:49   Re: Gamemenu
Reply With Quote #2

Thats slowhacking I believe? You'd have to ask the clients permisson correct me if im wrong
__________________
Block Maker v6.0 []
Point Slay v3.0 []
Contact [ PM ]
enjoi. is offline
Korxu
Senior Member
Join Date: Sep 2010
Old 11-21-2011 , 17:36   Re: Gamemenu
Reply With Quote #3

I am using this:
PHP Code:

new gi_MessageIndex

public plugin_init ( )
{
     
register_message get_user_msgid "ShowMenu" ), "menu_team" )
     
register_message get_user_msgid "VGUIMenu" ), "vgui_team" )
}

public 
menu_team messagedestrec )
{
     new 
sz_MenuText 12 ]

     
get_msg_arg_string 4sz_MenuTextcharsmax sz_MenuText ) )

     if ( !
equal sz_MenuText"#Team_Select" ) )
     {
          return 
PLUGIN_CONTINUE
     
}

     
set_pdata_int rec205)

     
gi_MessageIndex message

     
// Now, you call to your custom menu, example:
     // custom_menu ( rec )

     
return PLUGIN_HANDLED
}

public 
vgui_menu messagedestrec )
{
     if ( 
get_msg_arg_int ) != )
     {
          return 
PLUGIN_CONTINUE
     
}

     
gi_MessageIndex message

     
// The same, send your custom menu here ( the same example ):
     // custom_menu ( rec )

     
return PLUGIN_HANDLED
}

// And now use this stock in the handler of your custom menu to change the player team:

/*
** @param1     - Player index.
** @param2     - Team number ( 1 = T, 2 = CT, 6 = SPECT ).
** @param3     - Player class.
*/

// *NOTE* You can use only "change_team ( index )" to move a player to the spects team.

stock change_team index, const team [ ] = "5", const class [ ] = "0" )
{
     new 
i_MessageBlock

     i_MessageBlock 
get_msg_block gi_MessageIndex )

     
set_msg_block gi_MessageIndexBLOCK_SET )

     
engclient_cmd index"jointeam"team )
     
engclient_cmd index"joinclass", class )

     
set_msg_block gi_MessageIndexi_MessageBlock )

Korxu is offline
rainin
Member
Join Date: Apr 2011
Location: Estonia
Old 11-22-2011 , 12:32   Re: Gamemenu
Reply With Quote #4

Korxu: idk that code doesn't work for me... No errors but in-game the plugin doesnt work
rainin is offline
Send a message via MSN to rainin
Korxu
Senior Member
Join Date: Sep 2010
Old 11-22-2011 , 12:33   Re: Gamemenu
Reply With Quote #5

Show me how did you used the code.
Korxu is offline
rainin
Member
Join Date: Apr 2011
Location: Estonia
Old 11-22-2011 , 13:00   Re: Gamemenu
Reply With Quote #6

PHP Code:
new gi_MessageIndex;

public 
plugin_init( ) {
   
register_message get_user_msgid "ShowMenu" ), "menu_team" );
   
register_message get_user_msgid "VGUIMenu" ), "vgui_team" );
}
//Other
public menu_team messagedestrec )
{
     new 
sz_MenuText 12 ];

     
get_msg_arg_string 4sz_MenuTextcharsmax sz_MenuText ) );

     if ( !
equal sz_MenuText"#Team_Select" ) )
     {
          return 
PLUGIN_CONTINUE;
     }

     
set_pdata_int rec205);

     
gi_MessageIndex message;

     
// Now, you call to your custom menu, example:
     // custom_menu ( rec )

     
return PLUGIN_HANDLED;
}

public 
vgui_menu messagedestrec )
{
     if ( 
get_msg_arg_int ) != )
     {
          return 
PLUGIN_CONTINUE;
     }

     
gi_MessageIndex message;

     
// The same, send your custom menu here ( the same example ):
     // custom_menu ( rec )

     
return PLUGIN_HANDLED;
}

// And now use this stock in the handler of your custom menu to change the player team:

/*
** @param1     - Player index.
** @param2     - Team number ( 1 = T, 2 = CT, 6 = SPECT ).
** @param3     - Player class.
*/
stock change_team index, const team [ ] = "5", const class [ ] = "0" )
{
     new 
i_MessageBlock;

     
i_MessageBlock get_msg_block gi_MessageIndex );

     
set_msg_block gi_MessageIndexBLOCK_SET );

     
engclient_cmd index"jointeam"team );
     
engclient_cmd index"joinclass", class );

     
set_msg_block gi_MessageIndexi_MessageBlock );

rainin is offline
Send a message via MSN to rainin
Korxu
Senior Member
Join Date: Sep 2010
Old 11-22-2011 , 15:49   Re: Gamemenu
Reply With Quote #7

You don't read the comments?

PHP Code:
// Now, you call to your custom menu, example:
// custom_menu ( rec ) 
PHP Code:
// The same, send your custom menu here ( the same example ):
// custom_menu ( rec ) 
You have to create your custom team menu and use the stock correctly in the 'handler' function of your menu.
Korxu is offline
rainin
Member
Join Date: Apr 2011
Location: Estonia
Old 11-24-2011 , 13:29   Re: Gamemenu
Reply With Quote #8

Oh, my bad -.-

But when i connect to the server the menu is already open. How can i close it, when he connects?
rainin is offline
Send a message via MSN to rainin
Korxu
Senior Member
Join Date: Sep 2010
Old 11-24-2011 , 14:21   Re: Gamemenu
Reply With Quote #9

Oh, sorry, I didn't understand you... I thought that you wanted to create your custom team menu. Now, with this code, when the user enter he will choose a random team and he can't change his team again.

Try it and say me if it works.

PHP Code:
#include < amxmodx >
#include < cstrike >
#include < fakemeta >

new gi_MessageIndex

public plugin_init ( )
{
     
register_message get_user_msgid "ShowMenu" ), "menu_team" )
     
register_message get_user_msgid "VGUIMenu" ), "vgui_team" )
}

public 
menu_team messagedestrec )
{
     new 
sz_MenuText 12 ]

     
get_msg_arg_string 4sz_MenuTextcharsmax sz_MenuText ) )

     if ( !
equal sz_MenuText"#Team_Select" ) )
     {
          return 
PLUGIN_CONTINUE
     
}

     if ( 
cs_get_user_team index ) != CS_TEAM_UNASSIGNED )
     {
          return 
PLUGIN_CONTINUE
     
}

     
set_pdata_int rec205)

     
gi_MessageIndex message

     set_team 
rec"5""5" )

     return 
PLUGIN_HANDLED
}

public 
vgui_menu messagedestrec )
{
     if ( 
get_msg_arg_int ) != )
     {
          return 
PLUGIN_CONTINUE
     
}

     if ( 
cs_get_user_team index ) != CS_TEAM_UNASSIGNED )
     {
          return 
PLUGIN_CONTINUE
     
}

     
gi_MessageIndex message

     
if ( cs_get_user_team index ) != CS_TEAM_UNASSIGNED )
     {
          
set_team rec"5""5" )
     }

     return 
PLUGIN_HANDLED
}

stock change_team index, const team [ ] = "5", const class [ ] = "0" )
{
     new 
i_MessageBlock

     i_MessageBlock 
get_msg_block gi_MessageIndex )

     
set_msg_block gi_MessageIndexBLOCK_SET )

     
engclient_cmd index"jointeam"team )
     
engclient_cmd index"joinclass", class )

     
set_msg_block gi_MessageIndexi_MessageBlock )


Last edited by Korxu; 11-24-2011 at 14:23.
Korxu is offline
rainin
Member
Join Date: Apr 2011
Location: Estonia
Old 11-24-2011 , 14:29   Re: Gamemenu
Reply With Quote #10

PHP Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c1997-2006 ITB CompuPhaseAMX Mod X Team

Error
Undefined symbol "set_team" on line 379
Error
Undefined symbol "set_team" on line 400 

Last edited by rainin; 11-24-2011 at 14:30.
rainin is offline
Send a message via MSN to rainin
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 08:34.


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