Raised This Month: $ Target: $400
 0% 

[SOLVED] Proper way to block team select menu popup on connect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-24-2011 , 11:00   [SOLVED] Proper way to block team select menu popup on connect
Reply With Quote #1

Hello everyone. On connection i want to show menu of my own instead of choose team menu.

That what i tried to do:
PHP Code:
register_message(get_user_msgid("ShowMenu"), "message_ShowMenu")

.......

public 
message_ShowMenu(msgiddestid)
{
    static 
strtemp[32]
    
    if (
zp_cs_bank_status[id]<0)
        
load_player_money(id)

    
get_msg_arg_string(4strtempcharsmax(strtemp))
    
    if (!
equal(strtemp"#Team_Select"strlen("#Team_Select"))||zp_cs_bank_status[id]==2||zp_cs_submenuid[id])
        return 
PLUGIN_CONTINUE

    set_msg_block
(msgidBLOCK_SET)
    
show_menu(id0"^n"1
    
clcmd_bank(id)
    return 
PLUGIN_HANDLED

If I comment //clcmd_bank(id) then there is really no team select menu, but if i don't something strange happens: my custom menu actually apprears instead of team select menu, buy if you press for example 1 in my menu you will select team, and if you press 1 once again, you will select class. Any help/explanation will be appreciated!
__________________


Last edited by SonicSonedit; 04-24-2011 at 14:15. Reason: Solved.
SonicSonedit is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-24-2011 , 14:06   Re: Proper way to block team select menu popup on connect
Reply With Quote #2

Fixed. There are actually 3 team select menu messages. You also have to call chooseteam manually to get access to them.

PHP Code:
public message_ShowMenu(msgiddestid)
{
    static 
strtemp[32]
    
    if (
zp_cs_bank_status[id]<0)
        
load_player_money(id)

    
get_msg_arg_string(4strtempcharsmax(strtemp))
    
    if (!
equal(strtemp"#Team_Select"strlen("#Team_Select"))||zp_cs_bank_status[id]==2||zp_cs_submenuid[id])
        return 
PLUGIN_CONTINUE

    client_cmd
(id"chooseteam; wait; slot10; wait; slot10; wait; slot10; bank;")
    return 
PLUGIN_HANDLED

__________________

SonicSonedit is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-24-2011 , 18:21   Re: [SOLVED] Proper way to block team select menu popup on connect
Reply With Quote #3

The exact name you are searching is #Team_Select_Spect, all you have to do is to set string msg to "" (null string), or may be "\n", and to set keys arg to 0.

All old menus are there : http://forums.alliedmods.net/showthread.php?t=130708

You may want to find a way to block VGUI menu as well.

With orpheu, you should completely prevent both menus from being sent.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-24-2011 , 22:20   Re: [SOLVED] Proper way to block team select menu popup on connect
Reply With Quote #4

ConnorMcLeod
Thank you for your reply! Unfortunelly method with nulling message didn't help. Buy I didn't try to set other args to 0, maybe this was what i needed. I guess i given up manipulating with message itself after I failed to block it.
But why set_msg_block(msgid, BLOCK_SET) and return PLUGIN_HANDLED didn't work? I mean, this message is not even supposed to be passed to client, but keys and menu handle somehow get registered on client side - and when you press 1 in ANY menu, you will join terrorist team and class menu will pop up.

About VGUI menu - since i didn't find reliable way to hide it, I disable VGUI menu by setting _vgui_menus to 0 on player connect and then enable it right before re-showing team select menu to player (after player done with custom menu).
__________________

SonicSonedit is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 06-27-2011 , 15:12   Re: [SOLVED] Proper way to block team select menu popup on connect
Reply With Quote #5

Can someone show a better way, instead of slowhacking?

I would like to show a custom menu after pressing "OK" in the MOTD.

PHP Code:
// New VGUI Menus
stock const VGUI_JOIN_TEAM_NUM =     2

register_message
(get_user_msgid("VGUIMenu"), "message_VGUIMenu")

public 
message_VGUIMenu(iMsgidiDestid)
{
    if(
get_msg_arg_int(1) != VGUI_JOIN_TEAM_NUM)
    {
        return 
PLUGIN_CONTINUE
    
}
    
client_cmd(id"slot10")
    
set_task(0.1"task_team_menu"id)
    return 
PLUGIN_HANDLED

Doesn't work perfectly.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 06-27-2011 , 15:15   Re: [SOLVED] Proper way to block team select menu popup on connect
Reply With Quote #6

That's not considered slowhacking, because you aren't actually changing his binds, and making them press slot10 won't actually affect their gameplay nor their binds in any way.

Correct me if I'm wrong :O
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
bibu
Veteran Member
Join Date: Sep 2010
Old 06-27-2011 , 15:22   Re: [SOLVED] Proper way to block team select menu popup on connect
Reply With Quote #7

I meant the post from Sonic as slowhacking.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 06-27-2011 , 15:26   Re: [SOLVED] Proper way to block team select menu popup on connect
Reply With Quote #8

Don't think that's slowhacking either.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-27-2011 , 15:41   Re: [SOLVED] Proper way to block team select menu popup on connect
Reply With Quote #9

It changed a client's cvar without his permission, so i'm pretty sure it is slowhacking.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-27-2011 , 15:49   Re: [SOLVED] Proper way to block team select menu popup on connect
Reply With Quote #10

Just curious, am I blind but what client cvar did any of these codes change ? O.o
__________________
Hunter-Digital is offline
Reply


Thread Tools
Display Modes

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 20:13.


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