Raised This Month: $ Target: $400
 0% 

[TF2] Built-in vote fixer (conflict between built-in vote and sm_nextmap)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
deathmojang
Junior Member
Join Date: Aug 2016
Location: Korea
Plugin ID:
7368
Plugin Version:
1.0.0
Plugin Category:
General Purpose
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    This plugin does hooks 'vote success' user message and changes 'sm_nextmap' cvar by msg's value.
    Old 11-06-2020 , 09:10   [TF2] Built-in vote fixer (conflict between built-in vote and sm_nextmap)
    Reply With Quote #1

    TF2-Built-in-Vote-sm_nextmap-bug-fix

    This hooks 'vote success' user message and changes 'sm_nextmap' cvar to usermsg's value.

    This plugin helps prevent TF2 built-in vote mechanism not working through changing 'sm_nextmap' cvar forcibily.

    I did a few tries but only this 'indirect' way worked. So I post this plugin although it has a ugly and indirect way.

    I hope this could be helpful to other people, and if you know the way to fix this problem in right way, please reply to this thread and i would be very thankful to you.

    Link to my github repository:
    https://github.com/jobggun/Sourcemod...xtmap-bug-fix/

    Easy access to my code:
    PHP Code:
    #include <sourcemod>

    #pragma semicolon 1
    #pragma newdecls required

    ConVar g_CvarSmnextmap null;

    public 
    Plugin myinfo = {
        
    name        "TF2 Built-in Vote sm_nextmap bug fix",
        
    author      "Jobggun",
        
    description "Making TF2 Built-in vote work well with sourcemod nextmap plugin",
        
    version     "1.0.0",
        
    url         ""
    };

    public 
    void OnPluginStart()
    {
        
    g_CvarSmnextmap FindConVar("sm_nextmap");
        
        
    HookUserMessage(GetUserMessageId("VotePass"), Hook_ChangeLeveltrue);
    }

    public 
    Action Hook_ChangeLevel(UserMsg msg_idBfRead msg, const int[] playersint playersNumbool reliablebool init)
    {
        
        
    int team;
        
    char reason[256];
        
    char map[256];
        
        
    team msg.ReadByte();
        
    msg.ReadString(reasonsizeof(reason), false);
        
    msg.ReadString(mapsizeof(map), false);
        
        if(!
    StrEqual(reason"#TF_vote_passed_changelevel"false))
        {
            return 
    Plugin_Continue;
        }
        
        
    g_CvarSmnextmap.SetString(mapfalsetrue);
        
        return 
    Plugin_Continue;

    Link to my github repository:
    https://github.com/jobggun/Sourcemod...xtmap-bug-fix/

    Last edited by deathmojang; 02-21-2021 at 08:08.
    deathmojang is offline
    Bacardi
    Veteran Member
    Join Date: Jan 2010
    Location: mom's basement
    Old 11-06-2020 , 11:17   Re: [TF2] Built-in vote fixer (conflict between built-in vote and sm_nextmap)
    Reply With Quote #2

    ...not exactly 'bug'. More like conflict.
    You just need unload SM nextmap plugin to get in-game map system work normally.

    *edit
    and perhaps set in server.cfg: sm_nextmap ""
    if people use SM mapchooser for example.

    Last edited by Bacardi; 11-06-2020 at 11:19.
    Bacardi is offline
    Reply



    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 00:15.


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