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_CloseCT, ADMFLAG_ROOT);
RegAdminCmd("sm_closet", Command_CloseT, ADMFLAG_ROOT);
RegConsoleCmd("jointeam", Join);
}
public Action Command_CloseCT(userid, args)
{
if(GetConVarInt(g_hEnabledCT) == 1)
{
SetConVarInt(g_hEnabledCT, 0);
PrintToChatAll("[SM] CT team is no longer closed by an admin");
}
else
{
SetConVarInt(g_hEnabledCT, 1);
PrintToChatAll("[SM] CT team is now closed by an admin");
}
}
public Action Command_CloseT(userid, args)
{
if(GetConVarInt(g_hEnabledT) == 1)
{
SetConVarInt(g_hEnabledT, 0);
PrintToChatAll("[SM] T team is no longer closed by an admin");
}
else
{
SetConVarInt(g_hEnabledT, 1);
PrintToChatAll("[SM] T team is now closed by an admin");
}
}
public Action Join(client, args)
{
char team[2];
GetCmdArg(1, team, sizeof(team));
int teamnumber = StringToInt(team);
if (GetConVarInt(g_hEnabledCT) == 1 && teamnumber == 3 && 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) == 1 && teamnumber == 2 && 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;
}
__________________