plugins/include/banning.inc
author Nicholas Hastings <skamonkey@gmail.com>
Fri Mar 22 23:07:17 2013 -0400 (2013-03-22)
changeset 3868 1f5d92297fd1
parent 2289 44045ead61cd
permissions -rw-r--r--
Added Dota 2 gamedata for SDKHooks.
     1 /**
     2  * vim: set ts=4 :
     3  * =============================================================================
     4  * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
     5  * =============================================================================
     6  *
     7  * This file is part of the SourceMod/SourcePawn SDK.
     8  *
     9  * This program is free software; you can redistribute it and/or modify it under
    10  * the terms of the GNU General Public License, version 3.0, as published by the
    11  * Free Software Foundation.
    12  * 
    13  * This program is distributed in the hope that it will be useful, but WITHOUT
    14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    15  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    16  * details.
    17  *
    18  * You should have received a copy of the GNU General Public License along with
    19  * this program.  If not, see <http://www.gnu.org/licenses/>.
    20  *
    21  * As a special exception, AlliedModders LLC gives you permission to link the
    22  * code of this program (as well as its derivative works) to "Half-Life 2," the
    23  * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    24  * by the Valve Corporation.  You must obey the GNU General Public License in
    25  * all respects for all other code used.  Additionally, AlliedModders LLC grants
    26  * this exception to all derivative works.  AlliedModders LLC defines further
    27  * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    28  * or <http://www.sourcemod.net/license.php>.
    29  *
    30  * Version: $Id$
    31  */
    32 
    33 #if defined _banning_included
    34  #endinput
    35 #endif
    36 #define _banning_included
    37 
    38 #define BANFLAG_AUTO		(1<<0)	/**< Auto-detects whether to ban by steamid or IP */
    39 #define BANFLAG_IP			(1<<1)	/**< Always ban by IP address */
    40 #define BANFLAG_AUTHID		(1<<2)	/**< Always ban by authstring (for BanIdentity) if possible */
    41 #define BANFLAG_NOKICK		(1<<3)	/**< Does not kick the client */
    42 
    43 /**
    44  * Called for calls to BanClient() with a non-empty command.
    45  *
    46  * @param client		Client being banned.
    47  * @param time			Time the client is being banned for (0 = permanent).
    48  * @param flags			One if AUTHID or IP will be enabled.  If AUTO is also 
    49  *						enabled, it means Core autodetected which to use.
    50  * @param reason		Reason passed via BanClient().
    51  * @param kick_message	Kick message passed via BanClient().
    52  * @param command		Command string to identify the ban source.
    53  * @param source		Source value passed via BanClient().
    54  * @return				Plugin_Handled to block the actual server banning.
    55  *						Kicking will still occur.
    56  */
    57 forward Action:OnBanClient(client,
    58 						   time, 
    59 						   flags, 
    60 						   const String:reason[], 
    61 						   const String:kick_message[], 
    62 						   const String:command[],
    63 						   any:source);
    64 
    65 /**
    66  * Called for calls to BanIdentity() with a non-empty command.
    67  *
    68  * @param identity		Identity string being banned (authstring or ip).
    69  * @param time			Time the client is being banned for (0 = permanent).
    70  * @param flags			Ban flags (only IP or AUTHID are valid here).
    71  * @param reason		Reason passed via BanIdentity().
    72  * @param command		Command string to identify the ban source.
    73  * @param source		Source value passed via BanIdentity().
    74  * @return				Plugin_Handled to block the actual server banning.
    75  */
    76 forward Action:OnBanIdentity(const String:identity[],
    77 							 time,
    78 							 flags,
    79 							 const String:reason[],
    80 							 const String:command[],
    81 							 any:source);
    82 
    83 /**
    84  * Called for calls to RemoveBan() with a non-empty command.
    85  *
    86  * @param identity		Identity string being banned (authstring or ip).
    87  * @param flags			Ban flags (only IP or AUTHID are valid here).
    88  * @param command		Command string to identify the ban source.
    89  * @param source		Source value passed via BanIdentity().
    90  * @return				Plugin_Handled to block the actual server banning.
    91  */
    92 forward Action:OnRemoveBan(const String:identity[],
    93 						   flags,
    94 						   const String:command[],
    95 						   any:source);
    96 
    97 /**
    98  * Bans a client.
    99  *
   100  * @param client		Client being banned.
   101  * @param time			Time (in minutes) to ban (0 = permanent).
   102  * @param flags			Flags for controlling the ban mechanism.  If AUTHID 
   103  *						is set and no AUTHID is available, the ban will fail 
   104  *						unless AUTO is also flagged.
   105  * @param reason		Reason to ban the client for.
   106  * @param kick_message	Message to display to the user when kicking.
   107  * @param command		Command string to identify the source.  If this is left 
   108  *						empty, then the OnBanClient forward will not be called.
   109  * @param source		A source value that could be interpreted as a player 
   110  *						index of any sort (not actually checked by Core).
   111  * @return				True on success, false on failure.
   112  * @error				Invalid client index or client not in game.
   113  */
   114 native bool:BanClient(client, 
   115 					  time, 
   116 					  flags, 
   117 					  const String:reason[], 
   118 					  const String:kick_message[]="", 
   119 					  const String:command[]="",
   120 					  any:source=0);
   121 
   122 /**
   123  * Bans an identity (either an IP address or auth string).
   124  *
   125  * @param identity		String to ban (ip or authstring).
   126  * @param time			Time to ban for (0 = permanent).
   127  * @param flags			Flags (only IP and AUTHID are valid flags here).
   128  * @param reason		Ban reason string.
   129  * @param command		Command string to identify the source.  If this is left 
   130  *						empty, then the OnBanIdentity forward will not be called.
   131  * @param source		A source value that could be interpreted as a player
   132  *						index of any sort (not actually checked by Core).
   133  * @return				True on success, false on failure.
   134  */
   135 native bool:BanIdentity(const String:identity[], 
   136 						time, 
   137 						flags, 
   138 						const String:reason[],
   139 						const String:command[]="",
   140 						any:source=0);
   141 
   142 /**
   143  * Removes a ban that was written to the server (either in memory or on disk).
   144  *
   145  * @param identity		String to unban (ip or authstring).
   146  * @param flags			Flags (only IP and AUTHID are valid flags here).
   147  * @param command		Command string to identify the source.  If this is left 
   148  *						empty, then OnRemoveBan will not be called.
   149  * @param source		A source value that could be interpreted as a player 
   150  *						index of any sort (not actually checked by Core).
   151  * @return				True on success, false on failure.
   152  */
   153 native bool:RemoveBan(const String:identity[], 
   154 					  flags, 
   155 					  const String:command[]="", 
   156 					  any:source=0);
   157