Fretta fretta_voting Bug

I found a small but in the fretta voting system. If you set the convar fretta_voting to 0 ( false ) then the players cant vote for maps.

Here is the votemap function:
( Taken from luabin.foszor.com gamemodes/fretta/sv_gmchanger.lua )




function GM:VotePlayMap( ply, map )
    
    if ( !map ) then return end
    if ( !GAMEMODE.WinningGamemode ) then return end
    if ( !GAMEMODE:InGamemodeVote() ) then return end
    if ( !GAMEMODE:IsValidGamemode( GAMEMODE.WinningGamemode, map ) ) then return end
    
    ply:SetNWString( "Wants", map )
    
end

concommand.Add( "votemap", function( pl, cmd, args ) GAMEMODE:VotePlayMap( pl, args[1] ) end )



The problem is: It cheks if there is a gamemode vote.

( The gamemode check functionis super simple : it returns the global bool: “InGamemodeVote”)

Here is the StartGamemodeVote code:




if ( fretta_voting:GetBool() ) then

            GAMEMODE:ClearPlayerWants()
            BroadcastLua( "GAMEMODE:ShowGamemodeChooser()" );
            SetGlobalBool( "InGamemodeVote", true )
            
        else

            GAMEMODE.WinningGamemode = GAMEMODE.FolderName
            return GAMEMODE:StartMapVote()
            
        end



If the fretta voting is disabled it skips the gamemode vote part BUT it not sets the global var “InGamemodeVote” so when the map vote function checks if there is a gamemode vote then it returns false and wont let the players to vote for the map. Please fix this Garry!

fretta_voting is meant to disable voting, including map voting. A new convar for map voting wouldn’t hurt though.

I made a quick fix for it. It solves the problem temporary.

[LUA]

if ( SERVER ) then

local function OverrideFrettaVote()

    if ( !frettaVoteOverriden ) then
    
        local oldStartGVoting = GAMEMODE.StartGamemodeVote
    
        function GAMEMODE:StartGamemodeVote()

            if( !GAMEMODE.m_bVotingStarted )then
                SetGlobalBool( "InGamemodeVote" , true )
            end
        
            oldStartGVoting( GAMEMODE )
        end

        frettaVoteOverriden = true
    end
    
    ErrorNoHalt( "= Fretta voting bug fix loaded = 

" )
end
timer.Simple( 3 , OverrideFrettaVote )
ErrorNoHalt( "= Fretta voting bug fix file included. =
" )

end

[/LUA]

Put it in the server autorun folder. It should work.