View Single Post
Author Message
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-12-2017 , 00:05   Exception reported: A vote is already in progress
Reply With Quote #1

Hey guys, I'm getting the following errors whenever I use a command to open a vote menu while another vote menu is already open.

Error:

Code:
L 12/11/2017 - 20:50:36: [SM] Exception reported: A vote is already in progress
L 12/11/2017 - 20:50:36: [SM] Blaming: l4d_anti-speedrunner.smx
L 12/11/2017 - 20:50:36: [SM] Call stack trace:
L 12/11/2017 - 20:50:36: [SM]   [0] VoteMenu
L 12/11/2017 - 20:50:36: [SM]   [1] Line 584, C:\Program Files (x86)\Steam\steamapps\common\Left 4 Dead 2\left4dead2\addons\sourcemod\scripting\l4d_anti-speedrunner.sp::Command_Chase
L 12/11/2017 - 20:51:20: [SM] Exception reported: A vote is already in progress
L 12/11/2017 - 20:51:20: [SM] Blaming: l4d_anti-speedrunner.smx
L 12/11/2017 - 20:51:20: [SM] Call stack trace:
L 12/11/2017 - 20:51:20: [SM]   [0] VoteMenu
L 12/11/2017 - 20:51:20: [SM]   [1] Line 639, C:\Program Files (x86)\Steam\steamapps\common\Left 4 Dead 2\left4dead2\addons\sourcemod\scripting\l4d_anti-speedrunner.sp::Command_Warp
My menu code:

PHP Code:
char GlobalBuffer[512];

public 
Action Command_Chase(int clientint args)
{
    if(!
l4d_ass_enable.BoolValue || !l4d_ass_punish_enable.BoolValue || !l4d_ass_punish_vote.BoolValue || l4d_ass_punish_auto.BoolValue || NumTanks2)
        return 
Plugin_Handled;
    if(!
l4d_ass_punish_tank.BoolValue)
        
CountTanks();
    
tmenuStarted false;
    if(
l4d_ass_punish_vote.BoolValue)
    {
        for(
int i 1<= MaxClientsi++)
        {
            if(!
IsValidClient(i))
                continue;
            
humanPlayers[totalHumans++] = i;
        }

        for(
int i 1<= MaxClientsi++)
        {
            if(!
pmenuStarted && IsValidClient(i))
            {
                
pmenuStarted true;
                
Menu chooseMenu CreateMenu(chooseMenuHandler);
                
SetVoteResultCallback(chooseMenuchooseMenuResults);
                
Format(GlobalBuffersizeof(GlobalBuffer), "%T""PunishSpeedrunners"i);
                
chooseMenu.SetTitle(GlobalBuffer); 
                
Format(GlobalBuffersizeof(GlobalBuffer), "%T""YesOption"i);
                
chooseMenu.AddItem("Yes"GlobalBuffer);
                
Format(GlobalBuffersizeof(GlobalBuffer), "%T""NoOption"i);
                
chooseMenu.AddItem("No"GlobalBuffer); 
                
SetMenuPagination(chooseMenuMENU_NO_PAGINATION);
                
VoteMenu(chooseMenuhumanPlayerstotalHumans30);
            }

            else
            {
                if(
tmenuStarted)
                {
                    if(
IsValidClient(i))
                        
ReplyToCommand(i"\x04[ASS]\x01 %T""TeleportMenuOn"i);
                    return 
Plugin_Handled;
                }

                else if(
pmenuStarted)
                {
                    if(
IsValidClient(i))
                        
ReplyToCommand(i"\x04[ASS]\x01 %T""PunishMenuOn"i);
                    return 
Plugin_Handled;
                }
            }
        }
    }

    return 
Plugin_Continue;
}

public 
Action Command_Warp(int clientint args)
{
    if(!
l4d_ass_enable.BoolValue || !l4d_ass_teleport_enable.BoolValue || !l4d_ass_teleport_vote.BoolValue || l4d_ass_teleport_auto.BoolValue || NumTanks3)
        return 
Plugin_Handled;
    if(!
l4d_ass_teleport_tank.BoolValue)
        
CountTanks();
    
pmenuStarted false;
    if(
l4d_ass_teleport_vote.BoolValue)
    {
        for(
int i 1<= MaxClientsi++)
        {
            if(!
IsValidClient(i))
                continue;
            
humanPlayers[totalHumans++] = i;
        }

        for(
int i 1<= MaxClientsi++)
        {
            if(!
tmenuStarted && IsValidClient(i))
            {
                
tmenuStarted true;
                
Menu chooseMenu2 CreateMenu(chooseMenuHandler2);
                
SetVoteResultCallback(chooseMenu2chooseMenuResults2);
                
Format(GlobalBuffersizeof(GlobalBuffer), "%T""TeleportSpeedrunners"i);
                
chooseMenu2.SetTitle(GlobalBuffer); 
                
Format(GlobalBuffersizeof(GlobalBuffer), "%T""YesOption"i);
                
chooseMenu2.AddItem("Yes"GlobalBuffer);
                
Format(GlobalBuffersizeof(GlobalBuffer), "%T""NoOption"i);
                
chooseMenu2.AddItem("No"GlobalBuffer); 
                
SetMenuPagination(chooseMenu2MENU_NO_PAGINATION);
                
VoteMenu(chooseMenu2humanPlayerstotalHumans30);
            }

            else
            {
                if(
pmenuStarted)
                {
                    if(
IsValidClient(i))
                        
ReplyToCommand(i"\x04[ASS]\x01 %T""PunishMenuOn"i);
                    return 
Plugin_Handled;
                }

                else if(
tmenuStarted)
                {
                    if(
IsValidClient(i))
                        
ReplyToCommand(i"\x04[ASS]\x01 %T""TeleportMenuOn"i);
                    return 
Plugin_Handled;
                }
            }
        }
    }

    return 
Plugin_Handled;
}

public 
int chooseMenuHandler(Menu menuMenuAction actionint param1int param2)
{
    if(
l4d_ass_punish_vote.BoolValue && !l4d_ass_punish_auto.BoolValue)
    {
        switch(
action)
        {
            case 
MenuAction_Select:
            {
                
GetMenuItem(menuparam2GlobalBuffersizeof(GlobalBuffer));
                switch(
StringToInt(GlobalBuffer))
                {
                    case 
0pvotedYes += 1;
                    case 
1pvotedNo += 1;
                }
            }

            case 
MenuAction_End:
                
delete menu;
        }
    }
}

public 
int chooseMenuHandler2(Menu menuMenuAction actionint param1int param2)
{
    if(
l4d_ass_teleport_vote.BoolValue && !l4d_ass_teleport_auto.BoolValue)
    {
        switch(
action)
        {
            case 
MenuAction_Select:
            {
                
GetMenuItem(menuparam2GlobalBuffersizeof(GlobalBuffer));
                switch(
StringToInt(GlobalBuffer))
                {
                    case 
0tvotedYes += 1;
                    case 
1tvotedNo += 1;
                }
            }

            case 
MenuAction_End:
                
delete menu;
        }
    }
}

public 
void chooseMenuResults(Handle menuint pnum_votesint num_clients, const int[][] client_infoint num_items, const int[][] item_info)
{
    if(!
l4d_ass_enable.BoolValue || !l4d_ass_punish_enable.BoolValue || !l4d_ass_punish_vote.BoolValue || l4d_ass_punish_auto.BoolValue || NumTanks2)
        return;
    if(!
l4d_ass_punish_tank.BoolValue)
        
CountTanks();
    
pnum_votes pvotedYes pvotedNo;
    if(
pnum_votes GetHumanCount())
        
pvotedUnknown GetHumanCount() - pnum_votes;
    if(
pvotedUnknown pnum_votes)
    {
        for(
int i 1<= MaxClientsi++)
            if(
IsValidClient(i))
                
PrintToChatAll("\x04[ASS]\x01 %T""NoVotes"i);
    }

    else
    {
        if(
pvotedYes pvotedNo)
        {
            
int add GetConVarInt(l4d_ass_punish_timer);
            
CreateTimer(0.1TimerUpdatePlayerGetEngineTime() + addTIMER_REPEAT);
            for(
int i 1<= MaxClientsi++)
                if(
IsValidClient(i))
                    
PrintToChatAll("\x04[ASS]\x01 %T""VotedYes"i);
        }

        else if(
pvotedNo pvotedYes)
            for(
int i 1<= MaxClientsi++)
                if(
IsValidClient(i))
                    
PrintToChatAll("\x04[ASS]\x01 %T""VotedNo"i);
    }

    
pmenuStarted false;
    
pvotedYes 0;
    
pvotedNo 0;
    return;
}

public 
void chooseMenuResults2(Handle menuint tnum_votesint num_clients, const int[][] client_infoint num_items, const int[][] item_info)
{
    if(!
l4d_ass_enable.BoolValue || !l4d_ass_teleport_enable.BoolValue || !l4d_ass_teleport_vote.BoolValue || l4d_ass_teleport_auto.BoolValue || NumTanks3)
        return;
    if(!
l4d_ass_teleport_tank.BoolValue)
        
CountTanks();
    
tnum_votes tvotedYes tvotedNo;
    if(
tnum_votes GetHumanCount())
        
tvotedUnknown GetHumanCount() - tnum_votes;
    if(
tvotedUnknown tnum_votes)
    {
        for(
int i 1<= MaxClientsi++)
            if(
IsValidClient(i))
                
PrintToChatAll("\x04[ASS]\x01 %T""NoVotes"i);
    }

    else
    {
        if(
tvotedYes tvotedNo)
        {
            
int add GetConVarInt(l4d_ass_teleport_timer);
            
CreateTimer(0.1TimerCheckForSpeedrunnersGetEngineTime() + addTIMER_REPEAT);
            for(
int i 1<= MaxClientsi++)
                if(
IsValidClient(i))
                    
PrintToChatAll("\x04[ASS]\x01 %T""VotedYes"i);
        }

        else if(
tvotedNo tvotedYes)
            for(
int i 1<= MaxClientsi++)
                if(
IsValidClient(i))
                    
PrintToChatAll("\x04[ASS]\x01 %T""VotedNo"i);
    }

    
tmenuStarted false;
    
tvotedYes 0;
    
tvotedNo 0;
    return;

__________________

Last edited by Psyk0tik; 12-12-2017 at 06:47. Reason: Marked as [Solved]
Psyk0tik is offline