AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] Proper way to block team select menu popup on connect (https://forums.alliedmods.net/showthread.php?t=155608)

SonicSonedit 04-24-2011 11:00

[SOLVED] Proper way to block team select menu popup on connect
 
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!

SonicSonedit 04-24-2011 14:06

Re: Proper way to block team select menu popup on connect
 
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



ConnorMcLeod 04-24-2011 18:21

Re: [SOLVED] Proper way to block team select menu popup on connect
 
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.

SonicSonedit 04-24-2011 22:20

Re: [SOLVED] Proper way to block team select menu popup on connect
 
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).

bibu 06-27-2011 15:12

Re: [SOLVED] Proper way to block team select menu popup on connect
 
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.

nikhilgupta345 06-27-2011 15:15

Re: [SOLVED] Proper way to block team select menu popup on connect
 
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

bibu 06-27-2011 15:22

Re: [SOLVED] Proper way to block team select menu popup on connect
 
I meant the post from Sonic as slowhacking.

nikhilgupta345 06-27-2011 15:26

Re: [SOLVED] Proper way to block team select menu popup on connect
 
Don't think that's slowhacking either.

drekes 06-27-2011 15:41

Re: [SOLVED] Proper way to block team select menu popup on connect
 
It changed a client's cvar without his permission, so i'm pretty sure it is slowhacking.

Hunter-Digital 06-27-2011 15:49

Re: [SOLVED] Proper way to block team select menu popup on connect
 
Just curious, am I blind but what client cvar did any of these codes change ? O.o


All times are GMT -4. The time now is 20:13.

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