View Single Post
unnyquee
Senior Member
Join Date: Jun 2009
Location: Constanta, Romania
Old 03-12-2010 , 09:37   Re: Ban from ct team
Reply With Quote #11

In case you might refer to what Brreaker said..

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define ACCESS ADMIN_BAN // your access level
#define isPlayer(%1) (1 <= %1 <= get_maxplayers())

new bool:g_bClientBanned[32];

public 
plugin_init()
{
      
register_plugin("Ban for Joining CT Team""0.0.1""benamo6");
      
      
register_event("TextMsg""eJoiningCT""b""2=#Cstrike_TitlesTXT_Game_join_ct");
      
      
register_concmd("amx_ctban""_ctBan"ACCESS"<nickname> <status> - sets whether <nickname> can join the CT team or not");
}

public 
_ctBan(idlevelcid)
{
      if(!
cmd_access(idlevelcid3))
      {
            return 
PLUGIN_HANDLED;
      }
      
      new 
szNickname[32], szStatus[2];
      new 
iStatusiTarget;
      
      
read_argv(1szNickname31);
      
read_argv(2szStatus1);
      
      
iStatus str_to_num(szStatus);
      
      
iTarget cmd_target(idszNickname8);
      
      if(!
iTarget || !isPlayer(iTarget))
      {
            return 
PLUGIN_HANDLED;
      }
      
      if(
iStatus == 1)
      {
            
g_bClientBanned[iTarget] = true;
      }
      
      else 
      {
            
g_bClientBanned[iTarget] = false;
      }
      
      return 
PLUGIN_HANDLED;
}

public 
eJoiningCT(id)
{
      if(
g_bClientBanned[id] == true)
      {
            
client_print(idprint_chat"* You have been banned from joining the CT Team.");
            
client_print(idprint_chat"* You have been moved to SPECTATORS.");
      }
      
      
_moveToSpec(id);
}

_moveToSpec(id)
{
      
cs_set_user_team(idCS_TEAM_SPECTATOR);

..Hope that will do the trick!

Non-tested!
__________________

Last edited by unnyquee; 03-12-2010 at 09:49.
unnyquee is offline