Raised This Month: $ Target: $400
 0% 

[Request] Lock Team for CS:GO


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
spancer35
Senior Member
Join Date: Dec 2014
Location: City 17
Old 06-06-2015 , 11:05   [Request] Lock Team for CS:GO
Reply With Quote #1

When i was type "!lock_team T" or "sm_lock_team T" no body can't join to T team this is same for CT team.(Sorry for my bad English )

For example;
Code:
*DEAD* Admin: !lock_team T
[SM] T Team has been locked by Admin.
_______________________________________________________

***somebody  join to locked team***
[SM] You Can't join this team. T team has been locked by Admin!
_______________________________________________________
*DEAD* Admin: !unlock_team T
[SM] T Team un-locked by Admin!
if that's possible pls somebody can make it for me :'(


and i found it but this is just for Lock CT team!

PHP Code:
#pragma semicolon 1
#include <sourcemod>

new Handle:g_hEnabled INVALID_HANDLE;

public 
OnPluginStart()
{
    
g_hEnabled CreateConVar("cct_enable""0");
    
    
RegAdminCmd("sm_closect"Command_CloseCTADMFLAG_ROOT);

    
RegConsoleCmd("jointeam"Join);
}

public 
ActionCommand_CloseCT(useridargs)
{
    if(
GetConVarInt(g_hEnabled) == 1)
    {
        
SetConVarInt(g_hEnabled0);
        
PrintToChatAll("[SM] CT team is no longer closed by an admin");
    }
    else
    {
        
SetConVarInt(g_hEnabled1);
        
PrintToChatAll("[SM] CT team is now closed by an admin");
    }
}  

public 
Action:Join(clientargs)
{
  
decl String:team[2]; GetCmdArg(1teamsizeof(team));

  new 
teamnumber StringToInt(team);


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



Last edited by spancer35; 06-06-2015 at 11:07. Reason: forget
spancer35 is offline
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
ffriozi
Senior Member
Join Date: Feb 2016
Old 08-29-2016 , 18:43   Re: [Request] Lock Team for CS:GO
Reply With Quote #3

Quote:
Originally Posted by Arkarr View Post
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;


no longer works
ffriozi is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 08-30-2016 , 01:12   Re: [Request] Lock Team for CS:GO
Reply With Quote #4

Error logs ?
__________________
Want to check my plugins ?
Arkarr is offline
arcticx2
Senior Member
Join Date: Nov 2011
Old 10-15-2016 , 08:23   Re: [Request] Lock Team for CS:GO
Reply With Quote #5

Quote:
Originally Posted by Arkarr View Post
Error logs ?
No errors in compile but nothing works either
arcticx2 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-15-2016 , 08:58   Re: [Request] Lock Team for CS:GO
Reply With Quote #6

Use AddCommandListener to jointeam, don't create new sm command.
__________________
Do not Private Message @me
Bacardi is offline
arcticx2
Senior Member
Join Date: Nov 2011
Old 10-15-2016 , 09:07   Re: [Request] Lock Team for CS:GO
Reply With Quote #7

Quote:
Originally Posted by Bacardi View Post
Use AddCommandListener to jointeam, don't create new sm command.
thanks for respond

i found new useful plugin in here

https://forums.alliedmods.net/showth...20#post2279220

and the problem of this plugin is it locks team BUT YOU CANT UNDO IT ! i change the value of sm_lock_teams but it doesn't effect the game

anyway i dont know how to program in sm but i create one so can you check what is wrong in the source code or mine ?

note: my code is just like source but i tried to create another admin command to change the status of
sm_lock_teams variable , when i enter sm_lockteams nothing will happen


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);
    
    
RegAdminCmd("sm_lockteams",            CMD_LOCK,            ADMFLAG_ROOT,        "Lock join teams");
}

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 \x07[SM] Change team is locked by admin!");
                return 
Plugin_Stop;
            }
        }
    }

    return 
Plugin_Continue;
}  

public 
ActionCMD_LOCK(clientargs)
{
    if(!
IsClientValid(client) || !IsClientInGame(client))
    {
        return 
Plugin_Handled;
    }
    
    if(
args != 1)
    {
        
ReplyToCommand(client"%t""CMD_Extend_Usage");
        return 
Plugin_Handled;
    }
        
    if (
GetConVarBool(g_hLocked)){
        
SetConVarInt(g_hLocked0);
        
PrintToChat(client"\x01 \x07[SM] Change team is opened by admin");

    }else{
        
SetConVarInt(g_hLocked1);
        
PrintToChat(client"\x01 \x07[SM] Change team is closed by admin");

    }
        
    return 
Plugin_Handled;
}


boolIsClientValid(client)
{
    return ((
client 0) && (client <= MaxClients));


Last edited by arcticx2; 10-15-2016 at 09:09. Reason: add note
arcticx2 is offline
Reply



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 23:04.


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