View Single Post
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