AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Fatal error: New message started when msg '86' has not been sent yet (https://forums.alliedmods.net/showthread.php?t=332994)

The overrated maniac 06-13-2021 03:53

Fatal error: New message started when msg '86' has not been sent yet
 
I added it to block the menu to choose team and when I try to join the game it crashed.. (I cant have logs because I dont have a dedicated server, I use new game to test)

The message when it crashs says: Fatal error: New message started when msg '86' has not been sent yet

PHP Code:

public message_showmenu(msgiddestid)
{
        
join_user(msgidid);
        return 
PLUGIN_HANDLED;
}

public 
message_vguimenu(msgiddestid)
{
        
join_user(msgidid);
        return 
PLUGIN_HANDLED;
}

public 
join_user(msgid){
    
    if (
get_user_team(id)){
        return;
}

    new 
msg_block;
    
msg_block get_msg_block(msg);
    
set_msg_block(msgBLOCK_SET);
    
engclient_cmd(id"jointeam""5");
    
engclient_cmd(id"joinclass""5");
    
set_msg_block(msgmsg_block);
    


I hope someone can help me or tell how block the choosemenu/jointeam right

Edit, solution:
PHP Code:


const OFFSET_VGUIMENU 2;
enum _:MESSAGES_STRUCT
{
    
SHOWMENU,
    
VGUIMENU
};

new 
g_message[MESSAGES_STRUCT];

public 
plugin_init() {
    
register_clcmd("chooseteam""clcmd_chooseteam");
    
register_clcmd("jointeam""clcmd_chooseteam");
    
g_message[SHOWMENU] = get_user_msgid("ShowMenu");
    
g_message[VGUIMENU] = get_user_msgid("VGUIMenu");
    
register_message(g_message[SHOWMENU], "message_showmenu");
    
register_message(g_message[VGUIMENU], "message_vguimenu");
}

public 
clcmd_chooseteam(id){
return 
PLUGIN_HANDLED;
}
public 
client_jointeam_tt(id){
    
    if (
is_user_bot(id)){
        return;
    }
    
    static 
vgui;
    
vgui = (get_pdata_int(id510) & (1<<0));
                
    if (
vgui)
        
set_pdata_int(id510get_pdata_int(id510) & ~(1<<0));
    
    
set_msg_block(get_user_msgid("ShowMenu"), BLOCK_ONCE);
    
set_msg_block(get_user_msgid("VGUIMenu"), BLOCK_ONCE);
    
engclient_cmd(id"jointeam""1");            
    
engclient_cmd(id"joinclass""5");
            
    
set_msg_block(get_user_msgid("ShowMenu"), get_msg_block(get_user_msgid("ShowMenu")));
    
set_msg_block(get_user_msgid("ShowMenu"), get_msg_block(get_user_msgid("VGUIMenu")));
            
    if (
vgui)
        
set_pdata_int(id510get_pdata_int(id510));
    
    
ExecuteHamB(Ham_CS_RoundRespawnid);
}

public 
client_jointeam_ct(id){
    
    if (
is_user_bot(id)){
        return;
    }
    
    static 
vgui;
    
vgui = (get_pdata_int(id510) & (1<<0));
                
    if (
vgui)
        
set_pdata_int(id510get_pdata_int(id510) & ~(1<<0));
    
    
set_msg_block(get_user_msgid("ShowMenu"), BLOCK_ONCE);
    
set_msg_block(get_user_msgid("VGUIMenu"), BLOCK_ONCE);
    
engclient_cmd(id"jointeam""2");            
    
engclient_cmd(id"joinclass""5");
            
    
set_msg_block(get_user_msgid("ShowMenu"), get_msg_block(get_user_msgid("ShowMenu")));
    
set_msg_block(get_user_msgid("ShowMenu"), get_msg_block(get_user_msgid("VGUIMenu")));
            
    if (
vgui)
        
set_pdata_int(id510get_pdata_int(id510));
    
    
ExecuteHamB(Ham_CS_RoundRespawnid);
}

public 
message_showmenu(msgiddestid)
{
    static 
message[21];
    
get_msg_arg_string(4messagecharsmax(message));
    
    if (
containi(message"Team_Select") != -1)
        return 
PLUGIN_HANDLED;
    
    return 
PLUGIN_CONTINUE;
}

public 
message_vguimenu(msgiddestid)
{
    if (
get_msg_arg_int(1) != OFFSET_VGUIMENU)
        return 
PLUGIN_CONTINUE;
    
    return 
PLUGIN_HANDLED;


You have to call "client_jointeam_ct" or "client_jointeam_tt" when you want to make the player join the team.

DJEarthQuake 06-13-2021 06:27

Re: Fatal error: New message started when msg '86' has not been sent yet
 
-Search before posting a question.
amxx block team menu
Quote:

Originally Posted by The overrated maniac (Post 2749607)
how block the choosemenu/jointeam right


Use descriptive topic titles. People should know at a glance of the title what the thread is about.

The overrated maniac 06-13-2021 06:37

Re: Fatal error: New message started when msg '86' has not been sent yet
 
Thanks dude I'll try it


All times are GMT -4. The time now is 01:19.

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