Raised This Month: $44 Target: $400
 11% 

[CS:S/CS:GO] blockteam


Post New Thread Reply   
 
Thread Tools Display Modes
Author
potatoz
AlliedModders Donor
Join Date: Nov 2016
Plugin ID:
5971
Plugin Version:
1.0
Plugin Category:
General Purpose
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    block entry into a specific team on a map-to-map basis.
    Old 01-07-2018 , 14:36   [CS:S/CS:GO] blockteam
    Reply With Quote #1

    BLOCKTEAM
    as made by potatoz, original by graffiti




    DESCRIPTION

    This plugin is based of Graffiti's "[CS:GO] Block Team for MG course maps" and simply promises to allow you to block entry into a specific team on a map-to-map basis. This is meant mostly for minigame-servers where you may have troubles with people in both teams but i'm sure you could find use for it elsewhere as well. If not set manually, this plugin will attempt to automatically block the team which has the least amount of spawn points.

    COMMANDS
    !blockteam <CT/T>- Add a team-block for current map to the config

    INSTALLATION
    - Put blockteam.smx in /addons/sourcemod/plugins
    - Put blockteam_config.cfg in addons/sourcemod/configs
    - Profit!!!

    NOTE
    Majority of the idea is thanks to Graffiti, i simply updated his already quite good plugin
    Attached Files
    File Type: cfg blockteam_config.cfg (130 Bytes, 386 views)
    File Type: sp Get Plugin or Get Source (blockteam.sp - 570 views - 6.3 KB)
    __________________

    Last edited by potatoz; 08-17-2018 at 08:14.
    potatoz is offline
    potatoz
    AlliedModders Donor
    Join Date: Nov 2016
    Old 01-07-2018 , 16:27   Re: [CS:S/CS:GO] blockteam
    Reply With Quote #2

    If you use teamchange-unlimited along with this, use this version of the plugin instead

    EDIT: The updated version of the original plugin includes unlimited team-switches through all non-blocked teams, however, if you really prefer teamchange_unlimited, i've updated this plugin as well
    Attached Files
    File Type: sp Get Plugin or Get Source (blockteam.sp - 634 views - 4.8 KB)
    __________________

    Last edited by potatoz; 01-08-2018 at 06:14.
    potatoz is offline
    PinHeaDi
    Senior Member
    Join Date: Jul 2013
    Location: Bulgaria
    Old 01-07-2018 , 17:06   Re: [CS:S/CS:GO] blockteam
    Reply With Quote #3

    You can use "mp_humanteam any/t/ct" instead of hooking jointeam.
    __________________
    PinHeaDi is offline
    sneaK
    SourceMod Moderator
    Join Date: Feb 2015
    Location: USA
    Old 01-07-2018 , 17:19   Re: [CS:S/CS:GO] blockteam
    Reply With Quote #4

    Quote:
    Originally Posted by PinHeaDi View Post
    You can use "mp_humanteam any/t/ct" instead of hooking jointeam.
    Exactly this ^

    Why use a plugin when you can use an already existing in-game cvar? Just use map configs plugin (which you're probably using already), and the cvar listed above.
    __________________

    Last edited by sneaK; 01-07-2018 at 17:19.
    sneaK is offline
    potatoz
    AlliedModders Donor
    Join Date: Nov 2016
    Old 01-07-2018 , 17:21   Re: [CS:S/CS:GO] blockteam
    Reply With Quote #5

    Quote:
    Originally Posted by PinHeaDi View Post
    You can use "mp_humanteam any/t/ct" instead of hooking jointeam.
    Hmmm, didn't know about that one, i'll remake the plugin using mp_humanteam instead for sure!

    EDIT: Done, the plugin is now way more simple, if you already have map configs i suggest you use yourself of the solution sneaK suggested.
    __________________

    Last edited by potatoz; 01-07-2018 at 17:28.
    potatoz is offline
    Lannister
    Veteran Member
    Join Date: Apr 2015
    Old 01-07-2018 , 18:25   Re: [CS:S/CS:GO] blockteam
    Reply With Quote #6

    As far as i know, if you use the Team limit bypass made from Zephyrus https://forums.alliedmods.net/showthread.php?t=219812 people still will be abble to join to another team, and basically all servers use this, but i'll test with this plugin and check if it works correctly even using the Bypass plugin
    Lannister is offline
    PinHeaDi
    Senior Member
    Join Date: Jul 2013
    Location: Bulgaria
    Old 01-07-2018 , 22:03   Re: [CS:S/CS:GO] blockteam
    Reply With Quote #7

    This plugins was making doubled stings, so map into map and than "team_blocked". I made some changes to fix that. Also, I removed the IsMapConfigured bool, since the command itself doens't duplicate existing strings, but simply edits them and now you can change the allowed team more than once, if you're not using the plugin in a MG server. No need of a config, the plugin will auto generate it when you use it for the first time.

    PHP Code:
    #include <sourcemod>
    #include <csgocolors>

    public OnPluginStart()
    {
        
    RegAdminCmd("sm_allowteam"Command_BlockTeamADMFLAG_ROOT);
    }

    public 
    void OnConfigsExecuted()
    {
        
    Parse_MapConfig(); ////Won't trigger a crash
    }

    public 
    Action Command_BlockTeam(int clientint args)
    {
        if(
    IsFakeClient(client)) return Plugin_Handled;
        
        
    char g_CurrentMap[128], allowedteam[6], config[PLATFORM_MAX_PATH];
        
    GetCurrentMap(g_CurrentMapsizeof(g_CurrentMap));
        
    BuildPath(Path_SMconfigsizeof(config), "configs/blockteam_config.cfg");
        
        
    KeyValues BlockedMaps = new KeyValues("blockteam_config");
        
    BlockedMaps.ImportFromFile(config);
        
    BlockedMaps.JumpToKey(g_CurrentMaptrue);
        
        
    GetCmdArgString(allowedteamsizeof(allowedteam));
        
        if(
    StrEqual(allowedteam"ct"false))
        {
            
    Format(allowedteamsizeof(allowedteam), "ct");
            
    CPrintToChat(client" [{red}!{default}] Now players can only join the {green}counter-terorists {default}team.");
        }
        else if(
    StrEqual(allowedteam"t"false))
        {
            
    Format(allowedteamsizeof(allowedteam), "t");
            
    CPrintToChat(client" [{red}!{default}] Now players can only join the {green}terorists {default}team.");
        }
        else if(
    StrEqual(allowedteam"any"false)) 
        {
            
    Format(allowedteamsizeof(allowedteam), "any");
            
    CPrintToChat(client" [{red}!{default}] Now players can join {green}both {default}teams.");
        }
        else
        {
            
    CPrintToChat(client" [{red}!{default}] Usage: {green}sm_allowteam {default}<{lightgreen}CT{default}{default}/{lightgreen}T{default}/{lightgreen}ANY{default}>");
            return 
    Plugin_Handled;
        }

        
    BlockedMaps.SetString("team_allowed"allowedteam);
        
    BlockedMaps.Rewind();
        
    BlockedMaps.ExportToFile(config);
        
    delete BlockedMaps
        
        
    Parse_MapConfig();
        
        return 
    Plugin_Continue;
    }

    void Parse_MapConfig()
    {
        
    char g_Config[PLATFORM_MAX_PATH], g_CurrentMap[128];
        
    GetCurrentMap(g_CurrentMapsizeof(g_CurrentMap));
        
    BuildPath(Path_SMg_Configsizeof(g_Config), "configs/blockteam_config.cfg");

        
    KeyValues block = new KeyValues("blockteam_config");

        if (
    FileToKeyValues(blockg_Config))
        {
            
    Handle allowedteam FindConVar("mp_humanteam");
            
            if (
    KvJumpToKey(blockg_CurrentMap))
            {
                
    char allowed[6];
                
    KvGetString(block"team_allowed"allowedsizeof(allowed));
                if(
    StrEqual(allowed"t"))
                {
                    
    SetConVarString(allowedteam"t"truefalse);
                }
                else if(
    StrEqual(allowed"ct"))
                {
                    
    SetConVarString(allowedteam"ct"truefalse);
                }
                else if(
    StrEqual(allowed"any"))
                {
                    
    SetConVarString(allowedteam"any"truefalse);
                }
            }
            else 
    ///If the map isn't in the config - allow all
            
    {
                
    SetConVarString(allowedteam"any"truefalse);
            }    
        }
        
    delete block;

    @Lannister, Zephyrus team bypass can't bypass this. I have it in my server and it doesn't bypass "mp_humanteam". (Had an extremely rare case, where a player was able to join the other team, but i'm pretty sure it was something else that caused it.)
    Attached Files
    File Type: inc csgocolors.inc (14.9 KB, 336 views)
    __________________

    Last edited by PinHeaDi; 01-08-2018 at 00:56.
    PinHeaDi is offline
    potatoz
    AlliedModders Donor
    Join Date: Nov 2016
    Old 01-08-2018 , 05:58   Re: [CS:S/CS:GO] blockteam
    Reply With Quote #8

    Code has been updated to hopefully work better with some help from PinHeadi's snippet.

    I've kept the IsMapConfigured and team_blocked parts, this is mostly to print some useful information if you type !blockteam without any arguments, however if you add arguments it will simply overwrite and replace the block. I also added a "jointeam"-listener in order to allow unlimited teamchanges through all non-blocked teams and to add an additional team-block in case the first one wouldn't work for any reason.

    EDIT: Just added an automatic team-block, the plugin basically tries to automatically block the team with the least amount of spawn points, if it can't do this however, it won't block anything unless you do it manually. It also only attempts to automatically block a team if you haven't already configured a specific team-block, this means you could easily overwrite the automatic team-block by adding a block manually.
    __________________

    Last edited by potatoz; 01-08-2018 at 08:55.
    potatoz is offline
    wolvez04
    Senior Member
    Join Date: Feb 2016
    Location: Andora
    Old 07-02-2018 , 04:22   Re: [CS:S/CS:GO] blockteam
    Reply With Quote #9

    Quote:
    Originally Posted by potatoz View Post
    If you use teamchange-unlimited along with this, use this version of the plugin instead

    EDIT: The updated version of the original plugin includes unlimited team-switches through all non-blocked teams, however, if you really prefer teamchange_unlimited, i've updated this plugin as well
    This this still suggested? I noticed the main plugin is more updated, or should i use this if version if i use teamchange_unlimited?
    __________________
    Hiring developers of all sorts for small or big jobs.
    Paying nicely. Just PM for any available jobs.

    wolvez04 is offline
    potatoz
    AlliedModders Donor
    Join Date: Nov 2016
    Old 07-17-2018 , 08:36   Re: [CS:S/CS:GO] blockteam
    Reply With Quote #10

    Quote:
    Originally Posted by wolvez04 View Post
    This this still suggested? I noticed the main plugin is more updated, or should i use this if version if i use teamchange_unlimited?
    Sorry for the delay in replying, i've been off this website for a while. I'll reply for anyone with the same question.

    Yes, You should still use that version if you use teamchange_unlimited, however, i would recommend just using the main version of the plugin and disabling teamchange_unlimited as the main plugin allows for unlimited team-changes through all non-blocked teams just as teamchange_unlimited would.
    __________________

    Last edited by potatoz; 07-17-2018 at 08:37.
    potatoz is offline
    Reply


    Thread Tools
    Display Modes

    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 10:36.


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