AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [CS:S/CS:GO] blockteam (https://forums.alliedmods.net/showthread.php?t=304200)

potatoz 01-07-2018 13:36

[CS:S/CS:GO] blockteam
 
2 Attachment(s)
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

potatoz 01-07-2018 15:27

Re: [CS:S/CS:GO] blockteam
 
1 Attachment(s)
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

PinHeaDi 01-07-2018 16:06

Re: [CS:S/CS:GO] blockteam
 
You can use "mp_humanteam any/t/ct" instead of hooking jointeam.

sneaK 01-07-2018 16:19

Re: [CS:S/CS:GO] blockteam
 
Quote:

Originally Posted by PinHeaDi (Post 2570469)
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.

potatoz 01-07-2018 16:21

Re: [CS:S/CS:GO] blockteam
 
Quote:

Originally Posted by PinHeaDi (Post 2570469)
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.

Lannister 01-07-2018 17:25

Re: [CS:S/CS:GO] blockteam
 
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

PinHeaDi 01-07-2018 21:03

Re: [CS:S/CS:GO] blockteam
 
1 Attachment(s)
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.)

potatoz 01-08-2018 04:58

Re: [CS:S/CS:GO] blockteam
 
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.

wolvez04 07-02-2018 03:22

Re: [CS:S/CS:GO] blockteam
 
Quote:

Originally Posted by potatoz (Post 2570459)
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?

potatoz 07-17-2018 07:36

Re: [CS:S/CS:GO] blockteam
 
Quote:

Originally Posted by wolvez04 (Post 2600480)
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.


All times are GMT -4. The time now is 13:42.

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