View Single Post
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen.
Old 06-06-2015 , 11:51   Re: [Request] Lock Team for CS:GO
Reply With Quote #2

Copy-pasta at is finest. Not tested.

sm_closect --> lock ct team
sm_closet --> lock t team
PHP Code:
#pragma semicolon 1
#include <sourcemod>

Handle g_hEnabledCT INVALID_HANDLE;
Handle g_hEnabledT INVALID_HANDLE;

public 
OnPluginStart()
{
    
g_hEnabledCT CreateConVar("cct_enable""0");
    
g_hEnabledT CreateConVar("ct_enable""0");
    
    
RegAdminCmd("sm_closect"Command_CloseCTADMFLAG_ROOT);
    
RegAdminCmd("sm_closet"Command_CloseTADMFLAG_ROOT);

    
RegConsoleCmd("jointeam"Join);
}

public 
Action Command_CloseCT(useridargs)
{
    if(
GetConVarInt(g_hEnabledCT) == 1)
    {
        
SetConVarInt(g_hEnabledCT0);
        
PrintToChatAll("[SM] CT team is no longer closed by an admin");
    }
    else
    {
        
SetConVarInt(g_hEnabledCT1);
        
PrintToChatAll("[SM] CT team is now closed by an admin");
    }

   
public 
Action Command_CloseT(useridargs)
{
    if(
GetConVarInt(g_hEnabledT) == 1)
    {
        
SetConVarInt(g_hEnabledT0);
        
PrintToChatAll("[SM] T team is no longer closed by an admin");
    }
    else
    {
        
SetConVarInt(g_hEnabledT1);
        
PrintToChatAll("[SM] T team is now closed by an admin");
    }
}  

public 
Action Join(clientargs)
{
  
char team[2];
  
GetCmdArg(1teamsizeof(team));

  
int teamnumber StringToInt(team);


  if (
GetConVarInt(g_hEnabledCT) == && teamnumber == && GetUserAdmin(client) == INVALID_ADMIN_ID)
  {
      
PrintToChat(client"[SM] CT team is closed by an admin, you cannot join this team!");
      return 
Plugin_Handled;
  }
  else if (
GetConVarInt(g_hEnabledT) == && teamnumber == && GetUserAdmin(client) == INVALID_ADMIN_ID)
  {
      
PrintToChat(client"[SM] T team is closed by an admin, you cannot join this team!");
      return 
Plugin_Handled;
  }
  return 
Plugin_Continue;


__________________
Want to check my plugins ?
Arkarr is offline