Raised This Month: $12 Target: $400
 3% 

CS:GO Plugin that prevents team change.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
krikus62
Senior Member
Join Date: Jan 2015
Old 03-28-2015 , 17:59   CS:GO Plugin that prevents team change.
Reply With Quote #1

Is there a plugin for CS:GO that prevents players to change team after they have been assigned to one?
krikus62 is offline
Wilczek
AlliedModders Donor
Join Date: Oct 2012
Location: Poland
Old 03-28-2015 , 18:09   Re: CS:GO Plugin that prevents team change.
Reply With Quote #2

Here you go.

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_VERSION    "1.0"

new Handle:g_hLocked INVALID_HANDLE;

public 
OnPluginStart()
{
    
AddCommandListener(Command_JoinTeam"jointeam");
    
g_hLocked CreateConVar("sm_lock_teams""1""Enable or disable locking teams during match"FCVAR_NOTIFY);
}

public 
Action:Command_JoinTeam(client, const String:command[], args)
{    
    if (
client != 0)
    {
        if(
IsClientInGame(client) && !IsFakeClient(client))
        {
            if (
GetClientTeam(client) > && GetConVarBool(g_hLocked))
            {
                
PrintToChat(client"\x01 \x07You cannot change your team during a match!");
                return 
Plugin_Stop;
            }
        }
    }

    return 
Plugin_Continue;

__________________

Last edited by Wilczek; 03-28-2015 at 18:13.
Wilczek is offline
krikus62
Senior Member
Join Date: Jan 2015
Old 03-29-2015 , 17:26   Re: CS:GO Plugin that prevents team change.
Reply With Quote #3

Wow thank you so much! This works perfectly!
krikus62 is offline
Apina
AlliedModders Donor
Join Date: May 2013
Old 05-28-2015 , 11:37   Re: CS:GO Plugin that prevents team change.
Reply With Quote #4

Dosent work for csgo still players can change team when they assigned to one
Apina is offline
krikus62
Senior Member
Join Date: Jan 2015
Old 05-28-2015 , 11:56   Re: CS:GO Plugin that prevents team change.
Reply With Quote #5

Check your logs, it should work, as I am still running it.
krikus62 is offline
Apina
AlliedModders Donor
Join Date: May 2013
Old 05-28-2015 , 11:58   Re: CS:GO Plugin that prevents team change.
Reply With Quote #6

Quote:
Originally Posted by krikus62 View Post
Check your logs, it should work, as I am still running it.
my server using 120 slots and csgo teamlimits to access 64 players play at standard maps, i am compiled this plugin dosent work still players when they choose team they can switch team.

Last edited by Apina; 05-28-2015 at 11:59.
Apina is offline
sirc86
Junior Member
Join Date: May 2013
Old 01-28-2017 , 16:08   Re: CS:GO Plugin that prevents team change.
Reply With Quote #7

Hello,

Can someone adding to plugin, exception to admins to be able to move to spectators ?

Thank you!

Last edited by sirc86; 01-28-2017 at 16:21.
sirc86 is offline
Schpraaankiii
Veteran Member
Join Date: Dec 2009
Location: Sweden Norrköping
Old 09-22-2017 , 11:30   Re: CS:GO Plugin that prevents team change.
Reply With Quote #8

Hey guys. I need somehting like this as well. Anyone out there with some skills?
__________________
CAOSK-ESPORTS.COM
Schpraaankiii is offline
Send a message via Skype™ to Schpraaankiii
Silvsilver
Member
Join Date: Oct 2017
Old 11-27-2017 , 16:30   Re: CS:GO Plugin that prevents team change.
Reply With Quote #9

Quote:
Originally Posted by Schpraaankiii View Post
Hey guys. I need somehting like this as well. Anyone out there with some skills?
I need this too? found something?
Silvsilver is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 11-28-2017 , 22:12   Re: CS:GO Plugin that prevents team change.
Reply With Quote #10

PHP Code:
#include <sourcemod>

bool ClientInGame[MAXPLAYERS 1];
ConVar AllowAdmins;

public 
void OnPluginStart()
{
    
AddCommandListener(Command_JoinTeam"jointeam");
    
AllowAdmins CreateConVar("sm_gotospec_allow_admins""1""Allow admins to go to spectator team? [1 - true, 0 - false]."0true0.0true1.0);
}

public 
void OnClientPutInServer(int client)
{
    
ClientInGame[client] = false;
}

public 
Action Command_JoinTeam(int clientchar[] commandint args)  
{
    
char TeamName[8];
    
GetCmdArg(1TeamNamesizeof(TeamName));
    
int Team StringToInt(TeamName);


    if (
CheckCommandAccess(client"sm_command"ADMFLAG_GENERICtrue) && AllowAdmins.BoolValue)
    {
        if (
Team >= 1){return Plugin_Continue;}
        else{
            return 
Plugin_Handled;
        }
    }
    
    if (!
ClientInGame[client])
    {
        switch (
Team){
            case 
2,3: {ClientInGame[client] = true; return Plugin_Continue;}
            default: return 
Plugin_Handled;
        } 
    }
    
    if (
ClientInGame[client])
    {
        switch (
Team){
            default: return 
Plugin_Handled;
        }
     }
    
     return 
Plugin_Continue;

This should work, it should block the auto-pick option too.
__________________

Last edited by PinHeaDi; 11-28-2017 at 22:19.
PinHeaDi 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 11:35.


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